failing to install dlib on windows 10 [duplicate] - python

This question already has answers here:
dlib installation on Windows 10
(19 answers)
Closed 3 months ago.
Trying to install dlib on Windows 10 using pycharm package manager.
I have Numpy, opencv-python, setuptools and wheel installed.
tried installing dlib then got the first error asking me to install CMake.
Now I'm getting this:
(tried installing visual studio but it had no effect).
Collecting dlib Using cached https://files.pythonhosted.org/packages/d5/5c/aa64510aa354d562ecba7edecd500b020280741140e5d91ff5ec1c6f8289/dlib-19.13.1.tar.gz Building wheels for collected packages: dlib Running setup.py bdist_wheel for dlib: started Running setup.py bdist_wheel for dlib: finished with status 'error' Complete output from command C:\Users\Tom\venv\Scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Tom\\AppData\\Local\\Temp\\pycharm-packaging\\dlib\\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\Tom\AppData\Local\Temp\pip-wheel-f_njkl2_ --python-tag cp36: running bdist_wheel running build running build_py package init file 'dlib\__init__.py' not found (or not a regular file) warning: build_py: byte-compiling is disabled, skipping.
running build_ext Building extension for Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 16:07:46) [MSC v.1900 32 bit (Intel)] Invoking CMake setup: 'cmake C:\Users\Tom\AppData\Local\Temp\pycharm-packaging\dlib\tools\python
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\Tom\AppData\Local\Temp\pycharm-packaging\dlib\build\lib.win32-3.6
-DPYTHON_EXECUTABLE=C:\Users\Tom\venv\Scripts\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\Tom\AppData\Local\Temp\pycharm-packaging\dlib\build\lib.win32-3.6'
-- Building for: NMake Makefiles -- The C compiler identification is unknown -- The CXX compiler identification is unknown CMake Error in CMakeLists.txt:
The CMAKE_C_COMPILER:
cl
is not a full path and was not found in the PATH.
To use the NMake generator with Visual C++, cmake must be run from a shell
that can use the compiler cl from the command line. This environment is
unable to invoke the cl compiler. To fix this problem, run cmake from the
Visual Studio Command Prompt (vcvarsall.bat).
Tell CMake where to find the compiler by setting either the environment
variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
the compiler, or to the compiler name if it is in the PATH.
CMake Error in CMakeLists.txt:
The CMAKE_CXX_COMPILER:
cl
is not a full path and was not found in the PATH.
To use the NMake generator with Visual C++, cmake must be run from a shell
that can use the compiler cl from the command line. This environment is
unable to invoke the cl compiler. To fix this problem, run cmake from the
Visual Studio Command Prompt (vcvarsall.bat).
Tell CMake where to find the compiler by setting either the environment
variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
to the compiler, or to the compiler name if it is in the PATH.
-- Configuring incomplete, errors occurred! See also "C:/Users/Tom/AppData/Local/Temp/pycharm-packaging/dlib/build/temp.win32-3.6/Release/CMakeFiles/CMakeOutput.log". See also "C:/Users/Tom/AppData/Local/Temp/pycharm-packaging/dlib/build/temp.win32-3.6/Release/CMakeFiles/CMakeError.log". Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\Tom\AppData\Local\Temp\pycharm-packaging\dlib\setup.py", line 256, in <module>
'Topic :: Software Development',
File "C:\Users\Tom\venv\lib\site-packages\setuptools-39.1.0-py3.6.egg\setuptools\__init__.py", line 129, in setup
File "C:\Users\Tom\AppData\Local\Programs\Python\Python36-32\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\Users\Tom\AppData\Local\Programs\Python\Python36-32\lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "C:\Users\Tom\AppData\Local\Programs\Python\Python36-32\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Users\Tom\venv\lib\site-packages\wheel\bdist_wheel.py", line 202, in run
self.run_command('build')
File "C:\Users\Tom\AppData\Local\Programs\Python\Python36-32\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Users\Tom\AppData\Local\Programs\Python\Python36-32\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Users\Tom\AppData\Local\Programs\Python\Python36-32\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "C:\Users\Tom\AppData\Local\Programs\Python\Python36-32\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Users\Tom\AppData\Local\Programs\Python\Python36-32\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Users\Tom\AppData\Local\Temp\pycharm-packaging\dlib\setup.py", line 133, in run
self.build_extension(ext)
File "C:\Users\Tom\AppData\Local\Temp\pycharm-packaging\dlib\setup.py", line 169, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File "C:\Users\Tom\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py", line 291, in check_call
raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\Tom\\AppData\\Local\\Temp\\pycharm-packaging\\dlib\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\Tom\\AppData\\Local\\Temp\\pycharm-packaging\\dlib\\build\\lib.win32-3.6', '-DPYTHON_EXECUTABLE=C:\\Users\\Tom\\venv\\Scripts\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\Tom\\AppData\\Local\\Temp\\pycharm-packaging\\dlib\\build\\lib.win32-3.6']' returned non-zero exit status 1.
---------------------------------------- Running setup.py clean for dlib Failed to build dlib Installing collected packages: dlib Running setup.py install for dlib: started
Running setup.py install for dlib: finished with status 'error'
Complete output from command C:\Users\Tom\venv\Scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Tom\\AppData\\Local\\Temp\\pycharm-packaging\\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\Tom\AppData\Local\Temp\pip-record-1kold5c8\install-record.txt
--single-version-externally-managed --compile --install-headers C:\Users\Tom\venv\include\site\python3.6\dlib:
running install
running build
running build_py
package init file 'dlib\__init__.py' not found (or not a regular file)
warning: build_py: byte-compiling is disabled, skipping.
running build_ext
Building extension for Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 16:07:46) [MSC v.1900 32 bit (Intel)]
Invoking CMake setup: 'cmake C:\Users\Tom\AppData\Local\Temp\pycharm-packaging\dlib\tools\python
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\Tom\AppData\Local\Temp\pycharm-packaging\dlib\build\lib.win32-3.6
-DPYTHON_EXECUTABLE=C:\Users\Tom\venv\Scripts\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\Tom\AppData\Local\Temp\pycharm-packaging\dlib\build\lib.win32-3.6'
-- Building for: NMake Makefiles
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error in CMakeLists.txt:
The CMAKE_C_COMPILER:
cl
is not a full path and was not found in the PATH.
To use the NMake generator with Visual C++, cmake must be run from a shell
that can use the compiler cl from the command line. This environment is
unable to invoke the cl compiler. To fix this problem, run cmake from the
Visual Studio Command Prompt (vcvarsall.bat).
Tell CMake where to find the compiler by setting either the environment
variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
the compiler, or to the compiler name if it is in the PATH.
CMake Error in CMakeLists.txt:
The CMAKE_CXX_COMPILER:
cl
is not a full path and was not found in the PATH.
To use the NMake generator with Visual C++, cmake must be run from a shell
that can use the compiler cl from the command line. This environment is
unable to invoke the cl compiler. To fix this problem, run cmake from the
Visual Studio Command Prompt (vcvarsall.bat).
Tell CMake where to find the compiler by setting either the environment
variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
to the compiler, or to the compiler name if it is in the PATH.
-- Configuring incomplete, errors occurred!
See also "C:/Users/Tom/AppData/Local/Temp/pycharm-packaging/dlib/build/temp.win32-3.6/Release/CMakeFiles/CMakeOutput.log".
See also "C:/Users/Tom/AppData/Local/Temp/pycharm-packaging/dlib/build/temp.win32-3.6/Release/CMakeFiles/CMakeError.log".
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\Tom\AppData\Local\Temp\pycharm-packaging\dlib\setup.py", line 256, in <module>
'Topic :: Software Development',
File "C:\Users\Tom\venv\lib\site-packages\setuptools-39.1.0-py3.6.egg\setuptools\__init__.py", line 129, in setup
File "C:\Users\Tom\AppData\Local\Programs\Python\Python36-32\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\Users\Tom\AppData\Local\Programs\Python\Python36-32\lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "C:\Users\Tom\AppData\Local\Programs\Python\Python36-32\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Users\Tom\venv\lib\site-packages\setuptools-39.1.0-py3.6.egg\setuptools\command\install.py", line 61, in run
File "C:\Users\Tom\AppData\Local\Programs\Python\Python36-32\lib\distutils\command\install.py", line 545, in run
self.run_command('build')
File "C:\Users\Tom\AppData\Local\Programs\Python\Python36-32\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Users\Tom\AppData\Local\Programs\Python\Python36-32\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Users\Tom\AppData\Local\Programs\Python\Python36-32\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "C:\Users\Tom\AppData\Local\Programs\Python\Python36-32\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Users\Tom\AppData\Local\Programs\Python\Python36-32\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Users\Tom\AppData\Local\Temp\pycharm-packaging\dlib\setup.py", line 133, in run
self.build_extension(ext)
File "C:\Users\Tom\AppData\Local\Temp\pycharm-packaging\dlib\setup.py", line 169, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File "C:\Users\Tom\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py", line 291, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\Tom\\AppData\\Local\\Temp\\pycharm-packaging\\dlib\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\Tom\\AppData\\Local\\Temp\\pycharm-packaging\\dlib\\build\\lib.win32-3.6', '-DPYTHON_EXECUTABLE=C:\\Users\\Tom\\venv\\Scripts\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\Tom\\AppData\\Local\\Temp\\pycharm-packaging\\dlib\\build\\lib.win32-3.6']' returned non-zero exit status 1.
----------------------------------------
Failed building wheel for dlib Command "C:\Users\Tom\venv\Scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Tom\\AppData\\Local\\Temp\\pycharm-packaging\\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\Tom\AppData\Local\Temp\pip-record-1kold5c8\install-record.txt
--single-version-externally-managed --compile --install-headers C:\Users\Tom\venv\include\site\python3.6\dlib" failed with error code 1 in C:\Users\Tom\AppData\Local\Temp\pycharm-packaging\dlib\
What am I missing here?
I'm really baffled.

pip install https://pypi.python.org/packages/da/06/bd3e241c4eb0a662914b3b4875fc52dd176a9db0d4a2c915ac2ad8800e9e/dlib-19.7.0-cp36-cp36m-win_amd64.whl#md5=b7330a5b2d46420343fbed5df69e6a3f
Try this cmd command, it worked for me

I have followed below steps to install face_recognition (dlib):-
Re-installed Python 3.6.6 (https://www.python.org/ftp/python/3.6.6/python-3.6.6-amd64.exe).
pip3 install cmake
pip3 install dlib
pip3 install face_recognition
It worked for me.

If you have conda installed in your system then follow these steps:
conda create -n py36 python=3.6
activate py36
conda config --add channels conda-forge
conda install numpy
conda install scipy
conda install dlib

I know this question is for windows, But by chance if someone is looking for solution for this on Mac,
Try this command, worked for me
pip install https://files.pythonhosted.org/packages/05/57/e8a8caa3c89a27f80bc78da39c423e2553f482a3705adc619176a3a24b36/dlib-19.17.0.tar.gz#SHA256=92587c81b0165e933593f505fdf099dface0d0f8ec874b1d8655fc774598911f

if you have installed Visual Studio, you need to make sure that you have selected Clang tools
Also use command Prompt (cmd) and be patient when pip install dlib it will take more than 5 min to be compiled

Please follow the below steps:
install Python version you like
install cmake from https://cmake.org/download/ and add it to the path when install it
install visual studio from https://visualstudio.microsoft.com/visual-cpp-build-tools, then go to modify -> individual components -> choose the following:
(MSBuild/MSVC v142 - VS 2019 C++ x64/x86 build tools (v14.27)/C++ 2019 Redistributable Update/C++ CMake tools for Windows/C++/CLI support for v142 build tools (14.27)/C++ Clang-cl for v142 build tools (x64/x86)/C++ Clang Compiler for Windows (10.0.0)/Windows Universal CRT SDK/MSVC v140 - VS 2015 C++ build tools (v14.00)/Windows 10 SDK (10.0.19041.0)/C++ 2019 Redistributable MSMs))
open the visual studio and create new project as cmake c++
you will be prompt to update the windows 10 sdk after building the project
install updates for SDK
go to windows terminal
pip install dlib
this works perfectly for me.
Thanks

The error is telling you the answer. The CMAKE_C_COMPILER:
cl
is not a full path and was not found in the PATH.
To use the NMake generator with Visual C++, cmake must be run from a shell
that can use the compiler cl from the command line. This environment is
unable to invoke the cl compiler. To fix this problem, run cmake from the
Visual Studio Command Prompt (vcvarsall.bat)."
Try to compile using the Visual Studio command prompt. The path to it there should be correct too.

The best method to install dlib and openCV is given here.
It simply uses pip to perform all the installations.
The major things that people miss or do a mistake in for Windows are declaring the PATH variables and saving them to valid address in your pc apart from the proper version matching. The above blog clearly signifies the versions to be used and declarations of PATH variables.
Just a 3 step process:-
Install anaconda
Activate Virtual Environment
Install openCV and dlib using pip (or any other required packages)

Linux error solution
$ sudo apt-get install build-essential cmake
$ sudo apt-get install libgtk-3-dev
$ sudo apt-get install libboost-all-dev
$ pip3 install dilb

Use the following code in the terminal which is accessible through Alt+F12 on your keyboard.
pip install dlib==19.8.1
You should be good to go.

Related

Error with Dlib installation for python on windows 10

I'm trying to install dlib. I followed every single tip on the internet but its just not working.
I'm using/tried
windows 10
cmake 3.21.4 (it's on path)
python 3.8.12 and 3.6.4
conda 4.10.3
pip 21.3.1
visual studio 2019
components in vs (1)
components in vs (2)
I have conda and pip installed, tried both with
pip install dlib
pip install dlib --verbose
pip install "some urls"
conda install -c conda-forge dlib
conda install -c conda-forge/label/cf201901 dlib
The error I'm getting is:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\sophi\AppData\Local\Temp\pip-install-3w7lgrlb\dlib_ffabe5e6a08e472b835f598e7803e3d4\setup.py", line 222, in <module>
setup(
File "c:\users\sophi\anaconda3\lib\site-packages\setuptools\__init__.py", line 159, in setup
return distutils.core.setup(**attrs)
File "c:\users\sophi\anaconda3\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "c:\users\sophi\anaconda3\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "c:\users\sophi\anaconda3\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "c:\users\sophi\anaconda3\lib\site-packages\setuptools\command\install.py", line 68, in run
return orig.install.run(self)
File "c:\users\sophi\anaconda3\lib\distutils\command\install.py", line 545, in run
self.run_command('build')
File "c:\users\sophi\anaconda3\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\sophi\anaconda3\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "c:\users\sophi\anaconda3\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "c:\users\sophi\anaconda3\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\sophi\anaconda3\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\sophi\AppData\Local\Temp\pip-install-3w7lgrlb\dlib_ffabe5e6a08e472b835f598e7803e3d4\setup.py", line 134, in run
self.build_extension(ext)
File "C:\Users\sophi\AppData\Local\Temp\pip-install-3w7lgrlb\dlib_ffabe5e6a08e472b835f598e7803e3d4\setup.py", line 174, in build_extension
subprocess.check_call(cmake_build, cwd=build_folder)
File "c:\users\sophi\anaconda3\lib\subprocess.py", line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--config', 'Release', '--', '/m']' returned non-zero exit status 1.
Running setup.py install for dlib ... error
ERROR: Command errored out with exit status 1: 'c:\users\sophi\anaconda3\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\sophi\\AppData\\Local\\Temp\\pip-install-3w7lgrlb\\dlib_ffabe5e6a08e472b835f598e7803e3d4\\setup.py'"'"'; __file__='"'"'C:\\Users\\sophi\\AppData\\Local\\Temp\\pip-install-3w7lgrlb\\dlib_ffabe5e6a08e472b835f598e7803e3d4\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\sophi\AppData\Local\Temp\pip-record-kvd3vwdq\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\sophi\anaconda3\Include\dlib' Check the logs for full command output.
For me, it seems like the problem is somethin with the cmake command, but I have no idea what the exact problem is. I used pip install cmake and installed cmake from source, none of both worked.
Has anyone an idea how to solve this?
This may be late response but I was facing the exact same issue when trying to install dlib on visual studio code. This was my error I was receiving when trying to run the command "pip install dlib"
Collecting dlib
Using cached dlib-19.23.1.tar.gz (7.4 MB)
Preparing metadata (setup.py) ... done
Using legacy 'setup.py install' for dlib, since package 'wheel' is not installed.
Installing collected packages: dlib
Running setup.py install for dlib ... error
error: subprocess-exited-with-error
× Running setup.py install for dlib did not run successfully.
│ exit code: 1
╰─> [8 lines of output]
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
ERROR: CMake must be installed to build dlib
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> dlib
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
So my next approach was to install cmake which where the installation worked however I receive a warning that the file path to the exe was not added to my path. This resulted when running "cmake --version" to outputted in terminal
'cmake' is not recognized as an internal or external command,
operable program or batch file.
I would suspected to not run correctly, and to fix this I simply copy the path that it had printed out to my terminal after install cmake and went to
Advance System Settings -> Advanced Tab -> Environment Variables -> User Variables for 'your desktop name' open up "Path" -> click on new -> paste path
After following those steps running the command "cmake --version" correctly printed out the version install, meaning it is accessing the correct path. After that "pip install dlib" worked perfectly as proof below
Collecting dlib
Using cached dlib-19.23.1.tar.gz (7.4 MB)
Preparing metadata (setup.py) ... done
Using legacy 'setup.py install' for dlib, since package 'wheel' is not installed.
Installing collected packages: dlib
Running setup.py install for dlib ... done
Successfully installed dlib-19.23.1
I hope this may help as it is one approach that worked for me in installing dlib. As you mention your cmake is on path I would check by running the command to see if the version is correctly printing out.
Althoug trying to test every combination of the commands mentioned in my question, there apparently was one combination I didn't try:
Conda environment with python 3.6.4 and then
conda install -c conda-forge dlib
Not able to install dlib on Windows 10 and Python 3.7
As Berkay is mentioning, anaconda apparently requires python <=3.6.x, which solved it for me.
! pip install dlib would not work in this environment (probably because of another version problem with this environment) !

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 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.

getting Error in installing Dlib using pip

C:\Users\suraj>pip install dlib
Collecting dlib
Using cached https://files.pythonhosted.org/packages/35/8d/e4ddf60452e2fb1ce3164f774e68968b3f110f1cb4cd353235d56875799e/dlib-19.16.0.tar.gz
Building wheels for collected packages: dlib
Running setup.py bdist_wheel for dlib ... error
Complete output from command c:\users\suraj\appdata\local\programs\python\python37\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\suraj\\AppData\\Local\\Temp\\pip-install-ytzp5t26\\dlib\\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\suraj\AppData\Local\Temp\pip-wheel-mu6pctca --python-tag cp37:
running bdist_wheel
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.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 23:09:28) [MSC v.1916 64 bit (AMD64)]
Invoking CMake setup: 'cmake C:\Users\suraj\AppData\Local\Temp\pip-install-ytzp5t26\dlib\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\suraj\AppData\Local\Temp\pip-install-ytzp5t26\dlib\build\lib.win-amd64-3.7 -DPYTHON_EXECUTABLE=c:\users\suraj\appdata\local\programs\python\python37\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\suraj\AppData\Local\Temp\pip-install-ytzp5t26\dlib\build\lib.win-amd64-3.7 -A x64'
-- Building for: NMake Makefiles
CMake Error in CMakeLists.txt:
Generator
NMake Makefiles
**does not support platform specification, but platform
x64**
was specified.
**CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage**
-- Configuring incomplete, errors occurred!
See also "C:/Users/suraj/AppData/Local/Temp/pip-install-ytzp5t26/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\suraj\AppData\Local\Temp\pip-install-ytzp5t26\dlib\setup.py", line 257, in <module>
'Topic :: Software Development',
File "c:\users\suraj\appdata\local\programs\python\python37\lib\site-packages\setuptools\__init__.py", line 143, in setup
return distutils.core.setup(**attrs)
File "c:\users\suraj\appdata\local\programs\python\python37\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "c:\users\suraj\appdata\local\programs\python\python37\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "c:\users\suraj\appdata\local\programs\python\python37\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "c:\users\suraj\appdata\local\programs\python\python37\lib\site-packages\wheel\bdist_wheel.py", line 188, in run
self.run_command('build')
File "c:\users\suraj\appdata\local\programs\python\python37\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\suraj\appdata\local\programs\python\python37\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "c:\users\suraj\appdata\local\programs\python\python37\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "c:\users\suraj\appdata\local\programs\python\python37\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\suraj\appdata\local\programs\python\python37\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\suraj\AppData\Local\Temp\pip-install-ytzp5t26\dlib\setup.py", line 133, in run
self.build_extension(ext)
File "C:\Users\suraj\AppData\Local\Temp\pip-install-ytzp5t26\dlib\setup.py", line 170, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File "c:\users\suraj\appdata\local\programs\python\python37\lib\subprocess.py", line 347, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\suraj\\AppData\\Local\\Temp\\pip-install-ytzp5t26\\dlib\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\suraj\\AppData\\Local\\Temp\\pip-install-ytzp5t26\\dlib\\build\\lib.win-amd64-3.7', '-DPYTHON_EXECUTABLE=c:\\users\\suraj\\appdata\\local\\programs\\python\\python37\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\suraj\\AppData\\Local\\Temp\\pip-install-ytzp5t26\\dlib\\build\\lib.win-amd64-3.7', '-A', 'x64']' returned non-zero exit status 1.
----------------------------------------
**Failed building wheel for dlib**
Running setup.py clean for dlib
Failed to build dlib
Installing collected packages: dlib
Running setup.py install for dlib ... error
Complete output from command c:\users\suraj\appdata\local\programs\python\python37\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\suraj\\AppData\\Local\\Temp\\pip-install-ytzp5t26\\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\suraj\AppData\Local\Temp\pip-record-adx5_t4v\install-record.txt --single-version-externally-managed --compile:
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.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 23:09:28) [MSC v.1916 64 bit (AMD64)]
Invoking CMake setup: 'cmake C:\Users\suraj\AppData\Local\Temp\pip-install-ytzp5t26\dlib\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\suraj\AppData\Local\Temp\pip-install-ytzp5t26\dlib\build\lib.win-amd64-3.7 -DPYTHON_EXECUTABLE=c:\users\suraj\appdata\local\programs\python\python37\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\suraj\AppData\Local\Temp\pip-install-ytzp5t26\dlib\build\lib.win-amd64-3.7 -A x64'
-- Building for: NMake Makefiles
CMake Error in CMakeLists.txt:
Generator
NMake Makefiles
does not support platform specification, but platform
x64
was specified.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
See also "C:/Users/suraj/AppData/Local/Temp/pip-install-ytzp5t26/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\suraj\AppData\Local\Temp\pip-install-ytzp5t26\dlib\setup.py", line 257, in <module>
'Topic :: Software Development',
File "c:\users\suraj\appdata\local\programs\python\python37\lib\site-packages\setuptools\__init__.py", line 143, in setup
return distutils.core.setup(**attrs)
File "c:\users\suraj\appdata\local\programs\python\python37\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "c:\users\suraj\appdata\local\programs\python\python37\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "c:\users\suraj\appdata\local\programs\python\python37\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "c:\users\suraj\appdata\local\programs\python\python37\lib\site-packages\setuptools\command\install.py", line 61, in run
return orig.install.run(self)
File "c:\users\suraj\appdata\local\programs\python\python37\lib\distutils\command\install.py", line 545, in run
self.run_command('build')
File "c:\users\suraj\appdata\local\programs\python\python37\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\suraj\appdata\local\programs\python\python37\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "c:\users\suraj\appdata\local\programs\python\python37\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "c:\users\suraj\appdata\local\programs\python\python37\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "c:\users\suraj\appdata\local\programs\python\python37\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\suraj\AppData\Local\Temp\pip-install-ytzp5t26\dlib\setup.py", line 133, in run
self.build_extension(ext)
File "C:\Users\suraj\AppData\Local\Temp\pip-install-ytzp5t26\dlib\setup.py", line 170, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File "c:\users\suraj\appdata\local\programs\python\python37\lib\subprocess.py", line 347, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\suraj\\AppData\\Local\\Temp\\pip-install-ytzp5t26\\dlib\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\suraj\\AppData\\Local\\Temp\\pip-install-ytzp5t26\\dlib\\build\\lib.win-amd64-3.7', '-DPYTHON_EXECUTABLE=c:\\users\\suraj\\appdata\\local\\programs\\python\\python37\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\suraj\\AppData\\Local\\Temp\\pip-install-ytzp5t26\\dlib\\build\\lib.win-amd64-3.7', '-A', 'x64']' returned non-zero exit status 1.
----------------------------------------
Command "c:\users\suraj\appdata\local\programs\python\python37\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\suraj\\AppData\\Local\\Temp\\pip-install-ytzp5t26\\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\suraj\AppData\Local\Temp\pip-record-adx5_t4v\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\suraj\AppData\Local\Temp\pip-install-ytzp5t26\dlib\
This is the Error I'm getting while installing dlib using pip in command prompt.
I already have openCV and matplotlib and numpy.
I faced the same problem a while back. I did a few things and it worked
Install C and C++ compilers and add them to path.
Install visual studio 2015 (VS2015) down-loader. (any other version might not work). This stack overflow thread may help: How to download Visual Studio Community Edition 2015 (not 2017)
Install all the dependencies through VS2015.(support for C, C++, MS Build, windows SDK etc)
Try and use pip install dlib again.
I hope this helps!
For those who are facing the same problem but using mac OS --> I did the below steps and resolved the same issue. I have macOS Big Sur 11.1 with python 3.8.3.
pip3 install cmake
pip3 install dlib
OK for the record here: On debian 10. pip install dlib fails even with pip install cmake first. Solution? sudo apt install libopenblas-dev. The output of pip install dlib --verbose mentions it as an optional install that makes your code run faster. Turns out without installing this first the install fails every time. With it the install succeeds.
download cmake executable file on your pc, install it and install cmake build tools for c++ from visual studio build tools. After installing cmake with visual studio build tools, you can download the wheel file from this github repo: https://github.com/Tobyyosoba777/Computer-Vision-OpenCv-Python-/tree/main/Libraries
download: dlib-19.22.99-cp39-cp39-win_amd64.whl
and download: dlib-19.22.99.win-amd64-py3.9.exe
install the .exe file on your pc, restart it(not necessary) and open the current directory of the downloaded .whl file where it is saved on your pc in your python/anaconda terminal/ cmd
for example:
C:\Users\USER->cd desktop "if you downloaded the file to your desktop" this command will move you to the current directory of the .whl file
then input: "pip install dlib-19.22.99-cp39-cp39-win_amd64.whl"
that should work...hopefully
You may need to install cmake first: "pip install cmake"
Then install dlib i.e: "pip install dlib".
Will surely work 100%.
Note: You must have a fast processor for building wheel else it'll take more than 5mins.
I faced many error while installing dlib and solve by using below .whl:
pip install https://pypi.python.org/packages/da/06/bd3e241c4eb0a662914b3b4875fc52dd176a9db0d4a2c915ac2ad8800e9e/dlib-19.7.0-cp36-cp36m-win_amd64.whl#md5=b7330a5b2d46420343fbed5df69e6a3f
Download wheel from this link
This might help :)

Error during installation of Dlib library on Windows 10 computer

i have a problem about building dlib library on my computer which has windows 10 OS.
Here is my python version :
C:\Windows\system32>python --version
Python 3.7.0
Here is my pip version :
C:\Windows\system32>pip --version
pip 10.0.1 from C:\ProgramData\Anaconda3\lib\site-packages\pip (python 3.7)
I am trying to download and build the dlib as below :
pip install --trusted-host pypi.python.org --trusted-host files.pythonhosted.org --trusted-host pypi.org --user dlib
The problem starts when pip finished the downloading. After the downloading completes, I get an error message as below which makes me cannot understand what is the actual problem.
NOTE 1 : I already downloaded Anaconda but it also did not solve my problem.
NOTE 2 : As an advice from some Github pages, i also tried the following command but it gave the same error, unfortunately.
pip install --trusted-host pypi.python.org --trusted-host >files.pythonhosted.org --trusted-host pypi.org --user --no-cache-dir >face_recognition
Downloading https://files.pythonhosted.org/packages/35/8d/e4ddf60452e2fb1ce3164f774e68968b3f110f1cb4cd353235d56875799e/dlib-19.16.0.tar.gz (3.3MB)
100% |████████████████████████████████| 3.3MB 159kB/s
Building wheels for collected packages: dlib
Running setup.py bdist_wheel for dlib ... error
Complete output from command C:\ProgramData\Anaconda3\python.exe -u -c "import setuptools, tokenize;file='C:\Users\arslanom\AppData\Local\Temp\pip-install-2r99u3rh\dlib\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\arslanom\AppData\Local\Temp\pip-wheel-4nl02lnx --python-tag cp37:
running bdist_wheel
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.0 (default, Jun 28 2018, 08:04:48) [MSC v.1912 64 bit (AMD64)]
Invoking CMake setup: 'cmake C:\Users\arslanom\AppData\Local\Temp\pip-install-2r99u3rh\dlib\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\arslanom\AppData\Local\Temp\pip-install-2r99u3rh\dlib\build\lib.win-amd64-3.7 -DPYTHON_EXECUTABLE=C:\ProgramData\Anaconda3\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\arslanom\AppData\Local\Temp\pip-install-2r99u3rh\dlib\build\lib.win-amd64-3.7 -A x64'
-- Building for: NMake Makefiles
CMake Error in CMakeLists.txt:
Generator
NMake Makefiles
does not support platform specification, but platform
x64
was specified.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
See also "C:/Users/arslanom/AppData/Local/Temp/pip-install-2r99u3rh/dlib/build/temp.win-amd64-3.7/Release/CMakeFiles/CMakeOutput.log".
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\arslanom\AppData\Local\Temp\pip-install-2r99u3rh\dlib\setup.py", line 257, in
'Topic :: Software Development',
File "C:\ProgramData\Anaconda3\lib\site-packages\setuptools__init__.py", line 140, in setup
return distutils.core.setup(**attrs)
File "C:\ProgramData\Anaconda3\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\ProgramData\Anaconda3\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "C:\ProgramData\Anaconda3\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\ProgramData\Anaconda3\lib\site-packages\wheel\bdist_wheel.py", line 202, in run
self.run_command('build')
File "C:\ProgramData\Anaconda3\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\ProgramData\Anaconda3\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\ProgramData\Anaconda3\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "C:\ProgramData\Anaconda3\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\ProgramData\Anaconda3\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\arslanom\AppData\Local\Temp\pip-install-2r99u3rh\dlib\setup.py", line 133, in run
self.build_extension(ext)
File "C:\Users\arslanom\AppData\Local\Temp\pip-install-2r99u3rh\dlib\setup.py", line 170, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File "C:\ProgramData\Anaconda3\lib\subprocess.py", line 328, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\Users\arslanom\AppData\Local\Temp\pip-install-2r99u3rh\dlib\tools\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\arslanom\AppData\Local\Temp\pip-install-2r99u3rh\dlib\build\lib.win-amd64-3.7', '-DPYTHON_EXECUTABLE=C:\ProgramData\Anaconda3\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\arslanom\AppData\Local\Temp\pip-install-2r99u3rh\dlib\build\lib.win-amd64-3.7', '-A', 'x64']' returned non-zero exit status 1.
Failed building wheel for dlib
Running setup.py clean for dlib
Failed to build dlib
Installing collected packages: dlib
Running setup.py install for dlib ... error
Complete output from command C:\ProgramData\Anaconda3\python.exe -u -c "import setuptools, tokenize;file='C:\Users\arslanom\AppData\Local\Temp\pip-install-2r99u3rh\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\arslanom\AppData\Local\Temp\pip-record-5t8l4109\install-record.txt --single-version-externally-managed --compile --user --prefix=:
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.0 (default, Jun 28 2018, 08:04:48) [MSC v.1912 64 bit (AMD64)]
Invoking CMake setup: 'cmake C:\Users\arslanom\AppData\Local\Temp\pip-install-2r99u3rh\dlib\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\arslanom\AppData\Local\Temp\pip-install-2r99u3rh\dlib\build\lib.win-amd64-3.7 -DPYTHON_EXECUTABLE=C:\ProgramData\Anaconda3\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\arslanom\AppData\Local\Temp\pip-install-2r99u3rh\dlib\build\lib.win-amd64-3.7 -A x64'
-- Building for: NMake Makefiles
CMake Error in CMakeLists.txt:
Generator
NMake Makefiles
does not support platform specification, but platform
x64
was specified.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
See also "C:/Users/arslanom/AppData/Local/Temp/pip-install-2r99u3rh/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\arslanom\AppData\Local\Temp\pip-install-2r99u3rh\dlib\setup.py", line 257, in <module>
'Topic :: Software Development',
File "C:\ProgramData\Anaconda3\lib\site-packages\setuptools\__init__.py", line 140, in setup
return distutils.core.setup(**attrs)
File "C:\ProgramData\Anaconda3\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\ProgramData\Anaconda3\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "C:\ProgramData\Anaconda3\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\ProgramData\Anaconda3\lib\site-packages\setuptools\command\install.py", line 61, in run
return orig.install.run(self)
File "C:\ProgramData\Anaconda3\lib\distutils\command\install.py", line 545, in run
self.run_command('build')
File "C:\ProgramData\Anaconda3\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\ProgramData\Anaconda3\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\ProgramData\Anaconda3\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "C:\ProgramData\Anaconda3\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\ProgramData\Anaconda3\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\arslanom\AppData\Local\Temp\pip-install-2r99u3rh\dlib\setup.py", line 133, in run
self.build_extension(ext)
File "C:\Users\arslanom\AppData\Local\Temp\pip-install-2r99u3rh\dlib\setup.py", line 170, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File "C:\ProgramData\Anaconda3\lib\subprocess.py", line 328, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\arslanom\\AppData\\Local\\Temp\\pip-install-2r99u3rh\\dlib\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\arslanom\\AppData\\Local\\Temp\\pip-install-2r99u3rh\\dlib\\build\\lib.win-amd64-3.7', '-DPYTHON_EXECUTABLE=C:\\ProgramData\\Anaconda3\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\arslanom\\AppData\\Local\\Temp\\pip-install-2r99u3rh\\dlib\\build\\lib.win-amd64-3.7', '-A', 'x64']' returned non-zero exit status 1.
Failed building wheels means that, naively dlib is constructed on c++. Soo for it to be converted to python you'll need Microsoft visual studio c++ package to build the wheel files
Below steps I used to install Dlib on Windows:
Pre-Requisite:
1) Install Python 3.6 64-bit. If you have Python 32-bit, you need to install Python 3.6 64-bit. Please note, you can not have both Python versions running at same time. If you are intended to run Python 3.6 64-bit, then you need keep Python 3.6 library paths at first position in System and User environment paths.
Visit this tutorial for more info on switching between python versions: Tutorial on switching between Python Versions
2) Install cmake library:
Click link – Cmake Installer and install Cmake. Otherwise, open CMD: install cmake library using pip: pip install cmake
Give path of cmake library in System Environment Path and User Path.
e.g. C:\Program Files\CMake\bin
In your case it could be different.
3) Install Visual Studio C++ Build Tools:
Follow this tutorial to install C++ build tools: Tutorial to install C++ Build Tools
It is essential to install C++ compiler to install dlib library
4) Install Numpy library: pip install numpy
After successful installation of above libraries/tools, open CMD with “Run as Administrator”. Then give command “pip install dlib”
It will install dlib library and it will take time to install. If you have some previous versions of dlib then uninstall them first.
Be patient as it takes lot of time to install this library and also many other ML libraries.
I successfully installed dlib 19.8.1 on Python 3.7 for windows 64bit using
https://www.file-upload.com/qsd69ajuqr2i
I have faced these problems too. You need to install Python 3.6 or 3.7 .
Before that you have to install cmake and set up visual studio as c++ desktop development then install dlib

Categories

Resources