Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stasm error installing on Windows #43

Open
ollietb opened this issue Aug 13, 2018 · 5 comments
Open

Stasm error installing on Windows #43

ollietb opened this issue Aug 13, 2018 · 5 comments

Comments

@ollietb
Copy link

ollietb commented Aug 13, 2018

I'm trying to install this on my Windows machine but I'm coming up against this error Cannot open include file: 'opencv2/opencv.hpp': No such file or directory. I've installed the opencv Windows library and tried copying the opencv2 header files over to the virtualenv includes folder, but they still aren't getting found.

C:\Users\ollie\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -IC:\Python27\include -Ic:\sandbox\morph\env2\PC -Ic:\sandbox\morph\env2\lib\site-packages\numpy\core\include /Tpsrc\asm.cpp /Fobuild\temp.win-amd64-2.7\Release\src\asm.obj /EHsc
asm.cpp
c:\users\ollie\appdata\local\temp\pip-install-ydpzmd\stasm\src\stasm.h(33) : fatal error C1083: Cannot open include file: 'opencv2/opencv.hpp': No such file or directory
error: command 'C:\\Users\\ollie\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\amd64\\cl.exe' failed with exit status 2

----------------------------------------
Command "c:\sandbox\morph\env2\scripts\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\ollie\\appdata\\local\\temp\\pip-install-ydpzmd\\stasm\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record c:\users\ollie\appdata\local\temp\pip-record-8xrdbb\install-record.txt --single-version-externally-managed --compile --install-headers c:\sandbox\morph\env2\include\site\python2.7\stasm" failed with error code 1 in c:\users\ollie\appdata\local\temp\pip-install-ydpzmd\stasm\
@alyssaq
Copy link
Owner

alyssaq commented Aug 17, 2018

Hi @ollietb stasm expects opencv3 to be installed. This article might help: https://www.learnopencv.com/install-opencv3-on-windows.
Stasm only needs the C++ opencv3 libraries.

A good test to see if opencv3 has been installed successfully is to run one of their examples:
https://docs.opencv.org/3.4.2/dc/d88/Drawing_1_8cpp-example.html
On mac, compiling it would be: g++ test.cpp -lopencv_core -lopencv_imgproc -lopencv_highgui

@ollietb
Copy link
Author

ollietb commented Sep 2, 2018

It's OK I managed to get it working using the dlib fork which was much easier to set up

@oneandonlyoddo
Copy link

oneandonlyoddo commented Jan 17, 2019

Hey I got the same problem trying to run this in a Anaconda environment. I followed all steps in https://www.learnopencv.com/install-opencv3-on-windows. I can compile the test app they mention (C++ RedEyeRemover), run the python equivalent of it and import cv2 in a python session without any errors. Still I fail to install stasm because of the same error that @ollietb had.

(facemorph) C:\Users\Jonas\Workspace\python\facemorph>python
Python 3.7.2 (default, Jan  2 2019, 17:07:39) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> cv2.__version__
'3.4.5'
>>>

Where is stasm looking for these files? It is definitely in the PATH.

@alyssaq
Copy link
Owner

alyssaq commented Jan 20, 2019

Yeh, the problem is stasm not finding the openCV lib folder - its looking at /usr/local/lib. I dont have access to any Windows machine so not sure how to test/fix it. It might be easier to use the dlib branch: https://github.com/alyssaq/face_morpher/tree/dlib and follow the requirements section in the readme.

My plan is to eventually switch stasm to dlib.

@jankaWIS
Copy link

I'm suffering with the same, related issue? alyssaq/stasm#4

Btw, https://pypi.org/project/facemorpher/ still points to stasm, probably would be good to put a link or a note there to use dlib instead. The problem then is that pip install facemorpher still uses spasm and yields:

ERROR: Command errored out with exit status 1:
   command: 'C:\Users\janka.WISMAIN\AppData\Local\Continuum\anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\JANKA~1.WIS\\AppData\\Local\\Temp\\pip-install-rbm_w60m\\stasm_f40e238c30a04ed0a617b93678af83d7\\setup.py'"'"'; __file__='"'"'C:\\Users\\JANKA~1.WIS\\AppData\\Local\\Temp\\pip-install-rbm_w60m\\stasm_f40e238c30a04ed0a617b93678af83d7\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\JANKA~1.WIS\AppData\Local\Temp\pip-wheel-jf_x9y6x'
       cwd: C:\Users\JANKA~1.WIS\AppData\Local\Temp\pip-install-rbm_w60m\stasm_f40e238c30a04ed0a617b93678af83d7\
  Complete output (32 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.7
  creating build\lib.win-amd64-3.7\stasm
  copying stasm\__init__.py -> build\lib.win-amd64-3.7\stasm
  running egg_info
  writing stasm.egg-info\PKG-INFO
  writing dependency_links to stasm.egg-info\dependency_links.txt
  writing requirements to stasm.egg-info\requires.txt
  writing top-level names to stasm.egg-info\top_level.txt
  reading manifest file 'stasm.egg-info\SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  writing manifest file 'stasm.egg-info\SOURCES.txt'
  creating build\lib.win-amd64-3.7\stasm\data
  copying stasm\data\README.txt -> build\lib.win-amd64-3.7\stasm\data
  copying stasm\data\haarcascade_frontalface_alt2.xml -> build\lib.win-amd64-3.7\stasm\data
  copying stasm\data\haarcascade_mcs_lefteye.xml -> build\lib.win-amd64-3.7\stasm\data
  copying stasm\data\haarcascade_mcs_righteye.xml -> build\lib.win-amd64-3.7\stasm\data
  copying stasm\data\testface.jpg -> build\lib.win-amd64-3.7\stasm\data
  running build_ext
  building '_stasm' extension
  creating build\temp.win-amd64-3.7
  creating build\temp.win-amd64-3.7\Release
  creating build\temp.win-amd64-3.7\Release\src
  creating build\temp.win-amd64-3.7\Release\src\mod_1
  C:\Users\janka.WISMAIN\AppData\Local\Continuum\anaconda3\Library\mingw-w64\bin\gcc.exe -mdll -O -Wall -DMS_WIN64 -I/usr/local/include -I/usr/local/Cellar/opencv/3.4.1_5/include -I/usr/local/include/opencv4 -IC:\Users\janka.WISMAIN\AppData\Local\Continuum\anaconda3\include -IC:\Users\janka.WISMAIN\AppData\Local\Continuum\anaconda3\include -IC:\Users\janka.WISMAIN\AppData\Local\Continuum\anaconda3\lib\site-packages\numpy\core\include -c src\asm.cpp -o build\temp.win-amd64-3.7\Release\src\asm.o -std=c++11
  In file included from src\asm.cpp:5:0:
  src\stasm.h:33:30: fatal error: opencv2/opencv.hpp: No such file or directory
  compilation terminated.
  error: command 'C:\\Users\\janka.WISMAIN\\AppData\\Local\\Continuum\\anaconda3\\Library\\mingw-w64\\bin\\gcc.exe' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for stasm
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\janka.WISMAIN\AppData\Local\Continuum\anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\JANKA~1.WIS\\AppData\\Local\\Temp\\pip-install-rbm_w60m\\stasm_f40e238c30a04ed0a617b93678af83d7\\setup.py'"'"'; __file__='"'"'C:\\Users\\JANKA~1.WIS\\AppData\\Local\\Temp\\pip-install-rbm_w60m\\stasm_f40e238c30a04ed0a617b93678af83d7\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\JANKA~1.WIS\AppData\Local\Temp\pip-record-_de8sxwp\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\janka.WISMAIN\AppData\Local\Continuum\anaconda3\Include\stasm'
         cwd: C:\Users\JANKA~1.WIS\AppData\Local\Temp\pip-install-rbm_w60m\stasm_f40e238c30a04ed0a617b93678af83d7\
    Complete output (32 lines):
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.7
    creating build\lib.win-amd64-3.7\stasm
    copying stasm\__init__.py -> build\lib.win-amd64-3.7\stasm
    running egg_info
    writing stasm.egg-info\PKG-INFO
    writing dependency_links to stasm.egg-info\dependency_links.txt
    writing requirements to stasm.egg-info\requires.txt
    writing top-level names to stasm.egg-info\top_level.txt
    reading manifest file 'stasm.egg-info\SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    writing manifest file 'stasm.egg-info\SOURCES.txt'
    creating build\lib.win-amd64-3.7\stasm\data
    copying stasm\data\README.txt -> build\lib.win-amd64-3.7\stasm\data
    copying stasm\data\haarcascade_frontalface_alt2.xml -> build\lib.win-amd64-3.7\stasm\data
    copying stasm\data\haarcascade_mcs_lefteye.xml -> build\lib.win-amd64-3.7\stasm\data
    copying stasm\data\haarcascade_mcs_righteye.xml -> build\lib.win-amd64-3.7\stasm\data
    copying stasm\data\testface.jpg -> build\lib.win-amd64-3.7\stasm\data
    running build_ext
    building '_stasm' extension
    creating build\temp.win-amd64-3.7
    creating build\temp.win-amd64-3.7\Release
    creating build\temp.win-amd64-3.7\Release\src
    creating build\temp.win-amd64-3.7\Release\src\mod_1
    C:\Users\janka.WISMAIN\AppData\Local\Continuum\anaconda3\Library\mingw-w64\bin\gcc.exe -mdll -O -Wall -DMS_WIN64 -I/usr/local/include -I/usr/local/Cellar/opencv/3.4.1_5/include -I/usr/local/include/opencv4 -IC:\Users\janka.WISMAIN\AppData\Local\Continuum\anaconda3\include -IC:\Users\janka.WISMAIN\AppData\Local\Continuum\anaconda3\include -IC:\Users\janka.WISMAIN\AppData\Local\Continuum\anaconda3\lib\site-packages\numpy\core\include -c src\asm.cpp -o build\temp.win-amd64-3.7\Release\src\asm.o -std=c++11
    In file included from src\asm.cpp:5:0:
    src\stasm.h:33:30: fatal error: opencv2/opencv.hpp: No such file or directory
    compilation terminated.
    error: command 'C:\\Users\\janka.WISMAIN\\AppData\\Local\\Continuum\\anaconda3\\Library\\mingw-w64\\bin\\gcc.exe' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\janka.WISMAIN\AppData\Local\Continuum\anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\JANKA~1.WIS\\AppData\\Local\\Temp\\pip-install-rbm_w60m\\stasm_f40e238c30a04ed0a617b93678af83d7\\setup.py'"'"'; __file__='"'"'C:\\Users\\JANKA~1.WIS\\AppData\\Local\\Temp\\pip-install-rbm_w60m\\stasm_f40e238c30a04ed0a617b93678af83d7\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\JANKA~1.WIS\AppData\Local\Temp\pip-record-_de8sxwp\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\janka.WISMAIN\AppData\Local\Continuum\anaconda3\Include\stasm' Check the logs for full command output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants