You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to use scipy.weave.inline. I appear to get the same error no matter what compiler I try.
Please note that I am attaching a python script with examples of weave.inline that I have been attempting to implement. This is messy and there are a lot of commented lines but will be a start to demonstrate what I am testing. Hopefully this will help someone.
I have also tried to separate out the information below so it will read as easily as possible for any onlookers. Look at all section titles before digging too deep because they may not be in any intuitive order for those that are actual programmers.
Thanks for any insight. It was suggested from the scipy list that I post these here.
Also note, that there was an error in numpy for me. I had to comment several lines out before I got the weave error. This is included below as well.
Also, all of this is new so I appologize for not providing all the necessary information. And when I say new, I know python only a little and I have never compiled source files. I have a lot of scripting and VB background however.
Python Version:
2.4.4 (#71, Oct 18 2006, 08:34:43) [MSC v.1310 32 bit (Intel)]
Processor:
Intel(R) Pentium(R) M processor 2.13GHz
x86 Family 6 Model 13 Stepping 8
I have also tried the most recent enthought binaries and I had the same problem.
Compilers:
MinGw
Cygwin
SDK 2003 toolkit
SDK 2005
(I followed the directions which I could find online with regard to setting up environment paths and modifications to the msvccompiler.py.
Error message:
From what I can tell the error seems to occur when compiling. the s,o =exec_command(cmd) does not write out to the two output files containing the s, o information. Looking at the files, I do not get the object file. Depending on the compiler this may be the .obj or .o file. The .cpp or c++ source file is created. I do not know if the compiler creates the cpp file or a library acts as an interpreter that writes the python to c++ which can then be converted to the object file. Or maybe it is something completely different.
Here is the error using mingw:
<weave: compiling>
running build_ext
running build_src
building extension "sc_552cccf5dbf4f6eadd273cdcbd5860521" sources
customize Mingw32CCompiler
customize Mingw32CCompiler using build_ext
customize Mingw32CCompiler
customize Mingw32CCompiler using build_ext
building 'sc_552cccf5dbf4f6eadd273cdcbd5860521' extension
compiling C++ sources
C compiler: g++ -mno-cygwin -O2 -Wall
compile options: '-IC:\Python24\lib\site-packages\scipy\weave -IC:\Python24\lib\site-packages\scipy\weave\scxx -IC:\Python24\lib\site-packages\numpy\core\include -IC:\Python24\include -IC:\Python24\PC -c'
g++ -mno-cygwin -O2 -Wall -IC:\Python24\lib\site-packages\scipy\weave -IC:\Python24\lib\site-packages\scipy\weave\scxx -IC:\Python24\lib\site-packages\numpy\core\include -IC:\Python24\include -IC:\Python24\PC -c C:\Python24\lib\site-packages\scipy\weave\scxx\weave_imp.cpp -o c:\temp\Michael\python24_intermediate\compiler_12e837eb1ea3ab5199fbcc0e83015e3f\Release\python24\lib\site-packages\scipy\weave\scxx\weave_imp.o
Traceback (most recent call last):
File "C:\Python24\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 310, in RunScript
exec codeObject in main.dict
File "C:\Documents and Settings\Michael\Application Data\ESRI\ArcToolbox\scripts\test_weave.py", line 341, in ?
main()
File "C:\Documents and Settings\Michael\Application Data\ESRI\ArcToolbox\scripts\test_weave.py", line 224, in main
weave.inline('printf("%d\n",a);',['a'], verbose=2, type_converters=converters.blitz) #, compiler = 'msvc', verbpse=2, type_converters=converters.blitz, auto_downcast=0) #'msvc' or 'gcc' or 'mingw32'
File "C:\Python24\Lib\site-packages\scipy\weave\inline_tools.py", line 338, in inline
auto_downcast = auto_downcast,
File "C:\Python24\Lib\site-packages\scipy\weave\inline_tools.py", line 447, in compile_function
verbose=verbose, **kw)
File "C:\Python24\Lib\site-packages\scipy\weave\ext_tools.py", line 365, in compile
verbose = verbose, **kw)
File "C:\Python24\Lib\site-packages\scipy\weave\build_tools.py", line 269, in build_extension
setup(name = module_name, ext_modules = [ext],verbose=verb)
File "C:\Python24\Lib\site-packages\numpy\distutils\core.py", line 176, in setup
return old_setup(**new_attr)
File "C:\Python24\Lib\distutils\core.py", line 149, in setup
dist.run_commands()
File "C:\Python24\Lib\distutils\dist.py", line 946, in run_commands
self.run_command(cmd)
File "C:\Python24\Lib\distutils\dist.py", line 966, in run_command
cmd_obj.run()
File "C:\Python24\Lib\site-packages\numpy\distutils\command\build_ext.py", line 217, in run
self.build_extensions()
File "C:\Python24\Lib\distutils\command\build_ext.py", line 405, in build_extensions
self.build_extension(ext)
File "C:\Python24\Lib\site-packages\numpy\distutils\command\build_ext.py", line 320, in build_extension
extra_postargs=extra_args,
File "C:\Python24\Lib\site-packages\numpy\distutils\ccompiler.py", line 117, in CCompiler_compile
self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
File "C:\Python24\Lib\distutils\cygwinccompiler.py", line 149, in _compile
self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
File "C:\Python24\Lib\site-packages\numpy\distutils\ccompiler.py", line 34, in CCompiler_spawn
s,o = exec_command(cmd)
File "C:\Python24\lib\site-packages\numpy\distutils\exec_command.py", line 246, in exec_command
exec_command_dir = exec_dir,
File "C:\Python24\lib\site-packages\numpy\distutils\exec_command.py", line 346, in _exec_command_python
status = int(f.read())
ValueError: invalid literal for int():
Error using sdk 2003 toolkit:
<weave: compiling>
No module named msvccompiler in numpy.distutils; trying from distutils
creating c:\temp\Michael\python24_intermediate\compiler_d41d8cd98f00b204e9800998ecf8427e
running build_ext
running build_src
building extension "sc_552cccf5dbf4f6eadd273cdcbd5860522" sources
No module named msvccompiler in numpy.distutils; trying from distutils
customize MSVCCompiler
customize MSVCCompiler using build_ext
No module named msvccompiler in numpy.distutils; trying from distutils
customize MSVCCompiler
Missing compiler_cxx fix for MSVCCompiler
customize MSVCCompiler using build_ext
building 'sc_552cccf5dbf4f6eadd273cdcbd5860522' extension
compiling C sources
creating c:\temp\Michael\python24_intermediate\compiler_d41d8cd98f00b204e9800998ecf8427e\Release
creating c:\temp\Michael\python24_intermediate\compiler_d41d8cd98f00b204e9800998ecf8427e\Release\temp
creating c:\temp\Michael\python24_intermediate\compiler_d41d8cd98f00b204e9800998ecf8427e\Release\temp\Michael
creating c:\temp\Michael\python24_intermediate\compiler_d41d8cd98f00b204e9800998ecf8427e\Release\temp\Michael\python24_compiled
creating c:\temp\Michael\python24_intermediate\compiler_d41d8cd98f00b204e9800998ecf8427e\Release\Python24
creating c:\temp\Michael\python24_intermediate\compiler_d41d8cd98f00b204e9800998ecf8427e\Release\Python24\lib
creating c:\temp\Michael\python24_intermediate\compiler_d41d8cd98f00b204e9800998ecf8427e\Release\Python24\lib\site-packages
creating c:\temp\Michael\python24_intermediate\compiler_d41d8cd98f00b204e9800998ecf8427e\Release\Python24\lib\site-packages\scipy
creating c:\temp\Michael\python24_intermediate\compiler_d41d8cd98f00b204e9800998ecf8427e\Release\Python24\lib\site-packages\scipy\weave
creating c:\temp\Michael\python24_intermediate\compiler_d41d8cd98f00b204e9800998ecf8427e\Release\Python24\lib\site-packages\scipy\weave\scxx
cl.exe /c /nologo /Ox /MD /W3 /GX /DNDEBUG -IC:\Python24\lib\site-packages\scipy\weave -IC:\Python24\lib\site-packages\scipy\weave\scxx -IC:\Python24\lib\site-packages\numpy\core\include -IC:\Python24\include -IC:\Python24\PC /Tpc:\temp\Michael\python24_compiled\sc_552cccf5dbf4f6eadd273cdcbd5860522.cpp /Foc:\temp\Michael\python24_intermediate\compiler_d41d8cd98f00b204e9800998ecf8427e\Release\temp\Michael\python24_compiled\sc_552cccf5dbf4f6eadd273cdcbd5860522.obj /Zm1000
Traceback (most recent call last):
File "C:\Python24\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 310, in RunScript
exec codeObject in main.dict
File "C:\Documents and Settings\Michael\Application Data\ESRI\ArcToolbox\scripts\test_weave.py", line 341, in ?
main()
File "C:\Documents and Settings\Michael\Application Data\ESRI\ArcToolbox\scripts\test_weave.py", line 224, in main
weave.inline('printf("%d\n",a);',['a'], verbose=2, type_converters=converters.blitz) #, compiler = 'msvc', verbpse=2, type_converters=converters.blitz, auto_downcast=0) #'msvc' or 'gcc' or 'mingw32'
File "C:\Python24\Lib\site-packages\scipy\weave\inline_tools.py", line 338, in inline
auto_downcast = auto_downcast,
File "C:\Python24\Lib\site-packages\scipy\weave\inline_tools.py", line 447, in compile_function
verbose=verbose, **kw)
File "C:\Python24\Lib\site-packages\scipy\weave\ext_tools.py", line 365, in compile
verbose = verbose, **kw)
File "C:\Python24\Lib\site-packages\scipy\weave\build_tools.py", line 269, in build_extension
setup(name = module_name, ext_modules = [ext],verbose=verb)
File "C:\Python24\Lib\site-packages\numpy\distutils\core.py", line 176, in setup
return old_setup(**new_attr)
File "C:\Python24\Lib\distutils\core.py", line 149, in setup
dist.run_commands()
File "C:\Python24\Lib\distutils\dist.py", line 946, in run_commands
self.run_command(cmd)
File "C:\Python24\Lib\distutils\dist.py", line 966, in run_command
cmd_obj.run()
File "C:\Python24\Lib\site-packages\numpy\distutils\command\build_ext.py", line 217, in run
self.build_extensions()
File "C:\Python24\Lib\distutils\command\build_ext.py", line 405, in build_extensions
self.build_extension(ext)
File "C:\Python24\Lib\site-packages\numpy\distutils\command\build_ext.py", line 310, in build_extension
extra_postargs=extra_args,
File "C:\Python24\lib\distutils\msvccompiler.py", line 398, in compile
self.spawn ([self.cc] + compile_opts + pp_opts +
File "C:\Python24\Lib\site-packages\numpy\distutils\ccompiler.py", line 34, in CCompiler_spawn
s,o = exec_command(cmd)
File "C:\Python24\lib\site-packages\numpy\distutils\exec_command.py", line 246, in exec_command
exec_command_dir = exec_dir,
File "C:\Python24\lib\site-packages\numpy\distutils\exec_command.py", line 346, in _exec_command_python
status = int(f.read())
ValueError: invalid literal for int():
Code used for weave inline:
Please not that when I try any of these variations, I get the same error but I am trying to provide as much information as possible.
Example one
a = 1
weave.inline('printf("%d\n",a);',['a'], verbose=2,type_converters=converters.blitz)
For additional examples see attachment.
Error in Numpy:
Make the following changes to:
C:\Python24\Lib\site-packages\numpy\distutils\exec_command.py in order to get weave to work.
'''
if os.name in ['nt','dos']:
fdir,fn = os.path.split(pythonexe)
fn = fn.upper().replace('PYTHONW','PYTHON')
pythonexe = os.path.join(fdir,fn)
assert os.path.isfile(pythonexe), '%r is not a file' % (pythonexe,)
'''
The text was updated successfully, but these errors were encountered:
Original ticket http://projects.scipy.org/scipy/ticket/550 on 2007-12-03 by trac user odonnems, assigned to unknown.
Introduction to my problem
I am trying to use scipy.weave.inline. I appear to get the same error no matter what compiler I try.
Please note that I am attaching a python script with examples of weave.inline that I have been attempting to implement. This is messy and there are a lot of commented lines but will be a start to demonstrate what I am testing. Hopefully this will help someone.
I have also tried to separate out the information below so it will read as easily as possible for any onlookers. Look at all section titles before digging too deep because they may not be in any intuitive order for those that are actual programmers.
Thanks for any insight. It was suggested from the scipy list that I post these here.
Also note, that there was an error in numpy for me. I had to comment several lines out before I got the weave error. This is included below as well.
Also, all of this is new so I appologize for not providing all the necessary information. And when I say new, I know python only a little and I have never compiled source files. I have a lot of scripting and VB background however.
Thank you,
Michael
Installed software and OS:
scipy-0.6.0.win32-py2.4.exe
wxPython2.8-win32-unicode-2.8.6.1-py24.exe
pywin32-210.win32-py2.4.exe
python-2.4.4.msi
numpy-1.0.4.win32-py2.4.exe
OS: Microsoft Windows XP Professional SP2
Platform: win32 nt
Python Version:
2.4.4 (#71, Oct 18 2006, 08:34:43) [MSC v.1310 32 bit (Intel)]
Processor:
Intel(R) Pentium(R) M processor 2.13GHz
x86 Family 6 Model 13 Stepping 8
I have also tried the most recent enthought binaries and I had the same problem.
Compilers:
MinGw
Cygwin
SDK 2003 toolkit
SDK 2005
(I followed the directions which I could find online with regard to setting up environment paths and modifications to the msvccompiler.py.
Error message:
From what I can tell the error seems to occur when compiling. the s,o =exec_command(cmd) does not write out to the two output files containing the s, o information. Looking at the files, I do not get the object file. Depending on the compiler this may be the .obj or .o file. The .cpp or c++ source file is created. I do not know if the compiler creates the cpp file or a library acts as an interpreter that writes the python to c++ which can then be converted to the object file. Or maybe it is something completely different.
Here is the error using mingw:
compile options: '-IC:\Python24\lib\site-packages\scipy\weave -IC:\Python24\lib\site-packages\scipy\weave\scxx -IC:\Python24\lib\site-packages\numpy\core\include -IC:\Python24\include -IC:\Python24\PC -c'
g++ -mno-cygwin -O2 -Wall -IC:\Python24\lib\site-packages\scipy\weave -IC:\Python24\lib\site-packages\scipy\weave\scxx -IC:\Python24\lib\site-packages\numpy\core\include -IC:\Python24\include -IC:\Python24\PC -c C:\Python24\lib\site-packages\scipy\weave\scxx\weave_imp.cpp -o c:\temp\Michael\python24_intermediate\compiler_12e837eb1ea3ab5199fbcc0e83015e3f\Release\python24\lib\site-packages\scipy\weave\scxx\weave_imp.o
Traceback (most recent call last):
File "C:\Python24\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 310, in RunScript
exec codeObject in main.dict
File "C:\Documents and Settings\Michael\Application Data\ESRI\ArcToolbox\scripts\test_weave.py", line 341, in ?
main()
File "C:\Documents and Settings\Michael\Application Data\ESRI\ArcToolbox\scripts\test_weave.py", line 224, in main
weave.inline('printf("%d\n",a);',['a'], verbose=2, type_converters=converters.blitz) #, compiler = 'msvc', verbpse=2, type_converters=converters.blitz, auto_downcast=0) #'msvc' or 'gcc' or 'mingw32'
File "C:\Python24\Lib\site-packages\scipy\weave\inline_tools.py", line 338, in inline
auto_downcast = auto_downcast,
File "C:\Python24\Lib\site-packages\scipy\weave\inline_tools.py", line 447, in compile_function
verbose=verbose, **kw)
File "C:\Python24\Lib\site-packages\scipy\weave\ext_tools.py", line 365, in compile
verbose = verbose, **kw)
File "C:\Python24\Lib\site-packages\scipy\weave\build_tools.py", line 269, in build_extension
setup(name = module_name, ext_modules = [ext],verbose=verb)
File "C:\Python24\Lib\site-packages\numpy\distutils\core.py", line 176, in setup
return old_setup(**new_attr)
File "C:\Python24\Lib\distutils\core.py", line 149, in setup
dist.run_commands()
File "C:\Python24\Lib\distutils\dist.py", line 946, in run_commands
self.run_command(cmd)
File "C:\Python24\Lib\distutils\dist.py", line 966, in run_command
cmd_obj.run()
File "C:\Python24\Lib\site-packages\numpy\distutils\command\build_ext.py", line 217, in run
self.build_extensions()
File "C:\Python24\Lib\distutils\command\build_ext.py", line 405, in build_extensions
self.build_extension(ext)
File "C:\Python24\Lib\site-packages\numpy\distutils\command\build_ext.py", line 320, in build_extension
extra_postargs=extra_args,
File "C:\Python24\Lib\site-packages\numpy\distutils\ccompiler.py", line 117, in CCompiler_compile
self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
File "C:\Python24\Lib\distutils\cygwinccompiler.py", line 149, in _compile
self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
File "C:\Python24\Lib\site-packages\numpy\distutils\ccompiler.py", line 34, in CCompiler_spawn
s,o = exec_command(cmd)
File "C:\Python24\lib\site-packages\numpy\distutils\exec_command.py", line 246, in exec_command
exec_command_dir = exec_dir,
File "C:\Python24\lib\site-packages\numpy\distutils\exec_command.py", line 346, in _exec_command_python
status = int(f.read())
ValueError: invalid literal for int():
Error using sdk 2003 toolkit:
Code used for weave inline:
Please not that when I try any of these variations, I get the same error but I am trying to provide as much information as possible.
Example one
a = 1
weave.inline('printf("%d\n",a);',['a'], verbose=2,type_converters=converters.blitz)
For additional examples see attachment.
Error in Numpy:
Make the following changes to:
C:\Python24\Lib\site-packages\numpy\distutils\exec_command.py in order to get weave to work.
The text was updated successfully, but these errors were encountered: