Open mrgloom opened 8 years ago
Does the version from pip (Python 2.7 64-bit) match your system architecture? Could you try installing from source? I can't understand that error message, but the DLL load failed
suggests that it installed the wrong version for your system.
Yes, I tried it on win 7 x64. I run cmd as administrator second time, but same result.
I tried on VirtualBox with Ubuntu 14.04 pip install PyStasm
don't work and sudo pip install PyStasm
is ok.
It looks like I've reproduced the problem running Python 2.7 on my machine. Thanks for pointing it out to me. I should be able to fix it sometime in the next couple days.
What version of OpenCV are you using? The binaries available on PyPI were built using 3.0; if you're using a different version try downloading the source code and building it that way ($ python setup.py install
). Let me know what the result of that is.
opencv-python==2.4.9
C:\WINDOWS\system32>pip freeze
Jinja2==2.7.3
MarkupSafe==0.23
Pillow==2.6.1
PyStasm==0.3.1
Pygments==2.0.2
Sphinx==1.2.3
Theano==0.6.0
backports.ssl-match-hostname==3.4.0.2
certifi==14.05.14
docutils==0.12
ipython==2.4.1
matplotlib==1.4.0
nltk==3.0.1
nose==1.3.4
numpy==1.8.1
numpydoc==0.5
opencv-python==2.4.9
pandas==0.14.1
pyparsing==2.0.2
pyreadline==2.0
python-dateutil==2.2
pytz==2014.7
pyzmq==14.5.0
scikit-image==0.10.1
scikit-learn==0.15.2
scipy==0.14.0
six==1.8.0
tornado==4.1
Where I should put opencv? Is it somewhere in python libs(opencv-python==2.4.9)? or I should download opencv separately?
C:\WINDOWS\system32>cd C:\Users\user\Downloads\PyStasm-master\PyStasm-master
C:\Users\user\Downloads\PyStasm-master\PyStasm-master>python setup.py install
running install
running bdist_egg
running egg_info
creating PyStasm.egg-info
writing requirements to PyStasm.egg-info\requires.txt
writing PyStasm.egg-info\PKG-INFO
writing top-level names to PyStasm.egg-info\top_level.txt
writing dependency_links to PyStasm.egg-info\dependency_links.txt
writing manifest file 'PyStasm.egg-info\SOURCES.txt'
reading manifest file 'PyStasm.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'PyStasm.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
creating build
creating build\lib.win-amd64-2.7
creating build\lib.win-amd64-2.7\stasm
copying stasm\__init__.py -> build\lib.win-amd64-2.7\stasm
creating build\lib.win-amd64-2.7\stasm\data
copying stasm\data\README.txt -> build\lib.win-amd64-2.7\stasm\data
copying stasm\data\haarcascade_frontalface_alt2.xml -> build\lib.win-amd64-2.7\stasm\data
copying stasm\data\haarcascade_mcs_lefteye.xml -> build\lib.win-amd64-2.7\stasm\data
copying stasm\data\haarcascade_mcs_righteye.xml -> build\lib.win-amd64-2.7\stasm\data
copying stasm\data\testface.jpg -> build\lib.win-amd64-2.7\stasm\data
running build_ext
building 'stasm._stasm' extension
creating build\temp.win-amd64-2.7
creating build\temp.win-amd64-2.7\Release
creating build\temp.win-amd64-2.7\Release\src
creating build\temp.win-amd64-2.7\Release\src\MOD_1
c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -IC:\Python27\include -IC:\Python27\PC -IC:\Python27\lib\site-packages\numpy\core\include /Tpsrc\asm.cpp /Fobuild\temp.win-amd64-2.7\Release\src\asm.obj /EHsc
asm.cpp
c:\users\user\downloads\pystasm-master\pystasm-master\src\stasm.h(33) : fatal error C1083: Cannot open include file: 'opencv2/opencv.hpp': No such file or directory
error: command '"c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64\cl.exe"' failed with exit status 2
Okay,
The prebuilt binaries on PyPI will not work with older versions of OpenCV; I've updated the project info slightly to reflect this. This means you can do one of two things: install 3.0 or build PyStasm yourself.
If you take the first approach, you can also try downloading the 64-bit Windows binaries if you don't want to build OpenCV yourself. Everything should go in the Lib\site-packages
directory of your Python installation (getting rid of the older OpenCV files), with the exception of opencv_ffmpeg300_64.dll
, which goes in the installation's root directory. This should be the simplest solution.
If you take the second approach, you'll need the OpenCV headers and libs in your compiler's include/linker paths. If you build OpenCV from source, copy the headers from opencv\build\install\include
to your compiler's include
directory and the libs from opencv\build\install\x64\vc9\lib
to your compiler's lib
directory. Then with OpenCV installed you should be able to successfully run python setup.py install
.
It's unfortunate that OpenCV isn't available through PyPI and needs to be set up on its own. This makes issues with matching versions and such a whole lot harder to work around. Anyway, if you still encounter any issues let me know.
I downloaded 64-bit Windows binaries and put them in C:\Python27\Lib\site-packages
,delete all *249*.dll
opencv files
By the way opencv_ffmpeg249_64.dll
file was in C:\Python27\Lib\site-packages
and C:\Python27\
dirs.
And I get :
C:\WINDOWS\system32>python
Python 2.7.6 (default, Nov 10 2013, 19:24:24) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: DLL load failed: ═х эрщфхэ єърчрээ√щ ьюфєы№.
Also I tried to uninstall opencv after that:
C:\WINDOWS\system32>pip freeze
Jinja2==2.7.3
MarkupSafe==0.23
Pillow==2.6.1
PyStasm==0.3.1
Pygments==2.0.2
Sphinx==1.2.3
Theano==0.6.0
backports.ssl-match-hostname==3.4.0.2
certifi==14.05.14
docutils==0.12
ipython==2.4.1
matplotlib==1.4.0
nltk==3.0.1
nose==1.3.4
numpy==1.8.1
numpydoc==0.5
opencv-python==2.4.9
pandas==0.14.1
pyparsing==2.0.2
pyreadline==2.0
python-dateutil==2.2
pytz==2014.7
pyzmq==14.5.0
scikit-image==0.10.1
scikit-learn==0.15.2
scipy==0.14.0
six==1.8.0
tornado==4.1
C:\WINDOWS\system32>pip uninstall opencv-python
Uninstalling opencv-python:
c:\python27\lib\site-packages\opencv_python-2.4.9-py2.7.egg-info
Proceed (y/n)? y
Successfully uninstalled opencv-python
C:\WINDOWS\system32>pip freeze
Jinja2==2.7.3
MarkupSafe==0.23
Pillow==2.6.1
PyStasm==0.3.1
Pygments==2.0.2
Sphinx==1.2.3
Theano==0.6.0
backports.ssl-match-hostname==3.4.0.2
certifi==14.05.14
docutils==0.12
ipython==2.4.1
matplotlib==1.4.0
nltk==3.0.1
nose==1.3.4
numpy==1.8.1
numpydoc==0.5
opencv-python==2.4.9.1
pandas==0.14.1
pyparsing==2.0.2
pyreadline==2.0
python-dateutil==2.2
pytz==2014.7
pyzmq==14.5.0
scikit-image==0.10.1
scikit-learn==0.15.2
scipy==0.14.0
six==1.8.0
tornado==4.1
Seems uninstall was successfull, but import cv2
still don't work.
And import stasm
too:
C:\WINDOWS\system32>python
Python 2.7.6 (default, Nov 10 2013, 19:24:24) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import stasm
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\stasm\__init__.py", line 3, in <module>
import cv2 # Get OpenCV DLL dependencies on Windows
ImportError: DLL load failed: ═х эрщфхэ єърчрээ√щ ьюфєы№.
>>>
Hmm, it's strange but I saw opencv-python==2.4.9.1
and also perform pip uninstall opencv-python
, it's deleted, but situation not changed globally.
Also I downloaded prebuild binaries from http://sourceforge.net/projects/opencvlibrary/files/opencv-win/3.0.0/ and copied cv2.pyd
from C:\Users\user\Downloads\opencv\build\python\2.7\x64
to C:\Python27\Lib\site-packages
, it's statically linked so it's don't need *.dll's
but seems stasm needs *.dll's
C:\WINDOWS\system32>python
Python 2.7.6 (default, Nov 10 2013, 19:24:24) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> import stasm
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\stasm\__init__.py", line 4, in <module>
from ._stasm import __doc__
ImportError: DLL load failed: ═х эрщфхэ єърчрээ√щ ьюфєы№.
Hmm. Okay, as a last resort, try taking the OpenCV 3.0 dlls and copying them to the same directory as _stasm.pyd
(should be something like site-packages\PyStasm-0.3.1-py2.7-win-amd64.egg\stasm
). The ones you need should only be opencv_core300.dll
, opencv_imgcodecs300.dll
, opencv_imgproc300.dll
, opencv_ml300.dll
, opencv_objdetect300.dll
, and opencv_videoio300.dll
, although it might be easier to copy them all just to be safe. stasm
should be able to locate them in that directory as at least a workaround while I look for some better way to handle it in the meantime.
I place all dll's in C:\Python27\Lib\site-packages\stasm
and it still don't work.
C:\Users\user>python
Python 2.7.6 (default, Nov 10 2013, 19:24:24) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> import stasm
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\stasm\__init__.py", line 4, in <module>
from ._stasm import __doc__
ImportError: DLL load failed: ═х эрщфхэ єърчрээ√щ ьюфєы№.
That's frustrating. Can you take a look at which top-level DLLs _stasm.pyd
can't find using Dependency Walker?
Don't fully understand output but here some of them:
It wants 3 opencv dll's(some of them link to other opencv dll's):
OPENCV_CORE300.DLL
OPENCV_IMGPROC300.DLL
OPENCV_OBJDETECT300.DLL
in subtree we have yellow (?) for theese entries for each opencv dll, something like:
MSVCP140.DLL
CONCRT140.DLL
VCRUNTIME140.DLL
API-MS-WIN-CRT-HEAP-L1-1-0.DLL
API-MS-WIN-CRT-STDIO-L1-1-0.DLL
API-MS-WIN-CRT-STRING-L1-1-0.DLL
API-MS-WIN-CRT-RUNTIME-L1-1-0.DLL
API-MS-WIN-CRT-MATH-L1-1-0.DLL
API-MS-WIN-CRT-CONVERT-L1-1-0.DLL
API-MS-WIN-CRT-ENVIRONMENT-L1-1-0.DLL
By the way I was mistaken I'm on win 10, not on win 7 if it matters.
This what the output of Dependency Walker looks like on my machine where import stasm
succeeds:
Are there any discrepancies between this and what you get?
in log window I have error, so it seems not everything ok.
Error: At least one required implicit or forwarded dependency was not found.
Warning: At least one delay-load dependency module was not found.
Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.
Seem problem in MSVCP140.DLL,CONCRT140.DLL,VCRUNTIME140.DLL
(i have yellow (?) in front of them)
One step further, after I download Visual C++ Redistributable for Visual Studio 2015 http://stackoverflow.com/questions/32998902/msvcp140-dll-missing
I get:
>>> import cv2
>>> import stasm
RuntimeError: module compiled against API version a but this version of numpy is 9
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\stasm\__init__.py", line 4, in <module>
from ._stasm import __doc__
ImportError: numpy.core.multiarray failed to import
>>>
Maybe you can link all libs statically to *.pyd file?
and after pip install -U numpy
it finally works.
http://stackoverflow.com/questions/20518632/importerror-numpy-core-multiarray-failed-to-import
But my script still not working:
I get
Traceback (most recent call last):
File "stasm_example.py", line 239, in <module>
Y_pred= Predict(X_test,Y_train)
File "stasm_example.py", line 213, in Predict
landmarks= stasm.search_single(img)
_stasm.StasmException: faceroi.cpp(49) : Assertion failed : roi.width > 0
I am getting the Assertion Failed error too. Anybody fixed this yet?
Same problem, Win 10 python 3.5 OpenCV 3.1
File "C:\Python35\lib\site-packages\stasm\__init__.py", line 4, in <module>
from ._stasm import __doc__
ImportError: DLL load failed: The specified module could not be found.
EDIT: Attempting to build and it wants 'opencv_core310.lib' which is not present in the OpenCV 3.1 build (it is there in the 3.0 build though). Any ideas?
Same thing here, Win 10, Python 2.7 OpenCV 3.1
File "C:\Anaconda2\lib\site-packages\stasm\__init__.py", line 4, in <module>
from ._stasm import __doc__
ImportError: DLL load failed: The specified module could not be found.
Anybody have any idea how to install and get this project to run on Windows?
d:\pystasm\src\stasm.h(33) : fatal error C1083: Cannot open include file: 'opencv2/opencv.hpp': No such file or directory error: command 'D:\Users\tracy01.xie\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe' failed with exit status 2
Looks like pystasm is not actively developed so I suggest to switch to dlib python api: http://dlib.net/face_landmark_detection.py.html
Also you check this: https://github.com/mrgloom/Face-landmarks-detection-benchmark
I successfully run
pip install PyStasm
but failed at
import stasm