dlib icon indicating copy to clipboard operation
dlib copied to clipboard

can't install dlib on windows 10 for python

Open semsimsom opened this issue 10 years ago • 47 comments

hi, I have windows 10 64 bit and i try and try to install dlib for python with this command: python setup.py install but i get error below: running install running bdist_egg running build Detected Python architecture: 32bit Detected platform: win32 Removing build directory C:\Users\Avatar\Desktop\dlib-master./tools/python/build Configuring cmake ... -- Building for: Visual Studio 12 2013 -- The C compiler identification is MSVC 18.0.21005.1 -- The CXX compiler identification is MSVC 18.0.21005.1 -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/cl.exe -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/cl.exe -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/cl.exe -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/cl.exe -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Could NOT find Boost -- Found PythonLibs: C:/Python27/libs/python27.lib (found suitable version "2.7.9+", minimum required is "2.6") error: cmake configuration failed!

i install cmake GUI and dont know haow can i set it. and i build from source with cmake command like in readme file: mkdir build; cd build; cmake .. ; cmake --build .

at the end i say that, i want use dlib on python . does anyone can help me???

Thanks a lot....

semsimsom avatar Sep 06 '16 06:09 semsimsom

-- Could NOT find Boost

you should download and install boost this is not a problem of dlib itself, please ask such questions on stackoverflow

e-fominov avatar Sep 06 '16 06:09 e-fominov

I have the same problem, and I have installed boost according to their setup instructions.

ShacharWeis avatar Sep 20 '16 19:09 ShacharWeis

http://dlib.net/faq.html#Whywon'tthePythonbindingscompilework

davisking avatar Sep 20 '16 20:09 davisking

Thanks. How do you actually install boost_python under windows? I can't find anything about that.

My cmake is getting these errors: Could not find the following static Boost libraries: boost_python-py34

I have python 3.4.0 installed.

ShacharWeis avatar Sep 20 '16 21:09 ShacharWeis

CMake should output some instructions that tell you what to do. There are also instructions on the boost website. Also, you can pip install dlib for the 64bit version of python 3 on windows. That's what I would do.

davisking avatar Sep 21 '16 00:09 davisking

pip install also fails. After about 6 hours of following vague and contradicting boost installation manuals, endless errors, re-installs and whatnots, I've given up on getting DLIB python compiled. My hate towards boost is now intense and all consuming.

ShacharWeis avatar Sep 21 '16 14:09 ShacharWeis

Yeah, it's annoying. Although I would place the blame for this on the python community. Compiling python modules is an unmitigated cluster fuck. There are hundreds of different possible python configurations/environments that all require slightly different build settings and are all incompatible with each other.

The pip install should work on windows. I uploaded a compiled binary for dlib for the 64bit version of the new python 3 interpreter a while ago. It should just install in a second. Although, maybe you don't have exactly that specific version of python and pip thinks it therefore needs to compile a new one.

davisking avatar Sep 21 '16 14:09 davisking

I uploaded a compiled binary for dlib for the 64bit version of the new python 3 interpreter a while ago

I haven't been able to find this. Pypi only has the source for 19.1.0; the releases for this repo are only the source. Where is the dlib binary?

valtron avatar Sep 23 '16 03:09 valtron

Huh, yeah I don't see it on pypi either. I swear I uploaded it :/

I'll look into this tomorrow.

davisking avatar Sep 23 '16 03:09 davisking

After some more snooping, I found it: https://pypi.python.org/pypi/dlib/18.17.100

valtron avatar Sep 23 '16 05:09 valtron

That's the older one. I made one for the newer version of dlib (which isn't very different if you use only python). The upload to pypi must not have worked, apparently, and I didn't check since the upload didn't indicate any obvious failure.

davisking avatar Sep 23 '16 10:09 davisking

Try "conda install -c menpo dlib"

rendicahya avatar Feb 14 '17 12:02 rendicahya

conda install -c menpo dlib worked for me, however I had to downgrade python to version 3.5

ghost avatar Apr 05 '17 08:04 ghost

I have been asked to download the dlib library on my windows system. I have followed the instructions given here: http://www.paulvangent.com/2016/08/05/emotion-recognition-using-facial-landmarks/

I have already downloaded nad install cmake, boost and Visual Studio. On the dlib folder command prompt, on running "python setup.py install" I get the problem that you can see in the picture added. dlib-problem

I have python 3.6 with conda,

ok maybe the simple solution is downgrade python to version 3.5 and :

conda install -c menpo dlib

but how I can do that?

Thanks in advance

rafa1985 avatar Apr 25 '17 08:04 rafa1985

You don't have a C++ compiler installed. You need to select C++ when you install visual studio. Also, make sure to install visual studio 2015 because visual studio 2017 is buggy and won't compile C++11 code, which is a requirement to use dlib.

davisking avatar Apr 25 '17 09:04 davisking

Thanks for your quick response davisking.

You are right, there was a problem with visual studio 2017 so I installed visual studio 2015 with c++ packs.

However now I have other problem: http://imgur.com/5DkUTJE

Has you any idea how I can solved it?

Thanks in advance

rafa1985 avatar Apr 25 '17 13:04 rafa1985

That error message literally tells you what to do.

davisking avatar Apr 25 '17 13:04 davisking

I followed that error message literally without luck. Finally I solved that problem downgrading python to version 3.5 and conda install -c menpo dlib. Thanks for the help :)

rafa1985 avatar May 02 '17 11:05 rafa1985

Try to install dlib. Get cmake and boost by pip. Already have Visual C++ Build Tools. Windows 7 x64

Get this error

$ python -m pip install dlib Collecting dlib Using cached dlib-19.4.0.tar.gz 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\Andrey\AppData\Local\Programs\Python\P ython36\python.exe -u -c "import setuptools, tokenize;file='C:\cygwin64\tm p\pip-build-_6ur7d39\dlib\setup.py';f=getattr(tokenize, 'open', open)(_file _);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'e xec'))" install --record C:\cygwin64\tmp\pip-br460pmx-record\install-record.txt --single-version-externally-managed --compile: running install running build Detected Python architecture: 64bit Detected platform: win32 Configuring cmake ... -- The C compiler identification is MSVC 19.0.23506.0 -- The CXX compiler identification is MSVC 19.0.23506.0 -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Stu dio 14.0/VC/bin/x86_amd64/cl.exe -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Stu dio 14.0/VC/bin/x86_amd64/cl.exe -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual S tudio 14.0/VC/bin/x86_amd64/cl.exe -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual S tudio 14.0/VC/bin/x86_amd64/cl.exe -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done CMake Warning at C:/Users/Andrey/AppData/Local/Programs/Python/Python36/Lib/ site-packages/cmake/data/share/cmake-3.8/Modules/FindBoost.cmake:765 (message): Imported targets not available for Boost version Call Stack (most recent call first): C:/Users/Andrey/AppData/Local/Programs/Python/Python36/Lib/site-packages/c make/data/share/cmake-3.8/Modules/FindBoost.cmake:869 (_Boost_COMPONENT_DEPENDEN CIES) C:/Users/Andrey/AppData/Local/Programs/Python/Python36/Lib/site-packages/c make/data/share/cmake-3.8/Modules/FindBoost.cmake:1472 (_Boost_MISSING_DEPENDENC IES) C:/cygwin64/tmp/pip-build-_6ur7d39/dlib/dlib/cmake_utils/add_python_module :61 (FIND_PACKAGE) CMakeLists.txt:6 (include) CMake Warning at C:/Users/Andrey/AppData/Local/Programs/Python/Python36/Lib/ site-packages/cmake/data/share/cmake-3.8/Modules/FindBoost.cmake:1536 (message): No header defined for python-py34; skipping header check Call Stack (most recent call first): C:/cygwin64/tmp/pip-build-_6ur7d39/dlib/dlib/cmake_utils/add_python_module :61 (FIND_PACKAGE) CMakeLists.txt:6 (include) -- Could NOT find Boost CMake Warning at C:/Users/Andrey/AppData/Local/Programs/Python/Python36/Lib/ site-packages/cmake/data/share/cmake-3.8/Modules/FindBoost.cmake:765 (message): Imported targets not available for Boost version Call Stack (most recent call first): C:/Users/Andrey/AppData/Local/Programs/Python/Python36/Lib/site-packages/c make/data/share/cmake-3.8/Modules/FindBoost.cmake:869 (_Boost_COMPONENT_DEPENDEN CIES) C:/Users/Andrey/AppData/Local/Programs/Python/Python36/Lib/site-packages/c make/data/share/cmake-3.8/Modules/FindBoost.cmake:1472 (_Boost_MISSING_DEPENDENC IES) C:/cygwin64/tmp/pip-build-_6ur7d39/dlib/dlib/cmake_utils/add_python_module :63 (FIND_PACKAGE) CMakeLists.txt:6 (include) CMake Warning at C:/Users/Andrey/AppData/Local/Programs/Python/Python36/Lib/ site-packages/cmake/data/share/cmake-3.8/Modules/FindBoost.cmake:1536 (message): No header defined for python-py35; skipping header check Call Stack (most recent call first): C:/cygwin64/tmp/pip-build-_6ur7d39/dlib/dlib/cmake_utils/add_python_module :63 (FIND_PACKAGE) CMakeLists.txt:6 (include) -- Could NOT find Boost CMake Warning at C:/Users/Andrey/AppData/Local/Programs/Python/Python36/Lib/ site-packages/cmake/data/share/cmake-3.8/Modules/FindBoost.cmake:765 (message): Imported targets not available for Boost version Call Stack (most recent call first): C:/Users/Andrey/AppData/Local/Programs/Python/Python36/Lib/site-packages/c make/data/share/cmake-3.8/Modules/FindBoost.cmake:869 (_Boost_COMPONENT_DEPENDEN CIES) C:/Users/Andrey/AppData/Local/Programs/Python/Python36/Lib/site-packages/c make/data/share/cmake-3.8/Modules/FindBoost.cmake:1472 (_Boost_MISSING_DEPENDENC IES) C:/cygwin64/tmp/pip-build-_6ur7d39/dlib/dlib/cmake_utils/add_python_module :66 (FIND_PACKAGE) CMakeLists.txt:6 (include) CMake Warning at C:/Users/Andrey/AppData/Local/Programs/Python/Python36/Lib/ site-packages/cmake/data/share/cmake-3.8/Modules/FindBoost.cmake:1536 (message): No header defined for python3; skipping header check Call Stack (most recent call first): C:/cygwin64/tmp/pip-build-_6ur7d39/dlib/dlib/cmake_utils/add_python_module :66 (FIND_PACKAGE) CMakeLists.txt:6 (include) -- Could NOT find Boost CMake Warning at C:/Users/Andrey/AppData/Local/Programs/Python/Python36/Lib/ site-packages/cmake/data/share/cmake-3.8/Modules/FindBoost.cmake:765 (message): Imported targets not available for Boost version Call Stack (most recent call first): C:/Users/Andrey/AppData/Local/Programs/Python/Python36/Lib/site-packages/c make/data/share/cmake-3.8/Modules/FindBoost.cmake:869 (_Boost_COMPONENT_DEPENDEN CIES) C:/Users/Andrey/AppData/Local/Programs/Python/Python36/Lib/site-packages/c make/data/share/cmake-3.8/Modules/FindBoost.cmake:1472 (_Boost_MISSING_DEPENDENC IES) C:/cygwin64/tmp/pip-build-_6ur7d39/dlib/dlib/cmake_utils/add_python_module :69 (FIND_PACKAGE) CMakeLists.txt:6 (include) -- Could NOT find Boost -- Found PythonLibs: C:/Users/Andrey/AppData/Local/Programs/Python/Python36/ libs/python36.lib (found suitable version "3.6.1", minimum required is "3.4") -- ************************************************************************ ***************************** -- We couldn't find the right version of boost python. If you installed boo st and you are still getting this error then you might have installed a version of boost that was compiled with a different version of visual studio than the on e you are using. So you have to make sure that the version of visual studio is the same version that was used to compile the copy of boost you are using. -- Set the BOOST_ROOT and BOOST_LIBRARYDIR environment variables before run ning cmake. -- E.g. Something like this: -- set BOOST_ROOT=C:\local\boost_1_57_0 -- set BOOST_LIBRARYDIR=C:\local\boost_1_57_0\stage\lib -- -- You will also likely need to compile boost yourself rather than using on e of the precompiled -- windows binaries. Do this by going to the folder tools\build\ within bo ost and running -- bootstrap.bat. Then run the command: -- b2 install -- And then add the output bin folder to your PATH. Usually this is the C: \boost-build-engine\bin -- folder. Finally, go to the boost root and run a command like this: -- b2 -a --with-python address-model=64 toolset=msvc runtime-link=static -- When it completes, set BOOST_LIBRARYDIR equal to wherever b2 put the com piled libraries. -- Note that you will need to set the address-model based on if you want a 32 or 64bit python library. -- -- Next, when you invoke cmake to compile dlib you may have to use cmake's -G option to set the -- 64 vs. 32bit mode of visual studio. Also, if you want a Python3 library you will need to -- add -DPYTHON3=1. You do this with a statement like: -- cmake -G "Visual Studio 12 2013 Win64" -DPYTHON3=1 ....\tools\python -- Rather than: -- cmake ....\tools\python -- Which will build a 32bit Python2 module by default on most systems. -- -- ************************************************************************ ***************************** CMake Error at C:/cygwin64/tmp/pip-build-6ur7d39/dlib/dlib/cmake_utils/add python_module:116 (message): Boost python library not found. Call Stack (most recent call first): CMakeLists.txt:6 (include) -- Configuring incomplete, errors occurred! See also "C:/cygwin64/tmp/pip-build-_6ur7d39/dlib/tools/python/build/CMakeFi les/CMakeOutput.log". error: cmake configuration failed!

----------------------------------------

Command "C:\Users\Andrey\AppData\Local\Programs\Python\Python36\python.exe -u -c "import setuptools, tokenize;file='C:\cygwin64\tmp\pip-build-_6ur7d39\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:\cygwin64\tmp\pip-br460pmx-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\cygwin64\tmp\pip-build-_6ur7d39\dlib\

hadaev8 avatar Jun 06 '17 20:06 hadaev8

Try "conda install -c menpo dlib"

@rendicahya, would you mind to explain how and why does it work when pip install dlib doesn't? I mean: what else happens when I use conda instead of pip and what is menpo?

piotrek-k avatar Jun 18 '17 16:06 piotrek-k