Compiling with FFMPEG using g++ - python

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?

Related

Is bluepy live?

I tried to install bluepy under Python 3.9 on my Mac. The install failed with a very long error message suggesting that some include files could not be found. The project has quite a few open issues; does anybody know if it is alive?
The gory details:
% pip3 install bluepy
Collecting bluepy
Using cached bluepy-1.3.0.tar.gz (217 kB)
Preparing metadata (setup.py) ... done
Building wheels for collected packages: bluepy
Building wheel for bluepy (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [13 lines of output]
/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/setuptools/dist.py:697: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead
warnings.warn(
running bdist_wheel
running build
running build_py
Working dir is /private/var/folders/zx/bbkpbk9x48v95vgbwdd7qp_r0000gr/T/pip-install-y241v84d/bluepy_6884a18d66a84c7fbf520b43aaa87575
execute make -C ./bluepy clean
execute make -C bluepy -j1
Failed to compile bluepy-helper. Exiting install.
Command was 'make -C bluepy -j1' in /private/var/folders/zx/bbkpbk9x48v95vgbwdd7qp_r0000gr/T/pip-install-y241v84d/bluepy_6884a18d66a84c7fbf520b43aaa87575
Return code was 2
Output was:
b"tar xzf bluez-src.tgz\ntouch ./bluez-5.47/lib/bluetooth.c ./bluez-5.47/lib/hci.c ./bluez-5.47/lib/sdp.c ./bluez-5.47/lib/uuid.c ./bluez-5.47/attrib/att.c ./bluez-5.47/attrib/gatt.c ./bluez-5.47/attrib/gattrib.c ./bluez-5.47/attrib/utils.c ./bluez-5.47/btio/btio.c ./bluez-5.47/src/log.c ./bluez-5.47/src/shared/mgmt.c ./bluez-5.47/src/shared/crypto.c ./bluez-5.47/src/shared/att.c ./bluez-5.47/src/shared/queue.c ./bluez-5.47/src/shared/util.c ./bluez-5.47/src/shared/io-glib.c ./bluez-5.47/src/shared/timeout-glib.c\ncc -L. -g -Wall -Os -DHAVE_CONFIG_H -I./bluez-5.47/attrib -I./bluez-5.47 -I./bluez-5.47/lib -I./bluez-5.47/src -I./bluez-5.47/gdbus -I./bluez-5.47/btio -I./bluez-5.47/sys -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include -o bluepy-helper bluepy-helper.c ./bluez-5.47/lib/bluetooth.c ./bluez-5.47/lib/hci.c ./bluez-5.47/lib/sdp.c ./bluez-5.47/lib/uuid.c ./bluez-5.47/attrib/att.c ./bluez-5.47/attrib/gatt.c ./bluez-5.47/attrib/gattrib.c ./bluez-5.47/attrib/utils.c ./bluez-5.47/btio/btio.c ./bluez-5.47/src/log.c ./bluez-5.47/src/shared/mgmt.c ./bluez-5.47/src/shared/crypto.c ./bluez-5.47/src/shared/att.c ./bluez-5.47/src/shared/queue.c ./bluez-5.47/src/shared/util.c ./bluez-5.47/src/shared/io-glib.c ./bluez-5.47/src/shared/timeout-glib.c -L/opt/local/lib -lglib-2.0 -lintl\nIn file included from bluepy-helper.c:36:\n./bluez-5.47/lib/bluetooth.h:36:10: fatal error: 'endian.h' file not found\n#include <endian.h>\n
^~~~~~~~~~\n1 error generated.\nIn file included from ./bluez-5.47/lib/bluetooth.c:38:\n./bluez-5.47/lib/bluetooth.h:36:10:
fatal error: 'endian.h' file not found\n#include <endian.h>\n
^~~~~~~~~~\n1 error generated.\nIn file included from
./bluez-5.47/lib/hci.c:44:\n./bluez-5.47/lib/bluetooth.h:36:10: fatal
error: 'endian.h' file not found\n#include <endian.h>\n
^~~~~~~~~~\n1 error generated.\nIn file included from
./bluez-5.47/lib/sdp.c:45:\n./bluez-5.47/lib/bluetooth.h:36:10: fatal
error: 'endian.h' file not found\n#include <endian.h>\n
^~~~~~~~~~\n1 error generated.\nIn file included from
./bluez-5.47/lib/uuid.c:33:\n./bluez-5.47/lib/bluetooth.h:36:10: fatal
error: 'endian.h' file not found\n#include <endian.h>\n
^~~~~~~~~~\n1 error generated.\nIn file included from
./bluez-5.47/attrib/att.c:35:\n./bluez-5.47/lib/bluetooth.h:36:10:
fatal error: 'endian.h' file not found\n#include <endian.h>\n
^~~~~~~~~~\n1 error generated.\nIn file included from
./bluez-5.47/attrib/gatt.c:34:\nIn file included from
./bluez-5.47/lib/sdp.h:35:\n./bluez-5.47/sys/bluetooth/bluetooth.h:36:10:
fatal error: 'endian.h' file not found\n#include <endian.h>\n
^~~~~~~~~~\n1 error generated.\nIn file included from
./bluez-5.47/attrib/gattrib.c:36:\n./bluez-5.47/lib/bluetooth.h:36:10:
fatal error: 'endian.h' file not found\n#include <endian.h>\n
^~~~~~~~~~\n1 error generated.\nIn file included from
./bluez-5.47/attrib/utils.c:32:\n./bluez-5.47/lib/bluetooth.h:36:10:
fatal error: 'endian.h' file not found\n#include <endian.h>\n
^~~~~~~~~~\n1 error generated.\nIn file included from
./bluez-5.47/btio/btio.c:39:\n./bluez-5.47/lib/bluetooth.h:36:10:
fatal error: 'endian.h' file not found\n#include <endian.h>\n
^~~~~~~~~~\n1 error generated.\nIn file included from
./bluez-5.47/src/log.c:40:\n./bluez-5.47/lib/bluetooth.h:36:10: fatal
error: 'endian.h' file not found\n#include <endian.h>\n
^~~~~~~~~~\n1 error generated.\nIn file included from
./bluez-5.47/src/shared/mgmt.c:33:\n./bluez-5.47/lib/bluetooth.h:36:10:
fatal error: 'endian.h' file not found\n#include <endian.h>\n
^~~~~~~~~~\n1 error generated.\nIn file included from
./bluez-5.47/src/shared/crypto.c:33:\n./bluez-5.47/src/shared/util.h:27:10:
fatal error: 'byteswap.h' file not found\n#include <byteswap.h>\n
^~~~~~~~~~~~\n1 error generated.\nIn file included from
./bluez-5.47/src/shared/att.c:34:\n./bluez-5.47/src/shared/util.h:27:10:
fatal error: 'byteswap.h' file not found\n#include <byteswap.h>\n
^~~~~~~~~~~~\n1 error generated.\nIn file included from
./bluez-5.47/src/shared/queue.c:28:\n./bluez-5.47/src/shared/util.h:27:10:
fatal error: 'byteswap.h' file not found\n#include <byteswap.h>\n
^~~~~~~~~~~~\n1 error generated.\nIn file included from
./bluez-5.47/src/shared/util.c:38:\n./bluez-5.47/src/shared/util.h:27:10:
fatal error: 'byteswap.h' file not found\n#include <byteswap.h>\n
^~~~~~~~~~~~\n1 error generated.\nmake: *** [bluepy-helper] Error 1\n"
[end of output]

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

PyInstaller compiled app failing to launch (FileNotFoundError)

I'm trying to convert my main.py script to an executable on Mac using pyinstaller and I'm having difficulties doing so.
pyinstaller --onefile main.py seems to go through without a hitch, but when I try to launch the resulting executable, I get the following message:
Traceback (most recent call last):
File "/Users/waterfalls/PycharmProjects/newnew/dist/main.app/Contents/Resources/__boot__.py", line 148, in <module>
_run()
File "/Users/waterfalls/PycharmProjects/newnew/dist/main.app/Contents/Resources/__boot__.py", line 82, in _run
exec(compile(source, path, 'exec'), globals(), globals())
File "/Users/waterfalls/PycharmProjects/newnew/dist/main.app/Contents/Resources/main.py", line 6, in <module>
import cairosvg.svg
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
File "cairosvg/__init__.pyc", line 37, in <module>
FileNotFoundError: [Errno 2] No such file or directory: '/Users/waterfalls/PycharmProjects/newnew/dist/main.app/Contents/MacOS/VERSION'
2018-10-14 03:25:55.473 main[23382:4662269] main Error
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.
[Process completed]
The VERSION file it is flagging really isn't there. I am unsure how to make it be there
Building the program with pyinstaller --windowed main.py yeilds a lot of failed to copy flag warnings:
15490 WARNING: failed to copy flags of /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts/encoding/ascii.enc
15513 WARNING: failed to copy flags of /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts/encoding/macTurkish.enc
15517 WARNING: failed to copy flags of /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts/tm.tcl
15520 WARNING: failed to copy flags of /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts/encoding/cp874.enc
15525 WARNING: failed to copy flags of /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts/msgs/en_nz.msg
15528 WARNING: failed to copy flags of /System/Library/Frameworks/Tk.framework/Versions/8.5/Resources/Scripts/pkgIndex.tcl
15531 WARNING: failed to copy flags of /System/Library/Frameworks/Tk.framework/Versions/8.5/Resources/Scripts/comdlg.tcl
15534 WARNING: failed to copy flags of /System/Library/Frameworks/Tk.framework/Versions/8.5/Resources/Scripts/msgs/sv.msg
15538 WARNING: failed to copy flags of /System/Library/Frameworks/Tk.framework/Versions/8.5/Resources/Scripts/choosedir.tcl
15540 WARNING: failed to copy flags of /System/Library/Frameworks/Tk.framework/Versions/8.5/Resources/Scripts/msgs/es.msg
15542 WARNING: failed to copy flags of /System/Library/Frameworks/Tk.framework/Versions/8.5/Resources/Scripts/msgs/cs.msg
15544 WARNING: failed to copy flags of /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts/msgs/de_at.msg
15546 WARNING: failed to copy flags of /System/Library/Frameworks/Tk.framework/Versions/8.5/Resources/Scripts/ttk/cursors.tcl
15549 WARNING: failed to copy flags of /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts/init.tcl
15550 WARNING: failed to copy flags of /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts/msgs/ro.msg
15553 WARNING: failed to copy flags of /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts/encoding/gb2312.enc
15555 WARNING: failed to copy flags of /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts/msgs/zh_cn.msg
15557 WARNING: failed to copy flags of /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts/encoding/shiftjis.enc
15560 WARNING: failed to copy flags of /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts/encoding/cp850.enc
15562 WARNING: failed to copy flags of /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts/encoding/iso8859-1.enc
15563 WARNING: failed to copy flags of /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts/msgs/bn.msg
15565 WARNING: failed to copy flags of /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts/msgs/sh.msg
15567 WARNING: failed to copy flags of /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts/msgs/ms_my.msg
15569 WARNING: failed to copy flags of /System/Library/Frameworks/Tk.framework/Versions/8.5/Resources/Scripts/tk.tcl
15572 WARNING: failed to copy flags of /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts/msgs/pt.msg
15575 WARNING: failed to copy flags of /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts/http1.0/http.tcl
15576 WARNING: failed to copy flags of /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts/msgs/en_gb.msg
15577 WARNING: failed to copy flags of /System/Library/Frameworks/Tk.framework/Versions/8.5/Resources/Scripts/ttk/menubutton.tcl
15580 WARNING: failed to copy flags of /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts/msgs/gv_gb.msg
15582 WARNING: failed to copy flags of /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts/msgs/es_py.msg
15583 WARNING: failed to copy flags of /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts/tclDTrace.d
15584 WARNING: failed to copy flags of /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts/msgs/nb.msg
15586 WARNING: failed to copy flags of /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts/msgs/es_uy.msg
15587 WARNING: failed to copy flags of /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts/msgs/nn.msg
15591 WARNING: failed to copy flags of /System/Library/Frameworks/Tk.framework/Versions/8.5/Resources/Scripts/msgs/da.msg
15592 WARNING: failed to copy flags of /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts/msgs/eu.msg
15594 WARNING: failed to copy flags of /System/Library/Frameworks/Tk.framework/Versions/8.5/Resources/Scripts/ttk/progress.tcl
15600 WARNING: failed to copy flags of /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts/encoding/koi8-r.enc
15601 WARNING: failed to copy flags of /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts/msgs/fa.msg
15602 WARNING: failed to copy flags of /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts/msgs/es_pe.msg
15603 WARNING: failed to copy flags of /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts/encoding/macRomania.enc
15604 WARNING: failed to copy flags of /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts/msgs/te.msg
15606 WARNING: failed to copy flags of /System/Library/Frameworks/Tk.framework/Versions/8.5/Resources/Scripts/ttk/defaults.tcl
15608 WARNING: failed to copy flags of /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts/msgs/es_ve.msg
15609 WARNING: failed to copy flags of /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts/msgs/es_pr.msg
15611 WARNING: failed to copy flags of /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts/msgs/id.msg
15614 WARNING: failed to copy flags of /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts/clock.tcl
15617 WARNING: failed to copy flags of /System/Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts/encoding/gb2312-raw.enc
etc
cairosvg --version gets me 2.2.1
python3 --version is 3.7.0
pyinstaller --version is 3.5.dev0+0b6f1ec6f (tried to fix this issue by updating to a devbuild)
Has anyone else experienced this? What can I do to compile a working executable?
EDIT #1:
Okay, so the problem definitely lies somewhere within the cairosvg and pyinstaller, since as soon as I comment out the parts using that library, the app successfully launches and works. I suspect PyInstaller is not copying the files required for the bundle to work from cairo since they are not of the right format.

numpy build with mingw fails on Window with AttributeError: Mingw32CCompiler instance has no attribute 'compile_options', How to resolve this?

I've downloaded the numpy source from git-hub, I also have mingw installed and all the paths set on Windows, I can compile C files with mingw just fine so this is also working.
I'm following instructions on scipy website, with python.exe setup.py config --compiler=mingw32 build --compiler=mingw32 bdist_wininst It compiles for a while and then suddenly stops with this-
gcc -O2 -Wall -Wstrict-prototypes -DNPY_MINGW_USE_CUSTOM_MSVCR -D__MSVCRT_VERSION__=0x0900 -Inumpy\core\src\private -Inu
mpy\core\src -Inumpy\core -Inumpy\core\src\npymath -Inumpy\core\src\multiarray -Inumpy\core\src\umath -Inumpy\core\src\npysort -IC:\python27\include -IC:\python27\PC -c _configtest.c -o _configtest.o
_configtest.c: In function 'main':
_configtest.c:7:12: error: 'Py_UNICODE_WIDE' undeclared (first use in this function)
(void) Py_UNICODE_WIDE;
^~~~~~~~~~~~~~~
_configtest.c:7:12: note: each undeclared identifier is reported only once for each function it appears in failure.
removing: _configtest.c _configtest.o
.
.
.
.
File "D:\pylibs\numpy-master\numpy\distutils\command\build_src.py", line 386, in generate_sources
source = func(extension, build_dir)
File "numpy\core\setup.py", line 443, in generate_config_h
rep = check_long_double_representation(config_cmd)
File "numpy\core\setup_common.py", line 194, in check_long_double_representation
cmd.compiler.compile_options.remove("/GL")
AttributeError: Mingw32CCompiler instance has no attribute 'compile_options'
How to resolve this please?
In your distribution, add the following code at line 194 of file numpy\core\setup_common.py and rebuild. It should allow you to build.
except AttributeError:
pass

Python scipy.weave not working anymore

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.

Categories