I am trying to compile some inline c++ code inside python using weave. I always get a similar problem where the compiled file cannot be found (See below output). I am not sure if the problem is with the compiler or something else. I am a new user of scipy and a novice with python so I would appreciate any direction someone can give me because I have not been able to figure out a work around.
Thank you,
Michael
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
I have the following related applications installed:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Python:
2.4.1 (I am using an older version because this is what ESRI GIS application
supports)
Scipy:
scipy-0.6.0.win32-py2.4.exe
MinGW:
MinGW-5.1.3.exe
OS:
Windows XP SP2
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
When I test the installation of Weave I get the following output:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>>> weave.test()
Found 1 tests for scipy.weave.ast_tools
Found 2 tests for scipy.weave.blitz_tools
Found 9 tests for scipy.weave.build_tools
Found 0 tests for scipy.weave.c_spec
Found 26 tests for scipy.weave.catalog
building extensions here: c:\docume~1\michael\locals~1\temp\Michael\python24_compiled\m3
Found 1 tests for scipy.weave.ext_tools
Found 0 tests for scipy.weave.inline_tools
Found 74 tests for scipy.weave.size_check
Found 16 tests for scipy.weave.slice_handler
Found 3 tests for
scipy.weave.standard_array_spec
Found 0 tests for __main__
...warning: specified build_dir '_bad_path_' does not exist or is not writable. Trying default locations
.....warning: specified build_dir '_bad_path_' does not exist or is not writable. Trying default locations
............................removing 'c:\docume~1\michael\locals~1\temp\tmpdqudhmcat_test' (and everything under it)
error removing c:\docume~1\michael\locals~1\temp\tmpdqudhmcat_test: c:\docume~1\michael\locals~1\temp\tmpdqudhmcat_test\win3224compiled_catalog: Permission denied
error removing c:\docume~1\michael\locals~1\temp\tmpdqudhmcat_test: c:\docume~1\michael\locals~1\temp\tmpdqudhmcat_test: Directory not empty
.removing 'c:\docume~1\michael\locals~1\temp\tmpw144aycat_test' (and everything under
it)
...............................................................................................
----------------------------------------------------------------------
Ran 132 tests in 2.625s
OK
<unittest.TextTestRunner object at 0x020D6F70>
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
When I try to test the following script or any other script I get the following message:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
def prod(m, v):
#C++ version
nrows, ncolumns = m.shape
res = numpy.zeros((nrows, ncolumns), float)
code = r"""
for (int i=0; i<nrows; i++)
{
for (int j=0; j<ncolumns; j++)
{
res(i) += m(i,j)*v(j);
}
}
"""
#err = weave.inline(code,['nrows', 'ncolumns', 'res', 'm', 'v'], type_converters=converters.blitz, compiler='mingw32', verbose=2)
err = weave.inline(code,['nrows', 'ncolumns', 'res', 'm', 'v'], verbose=2)
<weave: compiling>
running build_ext
running build_src
building extension "sc_045cfaf40ef1a0738b1066aaa886a55d7" sources
customize Mingw32CCompiler
customize Mingw32CCompiler using build_ext
customize Mingw32CCompiler
customize Mingw32CCompiler using build_ext
building 'sc_045cfaf40ef1a0738b1066aaa886a55d7' 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:\docume~1\michael\locals~1\temp\Michael\python24_compiled\sc_045cfaf40ef1a0738b1066aaa886a55d7.cpp -o c:\docume~1\michael\locals~1\temp\Michael\python24_intermediate\compiler_c8350d870e6c54e8f29dd7094c2bfb45\Release\docume~1\michael\locals~1\temp\michael\python24_compiled\sc_045cfaf40ef1a0738b1066aaa886a55d7.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 179, in ?
main()
File "C:\Documents and Settings\Michael\Application Data\ESRI\ArcToolbox\scripts\test_weave.py", line 170, in main
prod(m, v)
File "C:\Documents and Settings\Michael\Application Data\ESRI\ArcToolbox\scripts\test_weave.py", line 44, in prod
err = weave.inline(code,['nrows', 'ncolumns', 'res', 'm', 'v'], verbose=2)
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 173, in setup
return old_setup(**new_attr)
File "C:\Python24\lib\distutils\core.py", line 159, in setup
raise SystemExit, error
CompileError: error: c:\docume~1\michael\locals~1\temp\tmp2dwbkp: No such file or directory