How to fix DLIB for Python/Windows in 2020? - python

I've seen quite a few old answers, but nothing new. I'm trying to pip install face_recognition which requires the dlib library. I have already tried to pip install cmake and it installed fine. I tried to pip install dlib by itself and got errors. I tried multiple versions and it didn't work. Here's the specific portion of the error I'm trying to resolve. I've watched like 10 YouTube videos and nothing addresses this specific problem.
CMake Error at C:/Users/Notebook/AppData/Local/Temp/pip-install-m4y9pm9i/dlib/dlib/external/pybind11/tools/FindPythonLibsNew.cmake:124 (message):
Python config failure: Python is 32-bit, chosen compiler is 64-bit
And here's the whole error.
ERROR: Command errored out with exit status 1:
command: 'c:\users\notebook\appdata\local\programs\python\python37-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Notebook\\AppData\\Local\\Temp\\pip-install-m4y9pm9i\\dlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\Notebook\\AppData\\Local\\Temp\\pip-install-m4y9pm9i\\dlib\\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\Notebook\AppData\Local\Temp\pip-record-zvgo3oos\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\notebook\appdata\local\programs\python\python37-32\Include\dlib'
cwd: C:\Users\Notebook\AppData\Local\Temp\pip-install-m4y9pm9i\dlib\
Complete output (66 lines):
running install
running build
running build_py
package init file 'dlib\__init__.py' not found (or not a regular file)
running build_ext
Building extension for Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 21:26:53) [MSC v.1916 32 bit (Intel)]
Invoking CMake setup: 'cmake C:\Users\Notebook\AppData\Local\Temp\pip-install-m4y9pm9i\dlib\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\Notebook\AppData\Local\Temp\pip-install-m4y9pm9i\dlib\build\lib.win32-3.7 -DPYTHON_EXECUTABLE=c:\users\notebook\appdata\local\programs\python\python37-32\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\Notebook\AppData\Local\Temp\pip-install-m4y9pm9i\dlib\build\lib.win32-3.7'
-- Building for: Visual Studio 16 2019
-- Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.18363.
-- The C compiler identification is MSVC 19.21.27702.2
-- The CXX compiler identification is MSVC 19.21.27702.2
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.21.27702/bin/Hostx64/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.21.27702/bin/Hostx64/x64/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.21.27702/bin/Hostx64/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.21.27702/bin/Hostx64/x64/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PythonInterp: C:/Users/Notebook/AppData/Local/Programs/Python/Python37-32/python.exe (found version "3.7.3")
CMake Error at C:/Users/Notebook/AppData/Local/Temp/pip-install-m4y9pm9i/dlib/dlib/external/pybind11/tools/FindPythonLibsNew.cmake:124 (message):
Python config failure: Python is 32-bit, chosen compiler is 64-bit
Call Stack (most recent call first):
C:/Users/Notebook/AppData/Local/Temp/pip-install-m4y9pm9i/dlib/dlib/external/pybind11/tools/pybind11Tools.cmake:16 (find_package)
C:/Users/Notebook/AppData/Local/Temp/pip-install-m4y9pm9i/dlib/dlib/external/pybind11/CMakeLists.txt:33 (include)
-- Configuring incomplete, errors occurred!
See also "C:/Users/Notebook/AppData/Local/Temp/pip-install-m4y9pm9i/dlib/build/temp.win32-3.7/Release/CMakeFiles/CMakeOutput.log".
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\Notebook\AppData\Local\Temp\pip-install-m4y9pm9i\dlib\setup.py", line 261, in <module>
'Topic :: Software Development',
File "c:\users\notebook\appdata\local\programs\python\python37-32\lib\site-packages\setuptools\__init__.py", line 145, in setup
return distutils.core.setup(**attrs)
File "c:\users\notebook\appdata\local\programs\python\python37-32\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "c:\users\notebook\appdata\local\programs\python\python37-32\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "c:\users\notebook\appdata\local\programs\python\python37-32\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "c:\users\notebook\appdata\local\programs\python\python37-32\lib\site-packages\setuptools\command\install.py", line 61, in run
return orig.install.run(self)
File "c:\users\notebook\appdata\local\programs\python\python37-32\lib\distutils\command\install.py", line 545, in run
self.run_command('build')
File "c:\users\notebook\appdata\local\programs\python\python37-32\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\notebook\appdata\local\programs\python\python37-32\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "c:\users\notebook\appdata\local\programs\python\python37-32\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "c:\users\notebook\appdata\local\programs\python\python37-32\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\notebook\appdata\local\programs\python\python37-32\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\Notebook\AppData\Local\Temp\pip-install-m4y9pm9i\dlib\setup.py", line 135, in run
self.build_extension(ext)
File "C:\Users\Notebook\AppData\Local\Temp\pip-install-m4y9pm9i\dlib\setup.py", line 172, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File "c:\users\notebook\appdata\local\programs\python\python37-32\lib\subprocess.py", line 347, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\Notebook\\AppData\\Local\\Temp\\pip-install-m4y9pm9i\\dlib\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\Notebook\\AppData\\Local\\Temp\\pip-install-m4y9pm9i\\dlib\\build\\lib.win32-3.7', '-DPYTHON_EXECUTABLE=c:\\users\\notebook\\appdata\\local\\programs\\python\\python37-32\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\Notebook\\AppData\\Local\\Temp\\pip-install-m4y9pm9i\\dlib\\build\\lib.win32-3.7']' returned non-zero exit status 1.
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\notebook\appdata\local\programs\python\python37-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Notebook\\AppData\\Local\\Temp\\pip-install-m4y9pm9i\\dlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\Notebook\\AppData\\Local\\Temp\\pip-install-m4y9pm9i\\dlib\\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\Notebook\AppData\Local\Temp\pip-record-zvgo3oos\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\notebook\appdata\local\programs\python\python37-32\Include\dlib' Check the logs for full command output.

I have compiled dlib for android, but did not need to do such for python in windows. Download 64 bit Anaconda Python 3.7, create a conda environment and install dlib on it.
https://anaconda.org/conda-forge/dlib
You may need to install numpy, opencv etc packages beforehand to avoid some errors. You can then pip install face_recognition in that conda environment.
You could also clone the repo and install it from there. Another way is open the whole project in IDE and create a python script to run your code.
https://github.com/ageitgey/face_recognition
https://pypi.org/project/face-recognition/

Related

why i'm getting this error "check the logs for full command output" when i'm installing dlib?

I'm trying to install dlib on vertual studio code but the following error is displayed:
Running setup.py install for dlib ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\acer\appdata\local\programs\python\python39\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ACER\\AppData\\Local\\Temp\\pip-install-iotpp637\\dlib_cbdb8998ebb54dee8cad48a70a8a0f3c\\setup.py'"'"'; __file__='"'"'C:\\Users\\ACER\\AppData\\Local\\Temp\\pip-install-iotpp637\\dlib_cbdb8998ebb54dee8cad48a70a8a0f3c\\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\ACER\AppData\Local\Temp\pip-record-qzdzy48q\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\acer\appdata\local\programs\python\python39\Include\dlib'
cwd: C:\Users\ACER\AppData\Local\Temp\pip-install-iotpp637\dlib_cbdb8998ebb54dee8cad48a70a8a0f3c\
Complete output (60 lines):
running install
running build
running build_py
package init file 'tools\python\dlib\__init__.py' not found (or not a regular file)
running build_ext
Building extension for Python 3.9.0 (tags/v3.9.0:9cf6752, Oct 5 2020, 15:34:40) [MSC v.1927 64 bit (AMD64)]
Invoking CMake setup: 'cmake C:\Users\ACER\AppData\Local\Temp\pip-install-iotpp637\dlib_cbdb8998ebb54dee8cad48a70a8a0f3c\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\ACER\AppData\Local\Temp\pip-install-iotpp637\dlib_cbdb8998ebb54dee8cad48a70a8a0f3c\build\lib.win-amd64-3.9 -DPYTHON_EXECUTABLE=c:\users\acer\appdata\local\programs\python\python39\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\ACER\AppData\Local\Temp\pip-install-iotpp637\dlib_cbdb8998ebb54dee8cad48a70a8a0f3c\build\lib.win-amd64-3.9 -A x64'
-- Building for: NMake Makefiles
CMake Error at CMakeLists.txt:5 (message):
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
You must use Visual Studio to build a python extension on windows. If you
are getting this error it means you have not installed Visual C++. Note
that there are many flavors of Visual Studio, like Visual Studio for C#
development. You need to install Visual Studio for C++.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-- Configuring incomplete, errors occurred!
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\ACER\AppData\Local\Temp\pip-install-iotpp637\dlib_cbdb8998ebb54dee8cad48a70a8a0f3c\setup.py", line 223, in <module>
setup(
File "c:\users\acer\appdata\local\programs\python\python39\lib\site-packages\setuptools\__init__.py", line 165, in setup
return distutils.core.setup(**attrs)
File "c:\users\acer\appdata\local\programs\python\python39\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "c:\users\acer\appdata\local\programs\python\python39\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "c:\users\acer\appdata\local\programs\python\python39\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "c:\users\acer\appdata\local\programs\python\python39\lib\site-packages\setuptools\command\install.py", line 61, in run
return orig.install.run(self)
File "c:\users\acer\appdata\local\programs\python\python39\lib\distutils\command\install.py", line 546, in run
self.run_command('build')
File "c:\users\acer\appdata\local\programs\python\python39\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\acer\appdata\local\programs\python\python39\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "c:\users\acer\appdata\local\programs\python\python39\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "c:\users\acer\appdata\local\programs\python\python39\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\acer\appdata\local\programs\python\python39\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\ACER\AppData\Local\Temp\pip-install-iotpp637\dlib_cbdb8998ebb54dee8cad48a70a8a0f3c\setup.py", line 135, in run
self.build_extension(ext)
File "C:\Users\ACER\AppData\Local\Temp\pip-install-iotpp637\dlib_cbdb8998ebb54dee8cad48a70a8a0f3c\setup.py", line 172, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File "c:\users\acer\appdata\local\programs\python\python39\lib\subprocess.py", line 373, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\ACER\\AppData\\Local\\Temp\\pip-install-iotpp637\\dlib_cbdb8998ebb54dee8cad48a70a8a0f3c\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\ACER\\AppData\\Local\\Temp\\pip-install-iotpp637\\dlib_cbdb8998ebb54dee8cad48a70a8a0f3c\\build\\lib.win-amd64-3.9', '-DPYTHON_EXECUTABLE=c:\\users\\acer\\appdata\\local\\programs\\python\\python39\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\ACER\\AppData\\Local\\Temp\\pip-install-iotpp637\\dlib_cbdb8998ebb54dee8cad48a70a8a0f3c\\build\\lib.win-amd64-3.9', '-A', 'x64']' returned non-zero exit status 1.
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\acer\appdata\local\programs\python\python39\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ACER\\AppData\\Local\\Temp\\pip-install-iotpp637\\dlib_cbdb8998ebb54dee8cad48a70a8a0f3c\\setup.py'"'"'; __file__='"'"'C:\\Users\\ACER\\AppData\\Local\\Temp\\pip-install-iotpp637\\dlib_cbdb8998ebb54dee8cad48a70a8a0f3c\\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\ACER\AppData\Local\Temp\pip-record-qzdzy48q\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\acer\appdata\local\programs\python\python39\Include\dlib' Check the logs for full command output.
Additional note: I installed cmake and tried again but nothing change.
The error is obvious from the error message you got:
You must use Visual Studio to build a python extension on windows. If
you
are getting this error it means you have not installed Visual C++. Note
that there are many flavors of Visual Studio, like Visual Studio for C#
development. You need to install Visual Studio for C++.
You need to install *Visual Studio for C++ from here and rerun the installation so that the C++ extension to Python can get built.
You can avoid that using Anaconda where the dlib package is available already compiled (but for the moment not for Python 3.9).
you can use the following method to avoid installing the "Huge" IDE (VS) or the Anaconda.
Many binaries depend on Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017 and 2019 for Python 3
so, please try to use the following codes to solve it
pip install --upgrade setuptools
if you are not succeed to solve this problem,
then you can try to use this link The latest supported Visual C++ downloads to install this problem

Error build lief for install MobSF in Windows

I can't install MobSF in Windows 10 because some error when bulid lief. I have install python 3.8 on my laptop.
Error in my installation
**Running setup.py install for lief ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Users\CTI\AppData\Local\Programs\Python\Python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\CTI\\AppData\\Local\\Temp\\pip-install-ks8755du\\lief_3404ee98b1ef45c9a9780275fba1c784\\setup.py'"'"'; __file__='"'"'C:\\Users\\CTI\\AppData\\Local\\Temp\\pip-install-ks8755du\\lief_3404ee98b1ef45c9a9780275fba1c784\\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\CTI\AppData\Local\Temp\pip-record-cjp9pgsa\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\CTI\AppData\Local\Programs\Python\Python38\Include\lief'
cwd: C:\Users\CTI\AppData\Local\Temp\pip-install-ks8755du\lief_3404ee98b1ef45c9a9780275fba1c784\
Complete output (87 lines):
0.10.1
running install
running build
running build_ext
cmake C:\Users\CTI\AppData\Local\Temp\pip-install-ks8755du\lief_3404ee98b1ef45c9a9780275fba1c784 -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\CTI\AppData\Local\Temp\pip-install-ks8755du\lief_3404ee98b1ef45c9a9780275fba1c784\build\temp.win-amd64-3.8 -DPYTHON_EXECUTABLE=C:\Users\CTI\AppData\Local\Programs\Python\Python38\python.exe -DLIEF_PYTHON_API=on -DCMAKE_BUILD_TYPE=Release -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\CTI\AppData\Local\Temp\pip-install-ks8755du\lief_3404ee98b1ef45c9a9780275fba1c784\build\temp.win-amd64-3.8 -DLIEF_USE_CRT_RELEASE=MT -A x64
-- Building for: Visual Studio 16 2019
-- LIEF_CRT: /MT
-- Using Release VC++ CRT: MT
-- Could NOT find cppcheck (missing: CPPCHECK_EXECUTABLE CPPCHECK_POSSIBLEERROR_ARG CPPCHECK_UNUSEDFUNC_ARG CPPCHECK_STYLE_ARG CPPCHECK_INCLUDEPATH_ARG CPPCHECK_QUIET_ARG)
-- The C compiler identification is MSVC 19.28.29335.0
-- The CXX compiler identification is MSVC 19.28.29335.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.28.29333/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.28.29333/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- LIEF 0.10.0
-- ccache: ON
-- Enable JSON support
-- Enable Frozen (C++14 support)
-- Number of parallel compiler jobs set to /MP
-- Could NOT find cppcheck (missing: CPPCHECK_EXECUTABLE CPPCHECK_POSSIBLEERROR_ARG CPPCHECK_UNUSEDFUNC_ARG CPPCHECK_STYLE_ARG CPPCHECK_INCLUDEPATH_ARG CPPCHECK_QUIET_ARG)
-- Configuration Types: Debug;Release;MinSizeRel;RelWithDebInfo
-- Build Types: Release
-- Found PythonInterp: C:/Users/CTI/AppData/Local/Programs/Python/Python38/python.exe (found suitable version "3.8.7", minimum required is "3.5")
-- Found PythonLibs: C:/Users/CTI/AppData/Local/Programs/Python/Python38/libs/Python38.lib
-- Python version: 3.5
-- Python lib: C:/Users/CTI/AppData/Local/Programs/Python/Python38/libs/Python38.lib
-- Python include: C:/Users/CTI/AppData/Local/Programs/Python/Python38/include
-- Python interpreter: C:/Users/CTI/AppData/Local/Programs/Python/Python38/python.exe
-- Performing Test C_SUPPORTS_NO_MACRO_REDEFINED
-- Performing Test C_SUPPORTS_NO_MACRO_REDEFINED - Failed
-- Performing Test CXX_SUPPORTS_NO_MACRO_REDEFINED
-- Performing Test CXX_SUPPORTS_NO_MACRO_REDEFINED - Failed
-- Performing Test C_SUPPORTS_NO_DEPRECATED_DECLARATIONS
-- Performing Test C_SUPPORTS_NO_DEPRECATED_DECLARATIONS - Failed
-- Performing Test CXX_SUPPORTS_NO_DEPRECATED_DECLARATIONS
-- Performing Test CXX_SUPPORTS_NO_DEPRECATED_DECLARATIONS - Failed
-- Performing Test HAS_ANSI
-- Performing Test HAS_ANSI - Failed
CMake Error at CMakeLists.txt:541 (add_subdirectory):
add_subdirectory given source
"C:/Users/CTI/AppData/Local/Temp/pip-install-ks8755du/lief_3404ee98b1ef45c9a9780275fba1c784/package"
which is not an existing directory.
-- Configuring incomplete, errors occurred!
See also "C:/Users/CTI/AppData/Local/Temp/pip-install-ks8755du/lief_3404ee98b1ef45c9a9780275fba1c784/build/temp.win-amd64-3.8/Release/CMakeFiles/CMakeOutput.log".
See also "C:/Users/CTI/AppData/Local/Temp/pip-install-ks8755du/lief_3404ee98b1ef45c9a9780275fba1c784/build/temp.win-amd64-3.8/Release/CMakeFiles/CMakeError.log".
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\CTI\AppData\Local\Temp\pip-install-ks8755du\lief_3404ee98b1ef45c9a9780275fba1c784\setup.py", line 363, in <module>
setup(
File "C:\Users\CTI\AppData\Roaming\Python\Python38\site-packages\setuptools\__init__.py", line 153, in setup
return distutils.core.setup(**attrs)
File "C:\Users\CTI\AppData\Local\Programs\Python\Python38\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\Users\CTI\AppData\Local\Programs\Python\Python38\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "C:\Users\CTI\AppData\Local\Programs\Python\Python38\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\CTI\AppData\Roaming\Python\Python38\site-packages\setuptools\command\install.py", line 61, in run
return orig.install.run(self)
File "C:\Users\CTI\AppData\Local\Programs\Python\Python38\lib\distutils\command\install.py", line 545, in run
self.run_command('build')
File "C:\Users\CTI\AppData\Local\Programs\Python\Python38\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Users\CTI\AppData\Local\Programs\Python\Python38\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\CTI\AppData\Local\Programs\Python\Python38\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "C:\Users\CTI\AppData\Local\Programs\Python\Python38\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Users\CTI\AppData\Local\Programs\Python\Python38\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\CTI\AppData\Local\Temp\pip-install-ks8755du\lief_3404ee98b1ef45c9a9780275fba1c784\setup.py", line 78, in run
self.build_extension(ext)
File "C:\Users\CTI\AppData\Local\Temp\pip-install-ks8755du\lief_3404ee98b1ef45c9a9780275fba1c784\setup.py", line 202, in build_extension
subprocess.check_call(configure_cmd, cwd=self.build_temp, env=env)
File "C:\Users\CTI\AppData\Local\Programs\Python\Python38\lib\subprocess.py", line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\CTI\\AppData\\Local\\Temp\\pip-install-ks8755du\\lief_3404ee98b1ef45c9a9780275fba1c784', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\CTI\\AppData\\Local\\Temp\\pip-install-ks8755du\\lief_3404ee98b1ef45c9a9780275fba1c784\\build\\temp.win-amd64-3.8', '-DPYTHON_EXECUTABLE=C:\\Users\\CTI\\AppData\\Local\\Programs\\Python\\Python38\\python.exe', '-DLIEF_PYTHON_API=on', '-DCMAKE_BUILD_TYPE=Release', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\CTI\\AppData\\Local\\Temp\\pip-install-ks8755du\\lief_3404ee98b1ef45c9a9780275fba1c784\\build\\temp.win-amd64-3.8', '-DLIEF_USE_CRT_RELEASE=MT', '-A', 'x64']' returned non-zero exit status 1.
----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\CTI\AppData\Local\Programs\Python\Python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\CTI\\AppData\\Local\\Temp\\pip-install-ks8755du\\lief_3404ee98b1ef45c9a9780275fba1c784\\setup.py'"'"'; __file__='"'"'C:\\Users\\CTI\\AppData\\Local\\Temp\\pip-install-ks8755du\\lief_3404ee98b1ef45c9a9780275fba1c784\\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\CTI\AppData\Local\Temp\pip-record-cjp9pgsa\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\CTI\AppData\Local\Programs\Python\Python38\Include\lief' Check the logs for full command output.**
Please help me to fix it.
LIEF won't build on python 3.8 unless you have build dependencies. MobSF on Windows need python 3.7
See this issue raised upstream: https://github.com/lief-project/LIEF/issues/512

invalid numeric argument '/Wsign-compare' : Can't install pip package or build corresponding library on Windows

I've been using the python module apriltag (found here https://pypi.org/project/apriltag/) on linux for a while, and need to move my system over to Windows. On my windows machine, I tried to install the apriltag pip package on python3.6:
python -m pip install apriltag
but the wheel failed to build, giving me a long error list in which I believe the key line is
Building Custom Rule C:/Users/xxxx/apriltag_3b8f424df9f543459d5bd3db09137d9f/core/CMakeLists.txt
cl : Command line error D8021: invalid numeric argument '/Wsign-compare'```
Worried that maybe the PyPI package didn't work on windows(?) I looked at the project that it was based on, found here https://github.com/swatbotics/apriltag. Cloning into it and building it with Visual Studio, the first build fails with
Error D8021 invalid numeric argument '/Wsign-compare'
I've looked on here for /Wsign-compare but have found no example of anyone even getting that error, let alone solving it. Let me know if there's a fix for it, or if this repo just isn't going to build on windows ever.
Thanks :)
EDIT: added entire python build log for context
python -m pip install apriltag
Collecting apriltag
Using cached apriltag-0.0.16.tar.gz (201 kB)
Building wheels for collected packages: apriltag
Building wheel for apriltag (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\xxxxxx\\AppData\\Local\\Temp\\2\\pip-install-4bvz6i3j\\apriltag_80d1649893034236a5513184eaa51946\\setup.py'"'"'; __file__='"'"'C:\\Users\\xxxxxx\\AppData\\Local\\Temp\\2\\pip-install-4bvz6i3j\\apriltag_80d1649893034236a5513184eaa51946\\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\xxxxxx\AppData\Local\Temp\2\pip-wheel-b7pu6nq2'
cwd: C:\Users\xxxxxx\AppData\Local\Temp\2\pip-install-4bvz6i3j\apriltag_80d1649893034236a5513184eaa51946\
Complete output (75 lines):
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.6
copying python\apriltag.py -> build\lib.win-amd64-3.6
running build_ext
-- Building for: Visual Studio 15 2017
-- The C compiler identification is MSVC 19.14.26428.1
-- The CXX compiler identification is MSVC 19.14.26428.1
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.14.26428/bin/Hostx86/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.14.26428/bin/Hostx86/x64/cl.exe - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.14.26428/bin/Hostx86/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.14.26428/bin/Hostx86/x64/cl.exe - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE
-- Found PkgConfig: C:/msys64/usr/bin/pkg-config.exe (found version "0.29.2")
-- Checking for one of the modules 'opencv>=2.3;opencv-2.3.1;opencv-3.0.0'
-- Configuring done
-- Generating done
CMake Warning:
Manually-specified variables were not used by the project:
PYTHON_EXECUTABLE
-- Build files have been written to: C:/Users/xxxxxx/AppData/Local/Temp/2/pip-install-4bvz6i3j/apriltag_80d1649893034236a5513184eaa51946/build/temp.win-amd64-3.6/Release
Microsoft (R) Build Engine version 15.7.177.53362 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.CppBuild.targets(399,5): warning MSB8029: The Intermediate directory or Output directory cannot
reside under the Temporary directory as it could lead to issues with incremental build. [C:\Users\xxxxxx\AppData\Local\Temp\2\pip-install-4bvz6i3j\apriltag_80d1649893034236a5513184eaa51946\build\temp.win-amd64-3.6\Release\ZERO_CHECK.vcxproj]
Checking Build System
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.CppBuild.targets(399,5): warning MSB8029: The Intermediate directory or Output directory cannot
reside under the Temporary directory as it could lead to issues with incremental build. [C:\Users\xxxxxx\AppData\Local\Temp\2\pip-install-4bvz6i3j\apriltag_80d1649893034236a5513184eaa51946\build\temp.win-amd64-3.6\Release\core\apriltag.vcxproj]
Building Custom Rule C:/Users/xxxxxx/AppData/Local/Temp/2/pip-install-4bvz6i3j/apriltag_80d1649893034236a5513184eaa51946/core/CMakeLists.txt
cl : Command line error D8021: invalid numeric argument '/Wsign-compare' [C:\Users\xxxxxx\AppData\Local\Temp\2\pip-install-4bvz6i3j\apriltag_80d1649893034236a5513184eaa51946\build\temp.win-amd64-3.6\Release\core\apriltag.vcxproj]
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\xxxxxx\AppData\Local\Temp\2\pip-install-4bvz6i3j\apriltag_80d1649893034236a5513184eaa51946\setup.py", line 74, in <module>
py_modules=['apriltag']
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\site-packages\setuptools\__init__.py", line 153, in setup
return distutils.core.setup(**attrs)
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\site-packages\wheel\bdist_wheel.py", line 192, in run
self.run_command('build')
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Users\xxxxxx\AppData\Local\Temp\2\pip-install-4bvz6i3j\apriltag_80d1649893034236a5513184eaa51946\setup.py", line 35, in run
self.build_extension(ext)
File "C:\Users\xxxxxx\AppData\Local\Temp\2\pip-install-4bvz6i3j\apriltag_80d1649893034236a5513184eaa51946\setup.py", line 60, in build_extension
subprocess.check_call(['cmake', '--build', '.'] + build_args, cwd=self.build_temp)
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\subprocess.py", line 311, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--config', 'Release', '--', '/m']' returned non-zero exit status 1.
----------------------------------------
ERROR: Failed building wheel for apriltag
Running setup.py clean for apriltag
Failed to build apriltag
Installing collected packages: apriltag
Running setup.py install for apriltag ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\xxxxxx\\AppData\\Local\\Temp\\2\\pip-install-4bvz6i3j\\apriltag_80d1649893034236a5513184eaa51946\\setup.py'"'"'; __file__='"'"'C:\\Users\\xxxxxx\\AppData\\Local\\Temp\\2\\pip-install-4bvz6i3j\\apriltag_80d1649893034236a5513184eaa51946\\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\xxxxxx\AppData\Local\Temp\2\pip-record-ryn6eco8\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\Include\apriltag'
cwd: C:\Users\xxxxxx\AppData\Local\Temp\2\pip-install-4bvz6i3j\apriltag_80d1649893034236a5513184eaa51946\
Complete output (77 lines):
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.6
copying python\apriltag.py -> build\lib.win-amd64-3.6
running build_ext
-- Building for: Visual Studio 15 2017
-- The C compiler identification is MSVC 19.14.26428.1
-- The CXX compiler identification is MSVC 19.14.26428.1
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.14.26428/bin/Hostx86/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.14.26428/bin/Hostx86/x64/cl.exe - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.14.26428/bin/Hostx86/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.14.26428/bin/Hostx86/x64/cl.exe - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE
-- Found PkgConfig: C:/msys64/usr/bin/pkg-config.exe (found version "0.29.2")
-- Checking for one of the modules 'opencv>=2.3;opencv-2.3.1;opencv-3.0.0'
-- Configuring done
-- Generating done
CMake Warning:
Manually-specified variables were not used by the project:
PYTHON_EXECUTABLE
-- Build files have been written to: C:/Users/xxxxxx/AppData/Local/Temp/2/pip-install-4bvz6i3j/apriltag_80d1649893034236a5513184eaa51946/build/temp.win-amd64-3.6/Release
Microsoft (R) Build Engine version 15.7.177.53362 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.CppBuild.targets(399,5): warning MSB8029: The Intermediate directory or Output directory cannot reside under the Temporary directory as it could lead to issues with incremental build. [C:\Users\xxxxxx\AppData\Local\Temp\2\pip-install-4bvz6i3j\apriltag_80d1649893034236a5513184eaa51946\build\temp.win-amd64-3.6\Release\ZERO_CHECK.vcxproj]
Checking Build System
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.CppBuild.targets(399,5): warning MSB8029: The Intermediate directory or Output directory cannot reside under the Temporary directory as it could lead to issues with incremental build. [C:\Users\xxxxxx\AppData\Local\Temp\2\pip-install-4bvz6i3j\apriltag_80d1649893034236a5513184eaa51946\build\temp.win-amd64-3.6\Release\core\apriltag.vcxproj]
Building Custom Rule C:/Users/xxxxxx/AppData/Local/Temp/2/pip-install-4bvz6i3j/apriltag_80d1649893034236a5513184eaa51946/core/CMakeLists.txt
cl : Command line error D8021: invalid numeric argument '/Wsign-compare' [C:\Users\xxxxxx\AppData\Local\Temp\2\pip-install-4bvz6i3j\apriltag_80d1649893034236a5513184eaa51946\build\temp.win-amd64-3.6\Release\core\apriltag.vcxproj]
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\xxxxxx\AppData\Local\Temp\2\pip-install-4bvz6i3j\apriltag_80d1649893034236a5513184eaa51946\setup.py", line 74, in <module>
py_modules=['apriltag']
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\site-packages\setuptools\__init__.py", line 153, in setup
return distutils.core.setup(**attrs)
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\site-packages\setuptools\command\install.py", line 61, in run
return orig.install.run(self)
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\distutils\command\install.py", line 545, in run
self.run_command('build')
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Users\xxxxxx\AppData\Local\Temp\2\pip-install-4bvz6i3j\apriltag_80d1649893034236a5513184eaa51946\setup.py", line 35, in run
self.build_extension(ext)
File "C:\Users\xxxxxx\AppData\Local\Temp\2\pip-install-4bvz6i3j\apriltag_80d1649893034236a5513184eaa51946\setup.py", line 60, in build_extension
subprocess.check_call(['cmake', '--build', '.'] + build_args, cwd=self.build_temp)
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\lib\subprocess.py", line 311, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--config', 'Release', '--', '/m']' returned non-zero exit status 1.
----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\xxxxxx\\AppData\\Local\\Temp\\2\\pip-install-4bvz6i3j\\apriltag_80d1649893034236a5513184eaa51946\\setup.py'"'"'; __file__='"'"'C:\\Users\\xxxxxx\\AppData\\Local\\Temp\\2\\pip-install-4bvz6i3j\\apriltag_80d1649893034236a5513184eaa51946\\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\xxxxxx\AppData\Local\Temp\2\pip-record-ryn6eco8\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\xxxxxx\AppData\Local\Programs\Python\Python36\Include\apriltag' Check the logs for full command output.```
I got the same error with that PyPI apriltag library.
Short answer: Don't use this poorly-maintained library. Use pupil-apriltags instead, which will work on Windows as well.
More details
The PyPI package apriltag [https://pypi.org/project/apriltag/#description] we are trying to install, via pip install apriltag is apparently an "unofficial package" by a man named Bernd Winkler, last updated 7 December 2018.
The actual Python wrapper module created by Matt Zucker
[https://github.com/mzucker] and last updated on GitHub 18 July 2018
at https://github.com/swatbotics/apriltag.
FYI, Matt's wrapper is for the C code written by the April Lab at the University of Michigan, headed Edwin Olson, who invented AprilTags in May 2010. [https://github.com/AprilRobotics/apriltag].
Matt says:
"Please note: I am not the maintainer of the pypi package listed at https://pypi.org/project/apriltag/ – GitHub issues filed here reporting problems with that package will be summarily closed. Sorry, I don't have time to support someone else's unofficial package."
So a better installation process would start from what Matt says at his GitHub repo:
cd /path/to/apriltag
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j4
If you want to install the library and important binaries to your system directories, you can then type
sudo make install
Note: The apriltag does not appear to work on Windows:
For me, on Windows, the "make" command was not available, so I followed this:
Install Chocolatey at https://chocolatey.org/install
Run choco install make
Even so, the make command didn't do anything, though.
However, on Windows after running:
import cv2
import apriltag
img = cv2.imread('test.jpg', cv2.IMREAD_GRAYSCALE)
detector = apriltag.Detector()
result = detector.detect(img)
print(result)
Gives the error: AttributeError: module 'os' has no attribute 'uname', which is only available on UNIX.
In searching I found other, better-maintained Python libraries for the AprilTag C bindings. In particular, this one: pupil_apriltags. And it works on Windows.

Error in installing face_recognition module using pip

I am using vs code in windows 10. When I install face_recognition in vs code using pip I got the following error, I have also tried to install dlib before installing face_recognition.
ERROR: Command errored out with exit status 1:
command: 'c:\users\admin\appdata\local\programs\python\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Admin\\AppData\\Local\\Temp\\pip-install-fi__6w9v\\dlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\Admin\\AppData\\Local\\Temp\\pip-install-fi__6w9v\\dlib\\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\Admin\AppData\Local\Temp\pip-record-f5b3pskr\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\admin\appdata\local\programs\python\python38\Include\dlib'
cwd: C:\Users\Admin\AppData\Local\Temp\pip-install-fi__6w9v\dlib\
Complete output (60 lines):
running install
running build
running build_py
package init file 'tools\python\dlib\__init__.py' not found (or not a regular file)
running build_ext
Building extension for Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:57:54) [MSC v.1924 64 bit (AMD64)]
Invoking CMake setup: 'cmake C:\Users\Admin\AppData\Local\Temp\pip-install-fi__6w9v\dlib\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\Admin\AppData\Local\Temp\pip-install-fi__6w9v\dlib\build\lib.win-amd64-3.8 -DPYTHON_EXECUTABLE=c:\users\admin\appdata\local\programs\python\python38\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\Admin\AppData\Local\Temp\pip-install-fi__6w9v\dlib\build\lib.win-amd64-3.8 -A x64'
-- Building for: NMake Makefiles
CMake Error at CMakeLists.txt:5 (message):
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
You must use Visual Studio to build a python extension on windows. If you
are getting this error it means you have not installed Visual C++. Note
that there are many flavors of Visual Studio, like Visual Studio for C#
development. You need to install Visual Studio for C++.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-- Configuring incomplete, errors occurred!
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\Admin\AppData\Local\Temp\pip-install-fi__6w9v\dlib\setup.py", line 223, in <module>
setup(
File "c:\users\admin\appdata\local\programs\python\python38\lib\site-packages\setuptools\__init__.py", line 144, in setup
return distutils.core.setup(**attrs)
File "c:\users\admin\appdata\local\programs\python\python38\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "c:\users\admin\appdata\local\programs\python\python38\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "c:\users\admin\appdata\local\programs\python\python38\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "c:\users\admin\appdata\local\programs\python\python38\lib\site-packages\setuptools\command\install.py", line 61, in run
return orig.install.run(self)
File "c:\users\admin\appdata\local\programs\python\python38\lib\distutils\command\install.py", line 545, in run
self.run_command('build')
File "c:\users\admin\appdata\local\programs\python\python38\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\admin\appdata\local\programs\python\python38\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "c:\users\admin\appdata\local\programs\python\python38\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "c:\users\admin\appdata\local\programs\python\python38\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\admin\appdata\local\programs\python\python38\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\Admin\AppData\Local\Temp\pip-install-fi__6w9v\dlib\setup.py", line 135, in run
self.build_extension(ext)
File "C:\Users\Admin\AppData\Local\Temp\pip-install-fi__6w9v\dlib\setup.py", line 172, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File "c:\users\admin\appdata\local\programs\python\python38\lib\subprocess.py", line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\Admin\\AppData\\Local\\Temp\\pip-install-fi__6w9v\\dlib\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\Admin\\AppData\\Local\\Temp\\pip-install-fi__6w9v\\dlib\\build\\lib.win-amd64-3.8', '-DPYTHON_EXECUTABLE=c:\\users\\admin\\appdata\\local\\programs\\python\\python38\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\Admin\\AppData\\Local\\Temp\\pip-install-fi__6w9v\\dlib\\build\\lib.win-amd64-3.8', '-A', 'x64']' returned non-zero exit status 1.
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\admin\appdata\local\programs\python\python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Admin\\AppData\\Local\\Temp\\pip-install-fi__6w9v\\dlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\Admin\\AppData\\Local\\Temp\\pip-install-fi__6w9v\\dlib\\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\Admin\AppData\Local\Temp\pip-record-f5b3pskr\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\admin\appdata\local\programs\python\python38\Include\dlib' Check the logs for full command output.
The answer is really simple. You have to do what it says. Go to the VS installer and install VS for C++ and C#. The reason is that these modules use C code and while using Visual Studio, you have to make it so that it can compile the C++ code
For those who don't want to install the entirety of Visual Studio there is an easier way to get the required CMake tools:
Step 1: Download and run Build Tools for Visual Studio 2022 https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019
Step 2: Go to Individual Components and select C++ CMake tools for Windows and run through the install.
Step 3: Proceed to build your python application (e.g. dlib)

Error Installing Dlib in Blender's Python

I am writing a Blender addon for working with 3D face scans. I want to find landmarks (the eyebrows, the corners of the eyes, the mouth line, etc.) in an image of the scanned face so I can map them to the model. The Dlib library is ideal for finding these landmarks, but I have been unable to install it in Blender's Python (so I can call it from the addon).
I had no problem installing Dlib in a standalone Python (3.6.4) version I also have installed. As a work around I am currently calling this Python from a subprocess in the addon, but this is very slow and makes the addon difficult to install on another computer.
Here is the output when I try to install Dlib with pip in Blender's Python (Blender is version 2.81 with Python 3.7.4):
C:\Program Files\Blender Foundation\Blender 2.81\2.81\python\bin> ./python -m pip install dlib --user
Collecting dlib
Using cached dlib-19.19.0.tar.gz (3.2 MB)
Installing collected packages: dlib
Running setup.py install for dlib ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Program Files\Blender Foundation\Blender 2.81\2.81\python\bin\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\David\\AppData\\Local\\Temp\\pip-install-x18bl7c_\\dlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\David\\AppData\\Local\\Temp\\pip-install-x18bl7c_\\dlib\\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\David\AppData\Local\Temp\pip-record-k5d8lob9\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\David\AppData\Roaming\Python\Python37\Include\dlib'
cwd: C:\Users\David\AppData\Local\Temp\pip-install-x18bl7c_\dlib\
Complete output (66 lines):
running install
running build
running build_py
package init file 'dlib\__init__.py' not found (or not a regular file)
running build_ext
Building extension for Python 3.7.4 (default, Aug 13 2019, 14:10:15) [MSC v.1916 64 bit (AMD64)]
Invoking CMake setup: 'cmake C:\Users\David\AppData\Local\Temp\pip-install-x18bl7c_\dlib\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\David\AppData\Local\Temp\pip-install-x18bl7c_\dlib\build\lib.win-amd64-3.7 -DPYTHON_EXECUTABLE=C:\Program Files\Blender Foundation\Blender 2.81\2.81\python\bin\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\David\AppData\Local\Temp\pip-install-x18bl7c_\dlib\build\lib.win-amd64-3.7 -A x64'
-- Building for: Visual Studio 15 2017
-- Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.18362.
-- The C compiler identification is MSVC 19.16.27030.1
-- The CXX compiler identification is MSVC 19.16.27030.1
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PythonInterp: C:/Program Files/Blender Foundation/Blender 2.81/2.81/python/bin/python.exe (found version "3.7.4")
CMake Error at C:/Users/David/AppData/Local/Temp/pip-install-x18bl7c_/dlib/dlib/external/pybind11/tools/FindPythonLibsNew.cmake:158 (message):
Python libraries not found
Call Stack (most recent call first):
C:/Users/David/AppData/Local/Temp/pip-install-x18bl7c_/dlib/dlib/external/pybind11/tools/pybind11Tools.cmake:16 (find_package)
C:/Users/David/AppData/Local/Temp/pip-install-x18bl7c_/dlib/dlib/external/pybind11/CMakeLists.txt:33 (include)
-- Configuring incomplete, errors occurred!
See also "C:/Users/David/AppData/Local/Temp/pip-install-x18bl7c_/dlib/build/temp.win-amd64-3.7/Release/CMakeFiles/CMakeOutput.log".
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\David\AppData\Local\Temp\pip-install-x18bl7c_\dlib\setup.py", line 261, in <module>
'Topic :: Software Development',
File "C:\Program Files\Blender Foundation\Blender 2.81\2.81\python\lib\site-packages\setuptools\__init__.py", line 145, in setup
return distutils.core.setup(**attrs)
File "C:\Program Files\Blender Foundation\Blender 2.81\2.81\python\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\Program Files\Blender Foundation\Blender 2.81\2.81\python\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "C:\Program Files\Blender Foundation\Blender 2.81\2.81\python\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Program Files\Blender Foundation\Blender 2.81\2.81\python\lib\site-packages\setuptools\command\install.py", line 61, in run
return orig.install.run(self)
File "C:\Program Files\Blender Foundation\Blender 2.81\2.81\python\lib\distutils\command\install.py", line 545, in run
self.run_command('build')
File "C:\Program Files\Blender Foundation\Blender 2.81\2.81\python\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Program Files\Blender Foundation\Blender 2.81\2.81\python\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Program Files\Blender Foundation\Blender 2.81\2.81\python\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "C:\Program Files\Blender Foundation\Blender 2.81\2.81\python\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Program Files\Blender Foundation\Blender 2.81\2.81\python\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\David\AppData\Local\Temp\pip-install-x18bl7c_\dlib\setup.py", line 135, in run
self.build_extension(ext)
File "C:\Users\David\AppData\Local\Temp\pip-install-x18bl7c_\dlib\setup.py", line 172, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File "C:\Program Files\Blender Foundation\Blender 2.81\2.81\python\lib\subprocess.py", line 347, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\David\\AppData\\Local\\Temp\\pip-install-x18bl7c_\\dlib\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\David\\AppData\\Local\\Temp\\pip-install-x18bl7c_\\dlib\\build\\lib.win-amd64-3.7', '-DPYTHON_EXECUTABLE=C:\\Program Files\\Blender Foundation\\Blender 2.81\\2.81\\python\\bin\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\David\\AppData\\Local\\Temp\\pip-install-x18bl7c_\\dlib\\build\\lib.win-amd64-3.7', '-A', 'x64']' returned non-zero exit status 1.
----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Program Files\Blender Foundation\Blender 2.81\2.81\python\bin\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\David\\AppData\\Local\\Temp\\pip-install-x18bl7c_\\dlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\David\\AppData\\Local\\Temp\\pip-install-x18bl7c_\\dlib\\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\David\AppData\Local\Temp\pip-record-k5d8lob9\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\David\AppData\Roaming\Python\Python37\Include\dlib' Check the logs for full command output.
While I would like to use Dlib in Blender, I am open to other methods of finding the facial landmarks in an image. Either way, I need another user of the addon (or the addon itself) to be able to install the required libraries without too much work.
In case it is helpful, here is a video demonstrating using Dlib in Blender.
Please let me know if I can clarify anything.
Thanks,
David
I encounter the same issue while trying to do some real-time face rig using blender, laptop webcam and open cv following tutorial made by Gadget Workbench (that you can find here : https://www.youtube.com/watch?v=O7nNO3FLkLU ). Here is my solution.
--> As mentionned in the Blender documentation, you shouldn't use different version of python to use modules
The Python (major, minor) version must match the one that Blender comes with. Therefor you can’t use Python 3.6 with Blender built to use Python 3.7.
They also mentionned workarounds if you need to use your OS python or add some extensions. (doc is here). You could also use Anaconda instead of a classic install of Python, to be able to switch quickly your python main version. Once you're sure you have the same python OS version than Blender packed python version, you're good to go :)
I managed to fix this error, using only the python packed with blender, by updating pip.
1- First, run the pip update command (once you're in the python folder inside your Blender installation directory):
.\python -m pip install --upgrade pip
2- Then you can install dlib
.\python -m pip install dlib
3- To verify that everything is OK, you can open your blender project, go inside the Script tab (or simply open a console pannel wherever you want in Blender) and try typing
import dlib
It should no longer raise errors inside Blender, or inside your OS console.
I would suggest running Dlib in ordinary python and storing the output co-ordinates in some other txt, csv or some image files. Then import OS module in blender-python's script and read the files made by ordinary python. In this way, you can communicate between ordinary python and blender's python. Another option is to use sys module. import sys module in blender's py script and pass arguments while invoking blender-python script from command line. Alternatively, you can also use blender's python from ordinary python. Import subprocess module in ordinary python and run your py script as subprocess. It is similar to running a script from terminal or windows cmd. Blender's python comes with basic modules like sys or OS pre-installed. You can use them to communicate with ordinary python. You would be able to gain advantages from both different versions of python.

Categories

Resources