Python scipy.weave not working anymore - python

I wrote a script a few months ago using python. In this script I use weave. This script used to work, but I retried running my program today after a few month and it doesn't work anymore. I get this error:
USAGE: facedetect.py [--cascade <cascade_fn>] [--nested-cascade <cascade_fn>] [<video_source>]
Found executable C:\strawberry\c\bin\g++.exe
c:/strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/4.6.3/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\python2.7\libs/libpython27.a when searching for -lpython27
c:/strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/4.6.3/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\python2.7\libs/python27.lib when searching for -lpython27
c:/strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/4.6.3/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\python2.7\libs\libpython27.a when searching for -lpython27
c:/strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/4.6.3/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\python2.7\libs/libpython27.a when searching for -lpython27
c:/strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/4.6.3/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\python2.7\libs/python27.lib when searching for -lpython27
c:/strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/4.6.3/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\python2.7\libs\python27.lib when searching for -lpython27
c:/strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/4.6.3/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lpython27
collect2: ld returned 1 exit status
Traceback (most recent call last):
File "C:\Users\Olivier.Janssens\Documents\onlinelearning\onlinelearning\facedetect.py", line 87, in <module>
processFrame(roi,gabor)
File "C:\Users\Olivier.Janssens\Documents\onlinelearning\onlinelearning\facedetect.py", line 51, in processFrame
im = Image.fromarray(gabor.rlbp_fast_blitz(superimposed[(i*stepHeight):((i+1)*stepHeight),(j*stepWidth):((j+1)*stepWidth)]))
File "C:\Users\Olivier.Janssens\Documents\onlinelearning\onlinelearning\gaborModule.py", line 80, in rlbp_fast_blitz
weave.blitz(expr, arg_dict, check_size=0)
File "C:\python2.7\lib\site-packages\scipy\weave\blitz_tools.py", line 62, in blitz
**kw)
File "C:\python2.7\lib\site-packages\scipy\weave\inline_tools.py", line 482, in compile_function
verbose=verbose, **kw)
File "C:\python2.7\lib\site-packages\scipy\weave\ext_tools.py", line 367, in compile
verbose = verbose, **kw)
File "C:\python2.7\lib\site-packages\scipy\weave\build_tools.py", line 272, in build_extension
setup(name = module_name, ext_modules = [ext],verbose=verb)
File "C:\python2.7\lib\site-packages\numpy\distutils\core.py", line 186, in setup
return old_setup(**new_attr)
File "C:\python2.7\lib\distutils\core.py", line 169, in setup
raise SystemExit, "error: " + str(msg)
distutils.errors.CompileError: error: Command "g++ -shared c:\users\olivie~1.jan\appdata\local\temp\Olivier.Janssens\python27_intermediate\compiler_5b1f9617507e215394a4b4c2536b23c6\Release\users\olivie~1.jan\appdata\local\temp\olivier.janssens\python27_compiled\sc_24e057e16c3730b6904be220694a322419.o c:\users\olivie~1.jan\appdata\local\temp\Olivier.Janssens\python27_intermediate\compiler_5b1f9617507e215394a4b4c2536b23c6\Release\python2.7\lib\site-packages\scipy\weave\scxx\weave_imp.o -LC:\python2.7\libs -LC:\python2.7\PCbuild -lpython27 -lmsvcr90 -o c:\users\olivie~1.jan\appdata\local\temp\Olivier.Janssens\python27_compiled\sc_24e057e16c3730b6904be220694a322419.pyd" failed with exit status 1
The error states: cannot find -lpython27
this is how the folder looks like (which the program is using)
Some extra information: I have a 64 bit pc, running windows 7, python is 32 bit.
Recently my Path variable was cleared, though I've added the python path to it, maybe I need to add something here too ?

It is finding python27.lib (in the python folder) but is skipping it as incompatible most likely as it was built with Visual C++ and you are using gcc - You probably had a gcc build of python on your path - if so you need to add it back or set the linker path to include . i.e. the current directory.

Related

Installing PyAudio on windows: ModuleNotFoundError: No module named 'pyaudio'

I am using bash terminal in vscode. When I try to run my code:
#!/usr/bin/env python3
from pyaudio import speech_recognition as sr
r = sr.Recognizer()
mic = sr.Microphone()
with mic as source:
audio = r.listen(source)
as seen in https://realpython.com/python-speech-recognition/#working-with-microphones I get this error:
python3 live_audio.py
Traceback (most recent call last):
File "live_audio.py", line 3, in <module>
from pyaudio import speech_recognition as sr
ModuleNotFoundError: No module named 'pyaudio'
I have pyaudio installed on my machine as in the cmd when I run "pip3 install pyaudio" it says:
Requirement already satisfied: pyaudio in c:\users\user1\appdata\local\programs\python\python39-32\lib\site-packages (0.2.11)"
However in the bash terminal when I run "pip3 install pyaudio" I get this error message:
pip3 install pyaudio
Defaulting to user installation because normal site-packages is not writeable
Collecting pyaudio
Using cached PyAudio-0.2.12.tar.gz (42 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: pyaudio
Building wheel for pyaudio (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for pyaudio (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [16 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-cpython-38
copying src/pyaudio.py -> build/lib.linux-x86_64-cpython-38
running build_ext
building '_portaudio' extension
creating build/temp.linux-x86_64-cpython-38
creating build/temp.linux-x86_64-cpython-38/src
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv
-O2 -fPIC -I/usr/local/include -I/usr/include -I/usr/include/python3.8 -c src/_portaudiomodule.c -o build/temp.linux-x86_64-cpython-38/src/_portaudiomodule.o
src/_portaudiomodule.c:31:10: fatal error: portaudio.h: No such file or directory
31 | #include "portaudio.h"
| ^~~~~~~~~~~~~
compilation terminated.
error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for pyaudio
Failed to build pyaudio
ERROR: Could not build wheels for pyaudio, which is required to install pyproject.toml-based projects
--- Logging error ---
Traceback (most recent call last):
File "/home/user1/.local/lib/python3.8/site-packages/pip/_internal/utils/logging.py", line 177, in emit
self.console.print(renderable, overflow="ignore", crop=False, style=style)
File "/home/user1/.local/lib/python3.8/site-packages/pip/_vendor/rich/console.py", line 1673, in print
extend(render(renderable, render_options))
File "/home/user1/.local/lib/python3.8/site-packages/pip/_vendor/rich/console.py", line 1305, in render
for render_output in iter_render:
File "/home/user1/.local/lib/python3.8/site-packages/pip/_internal/utils/logging.py", line 134, in __rich_console__
for line in lines:
File "/home/user1/.local/lib/python3.8/site-packages/pip/_vendor/rich/segment.py", line 249, in split_lines
for segment in segments:
File "/home/user1/.local/lib/python3.8/site-packages/pip/_vendor/rich/console.py", line 1283, in render
renderable = rich_cast(renderable)
File "/home/user1/.local/lib/python3.8/site-packages/pip/_vendor/rich/protocol.py", line 36, in rich_cast
renderable = cast_method()
File "/home/user1/.local/lib/python3.8/site-packages/pip/_internal/self_outdated_check.py", line 130, in __rich__
pip_cmd = get_best_invocation_for_this_pip()
File "/home/user1/.local/lib/python3.8/site-packages/pip/_internal/utils/entrypoints.py", line 58, in get_best_invocation_for_this_pip
if found_executable and os.path.samefile(
File "/usr/lib/python3.8/genericpath.py", line 101, in samefile
s2 = os.stat(f2)
FileNotFoundError: [Errno 2] No such file or directory: '/usr/bin/pip'
Call stack:
File "/home/user1/.local/bin/pip3", line 8, in <module>
sys.exit(main())
File "/home/user1/.local/lib/python3.8/site-packages/pip/_internal/cli/main.py", l.py", line 70, in main
return command.main(cmd_args)
File "/home/user1/.local/lib/python3.8/site-packages/pip/_internal/cli/base_comman_command.py", line 101, in main
return self._main(args)
File "/home/user1/.local/lib/python3.8/site-packages/pip/_internal/cli/base_comman_command.py", line 223, in _main
self.handle_pip_version_check(options)
File "/home/user1/.local/lib/python3.8/site-packages/pip/_internal/cli/req_commandcommand.py", line 190, in handle_pip_version_check
pip_self_version_check(session, options)
File "/home/user1/.local/lib/python3.8/site-packages/pip/_internal/self_outdated_cdated_check.py", line 236, in pip_self_version_check
logger.warning("[present-rich] %s", upgrade_prompt)
File "/usr/lib/python3.8/logging/__init__.py", line 1446, in warning
self._log(WARNING, msg, args, **kwargs)
File "/usr/lib/python3.8/logging/__init__.py", line 1577, in _log
self.handle(record)
File "/usr/lib/python3.8/logging/__init__.py", line 1587, in handle
self.callHandlers(record)
File "/usr/lib/python3.8/logging/__init__.py", line 1649, in callHandlers
hdlr.handle(record)
File "/usr/lib/python3.8/logging/__init__.py", line 950, in handle
self.emit(record)
File "/home/user1/.local/lib/python3.8/site-packages/pip/_internal/utils/logging.pgging.py", line 179, in emit
self.handleError(record)
Message: '[present-rich] %s'
Arguments: (UpgradePrompt(old='22.2.2', new='22.3'),)
I have also installed the .whl for my machine using "pip3 install PyAudio-0.2.11-cp38-cp38-win_amd64.whl" but I get this error (in bash terminal):
Defaulting to user installation because normal site-packages is not writeable
ERROR: PyAudio-0.2.11-cp38-cp38-win_amd64.whl is not a supported wheel on this
platform.
Does anyone have any idea what I'm doing wrong?
Thank you

Can't Compile Cython on Windows with MingW

On Windows 10 Build 14393 with Python 3.7.0, Cython 0.29.6 and MinGW32 located at C:\MinGW with the path C:\MinGW\bin on the system PATH environment variable, I am unable to get Cython code to compile using MingW. When I attempt to, I receive the following:
running build_ext
building 'abc_image_stats' extension
error: Unable to find vcvarsall.bat
c:\program files\python\python37\lib\site-packages\Cython\Compiler\Main.py:367: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: C:\Users\abc\Downloads\python\abc_image_stats\abc_image_stats.pyx
tree = Parsing.p_module(s, pxd, full_module_name)
I have tried various fixes, such as those mentioned here, to no avail. After making the config file as instructed in that solution, (but before changing cgwinccompiler.py), I attempted to compile again but then received this error:
running build_ext
Traceback (most recent call last):
File "setup.py", line 7, in <module>
include_dirs=[numpy.get_include()] # https://stackoverflow.com/a/14657667
File "C:\Program Files\Python\Python37\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\Program Files\Python\Python37\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "C:\Program Files\Python\Python37\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Program Files\Python\Python37\lib\distutils\command\build_ext.py", line 308, in run
force=self.force)
File "C:\Program Files\Python\Python37\lib\distutils\ccompiler.py", line 1031, in new_compiler
return klass(None, dry_run, force)
File "C:\Program Files\Python\Python37\lib\distutils\cygwinccompiler.py", line 282, in __init__
CygwinCCompiler.__init__ (self, verbose, dry_run, force)
File "C:\Program Files\Python\Python37\lib\distutils\cygwinccompiler.py", line 157, in __init__
self.dll_libraries = get_msvcr()
File "C:\Program Files\Python\Python37\lib\distutils\cygwinccompiler.py", line 86, in get_msvcr
raise ValueError("Unknown MS Compiler version %s " % msc_ver)
ValueError: Unknown MS Compiler version 1914
c:\program files\python\python37\lib\site-packages\Cython\Compiler\Main.py:367: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: C:\Users\abc\Downloads\python\abc_image_stats\abc_image_stats.pyx
tree = Parsing.p_module(s, pxd, full_module_name)
So then I did the last two steps; I added
elif msc_ver == '1914':
# Visual Studio 2015 / Visual C 14.0
# "msvcr140.dll no longer exists" http://blogs.msdn.com/b/vcblog/archive/2014/06/03/visual-studio-14-ctp.aspx
return ['vcruntime140']
to the cygwinccompiler.py file and copied vcruntime140.dll to the C:\Program Files\Python\Python37\libs folder, but then I receive this error upon attempting to compile:
running build_ext
building 'abc_image_stats' extension
C:\MinGW\bin\gcc.exe -mdll -O -Wall "-IC:\Program Files\Python\Python37\lib\site-packages\numpy\core\include" "-IC:\Program Files\Python\Python37\include" "-IC:\Program Files\Python\Python37\include" -c abc_image_stats.c -o build\temp.win-amd64-3.7\Release\abc_image_stats.o
In file included from C:\Program Files\Python\Python37\include/Python.h:68:0,
from abc_image_stats.c:4:
C:\Program Files\Python\Python37\include/pytime.h:123:59: warning: 'struct timeval' declared inside parameter list will not be visible outside of this definition or declaration
PyAPI_FUNC(int) _PyTime_FromTimeval(_PyTime_t *tp, struct timeval *tv);
^~~~~~~
C:\Program Files\Python\Python37\include/pytime.h:130:12: warning: 'struct timeval' declared inside parameter list will not be visible outside of this definition or declaration
struct timeval *tv,
^~~~~~~
C:\Program Files\Python\Python37\include/pytime.h:135:12: warning: 'struct timeval' declared inside parameter list will not be visible outside of this definition or declaration
struct timeval *tv,
^~~~~~~
writing build\temp.win-amd64-3.7\Release\abc_image_stats.cp37-win_amd64.def
C:\MinGW\bin\gcc.exe -shared -s build\temp.win-amd64-3.7\Release\abc_image_stats.o build\temp.win-amd64-3.7\Release\abc_image_stats.cp37-win_amd64.def "-LC:\Program Files\Python\Python37\libs" "-LC:\Program Files\Python\Python37\PCbuild\amd64" -lpython37 -lvcruntime140 -o C:\Users\abc\Downloads\python\abc_image_stats\abc_image_stats.cp37-win_amd64.pyd
C:\Program Files\Python\Python37\libs/libpython37.a: error adding symbols: File format not recognized
collect2.exe: error: ld returned 1 exit status
error: command 'C:\\MinGW\\bin\\gcc.exe' failed with exit status 1
c:\program files\python\python37\lib\site-packages\Cython\Compiler\Main.py:367: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: C:\Users\abc\Downloads\python\abc_image_stats\abc_image_stats.pyx
tree = Parsing.p_module(s, pxd, full_module_name)
To be clear, my setup.py file looks like this:
from distutils.core import setup
from Cython.Build import cythonize
import numpy
setup(
ext_modules = cythonize("abc_image_stats.pyx"),
include_dirs=[numpy.get_include()] # https://stackoverflow.com/a/14657667
)
and I am attempting to compile using python setup.py build_ext --inplace via the command line.
All I want to do is compile the Cython code on a Windows 10 machine using MingW. I've tried everything I can think of and don't know what's wrong. Any ideas on how to solve this?
try to change
elif msc_ver == '1914':
return ['vcruntime140']
to return ['msvcr100']
this worked for me, don't really know why though

Compiling with FFMPEG using g++

Im trying to compile a github code that requires opencv and FFMPEG. The code is:
https://github.com/prouast/heartbeat
This is what i have
g++ -std=c++11 -LC:\Users\Anon\Desktop\ffmpeg-20171225-613f789-win32-shared\bin -LC:\Anaconda\pkgs\opencv3-3.1.0-py35_0\Library\lib -LC:\MinGW\var\lib\mingw-get\data -IC:\Anaconda\envs\mywindowscv\Library\include -lopencv_core310 -lopencv_highgui310 -lopencv_imgcodecs310 -lopencv_imgproc310 -lopencv_objdetect310 -lopencv_video310 -lopencv_videoio310 -lavcodec-58 -lavformat-58 -lavutil-56 -lswscale-5 -lmingw32-libarchive -lSDLMain -mwindows Heartbeat.cpp FFmpegDecoder.cpp FFmpegEncoder.cpp opencv.cpp RPPG.cpp Baseline.cpp -o Heartbeat
I get the following error:
In file included from Heartbeat.cpp:16:0:
FFmpegDecoder.hpp:16:36: fatal error: libavcodec/avcodec.h: No such file or directory
^
compilation terminated.
In file included from FFmpegDecoder.cpp:9:0:
FFmpegDecoder.hpp:16:36: fatal error: libavcodec/avcodec.h: No such file or directory
^
compilation terminated.
In file included from FFmpegEncoder.cpp:9:0:
FFmpegEncoder.hpp:17:32: fatal error: libavcodec/avcodec.h: No such file or directory
what to do?

Set up cassandra driver (python) in Docker

I used a docker file several months ago that (1) uses base ubuntu image, (2) installs miniconda python distribution, (3) installs some python libraries using miniconda, (4) runs following commands to set up cassandra-driver for python.
RUN pip install --upgrade pip
RUN pip install cassandra-driver
This worked perfectly six months ago. But now I'm getting this exception.
Step 13 : RUN pip install cassandra-driver
---> Running in ba9955650d7c
Collecting cassandra-driver
Downloading cassandra-driver-3.0.0.tar.gz (186kB)
Complete output from command python setup.py egg_info:
warning: no files found matching '*.pyx' under directory 'Cython/Debugger/Tests'
warning: no files found matching '*.pxd' under directory 'Cython/Debugger/Tests'
warning: no files found matching '*.h' under directory 'Cython/Debugger/Tests'
warning: no files found matching '*.pxd' under directory 'Cython/Utility'
unable to execute 'gcc': No such file or directory
Unable to find pgen, not compiling formal grammar.
Traceback (most recent call last):
File "<string>", line 20, in <module>
File "/tmp/pip-build-0XzsPv/cassandra-driver/setup.py", line 375, in <module>
run_setup(None)
File "/tmp/pip-build-0XzsPv/cassandra-driver/setup.py", line 373, in run_setup
**kw)
File "/miniconda/lib/python2.7/distutils/core.py", line 111, in setup
_setup_distribution = dist = klass(attrs)
File "/miniconda/lib/python2.7/site-packages/setuptools-19.1.1-py2.7.egg/setuptools/dist.py", line 268, in __init__
File "/miniconda/lib/python2.7/site-packages/setuptools-19.1.1-py2.7.egg/setuptools/dist.py", line 312, in fetch_build_eggs
File "/miniconda/lib/python2.7/site-packages/setuptools-19.1.1-py2.7.egg/pkg_resources/__init__.py", line 846, in resolve
File "/miniconda/lib/python2.7/site-packages/setuptools-19.1.1-py2.7.egg/pkg_resources/__init__.py", line 1091, in best_match
File "/miniconda/lib/python2.7/site-packages/setuptools-19.1.1-py2.7.egg/pkg_resources/__init__.py", line 1103, in obtain
File "/miniconda/lib/python2.7/site-packages/setuptools-19.1.1-py2.7.egg/setuptools/dist.py", line 379, in fetch_build_egg
File "/miniconda/lib/python2.7/site-packages/setuptools-19.1.1-py2.7.egg/setuptools/command/easy_install.py", line 639, in easy_install
File "/miniconda/lib/python2.7/site-packages/setuptools-19.1.1-py2.7.egg/setuptools/command/easy_install.py", line 669, in install_item
File "/miniconda/lib/python2.7/site-packages/setuptools-19.1.1-py2.7.egg/setuptools/command/easy_install.py", line 852, in install_eggs
File "/miniconda/lib/python2.7/site-packages/setuptools-19.1.1-py2.7.egg/setuptools/command/easy_install.py", line 1080, in build_and_install
File "/miniconda/lib/python2.7/site-packages/setuptools-19.1.1-py2.7.egg/setuptools/command/easy_install.py", line 1068, in run_setup
distutils.errors.DistutilsError: Setup script exited with error: command 'gcc' failed with exit status 1
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-0XzsPv/cassandra-driver
The command '/bin/sh -c pip install cassandra-driver' returned a non-zero code: 1
What might be going wrong? Is the installation package broken or I'm not doing it right?
The python cassandra-driver now uses Cython extensions by default since version 2.7.0, but there is an escape hatch for those who don't have easy access to the cython distribution or don't need it which might be a good option for you as well. The cython extensions do offer a boon to performance, but it might not be suitable for a lot of cases (especially where you are not doing high throughput).
From the install documentation:
By default, this package uses Cython to optimize core modules and build custom extensions. This is not a hard requirement, but is engaged by default to build extensions offering better performance than the pure Python implementation.
This build phase can be avoided using the build switch, or an environment variable:
python setup.py install --no-cython
-or-
pip install --install-option="--no-cython" <spec-or-path>
Alternatively, an environment variable can be used to switch this option regardless of context:
CASS_DRIVER_NO_CYTHON=1 <your script here>
In order to install cassandra-driver you need to compile some C source files however you don't have gcc inside your container:
unable to execute 'gcc': No such file or directory
Try to install gcc and python-dev packages before installing cassandra-driver:
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
python-dev \
gcc \
&& rm -rf /var/lib/apt/lists/*

Python weave compile error

I'm new to weave and I have no clue what is causing this error. The error happens on other code examples too so it's not the specific code. I'm using windows 7 and python 2.7. Thanks to anyone who can help!
>>> from scipy import weave
>>> a = 1
>>> weave.inline('printf("%d\\n",a);',['a'])
No module named msvccompiler in numpy.distutils; trying from distutils
Looking for python27.dll
Looking for python27.dll
Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
weave.inline('printf("%d\\n",a);',['a'])
File "C:\Python27\lib\scipy\weave\inline_tools.py", line 366, in inline
**kw)
File "C:\Python27\lib\scipy\weave\inline_tools.py", line 496, in compile_function
verbose=verbose, **kw)
File "C:\Python27\lib\scipy\weave\ext_tools.py", line 373, in compile
verbose=verbose, **kw)
File "C:\Python27\lib\scipy\weave\build_tools.py", line 279, in build_extension
setup(name=module_name, ext_modules=[ext],verbose=verb)
File "C:\Python27\lib\site-packages\numpy\distutils\core.py", line 169, in setup
return old_setup(**new_attr)
File "C:\Python27\lib\distutils\core.py", line 166, in setup
raise SystemExit, "error: " + str(msg)
CompileError: error: Command "g++ -m64 -g -shared c:\users\owner\appdata\local\temp\scipy-owner-tbcany\python27_intermediate\compiler_e3b0c44298fc1c149afbf4c8996fb924\Release\users\owner\appdata\local\temp\owner\python27_compiled\sc_cb1945ea063627b5855c13eafebb07042.o c:\users\owner\appdata\local\temp\scipy-owner-tbcany\python27_intermediate\compiler_e3b0c44298fc1c149afbf4c8996fb924\Release\python27\lib\scipy\weave\scxx\weave_imp.o -LC:\Python27\libs -LC:\Python27\PCbuild\amd64 -lpython27 -lmsvcr90 -o c:\users\owner\appdata\local\temp\owner\python27_compiled\sc_cb1945ea063627b5855c13eafebb07042.pyd" failed with exit status 1
weave.test() didn't find any errors but it only ran 146 tests and the documentation http://docs.scipy.org/doc/scipy/reference/tutorial/weave.html says that it should have ran 180.
>>> weave.test()
Running unit tests for scipy.weave
NumPy version 1.9.1
NumPy is installed in C:\Python27\lib\site-packages\numpy
SciPy version 0.15.1
SciPy is installed in C:\Python27\lib\scipy
Python version 2.7.8 (default, Jun 30 2014, 16:08:48) [MSC v.1500 64 bit (AMD64)]
nose version 1.3.7
..................................S.SSS....SSSSSS.................................................................................................
----------------------------------------------------------------------
Ran 146 tests in 3.439s
OK (SKIP=10)
<nose.result.TextTestResult run=146 errors=0 failures=0>
...quite some time ago I ran into issues with compiling weave code. The problem was probably caused by mixing (Visual Studio) precompiled Python with MinGW-compiled weave code.
Back then, I was using the MinGW64 compiler (MinGW32 worked as well) and developed a three step workaround.
1) In the <pythondir>\libs directory, delete the MSVCR runtime library file, it should be named something like libmsvcr100.a or libmsvcr100d.a (or with 90 or any other version number in it). Along with it delete any file in the folder that has the same creation date (first attempt of using weave).
2) in the (probably not yet created) file <pythondir>\Lib\distutils\distutils.cfg and also <pythondir>\Lib\site-packages\numpy\distutils\distutils.cfg I included the compiler definition
[build]
compiler = mingw32
Maybe you'd need to adjust that to your type of compiler.
3) In <pythondir>\Lib\site-packages\numpy\distutils\mingw32ccompiler.py there comes the real "hack" at around line #329:
in the function implementation of build_msvcr_libaray(debug=False) just hardcode return False as the first line of code.
Now retry your weave code...

Categories