26

I want to install dlib using pip install dlib using cmd in windows 10 But it is showing following three errors: 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

INFORMATION: pip 9.0.1 from d:\python36\lib\site-packages (python 3.6) cmake 0.9.0 windows 10 pro(64-bit) Version: 10.0.16299 Build 16299

Owase Sayyad
  • 300
  • 1
  • 3
  • 8
  • Add by editing to your question version info of python, pip, cmake and win10: e.g.command-line: `pip -V` gives pip and python info. – ZF007 Feb 05 '18 at 14:14
  • pip 9.0.1 from d:\python36\lib\site-packages (python 3.6) cmake 0.9.0 windows 10 pro(64-bit) Version: 10.0.16299 Build 16299 please help me – Owase Sayyad Feb 05 '18 at 14:44
  • @OwaseSayyed did you have ant luck in installing dlib on Win 10? I have the same problem. Python 3.7, Win 10 (x64), pip 18, Anaconda 5.3 – Florin Vîrdol Oct 10 '18 at 20:16

8 Answers8

5

I am on windows 10, python 3.5, pip 10
dlib didn't work even after installing cmake. Solution :

  • Add cmake into PATH(C:\Program Files\CMake\bin)
  • Then install using pip:

    pip install dlib==19.4
    

Works like a charm.

Edit:

After windows October update, the above method works, but sometimes there are errors like boost error and cmake incompatible. so,

  • Download and install CMake msi
  • Add cmake into PATH(C:\Program Files\CMake\bin)
  • Restart Windows
  • pip install dlib
    

    or

    pip install dlib==19.4
    
kalehmann
  • 4,821
  • 6
  • 26
  • 36
ASHu2
  • 2,027
  • 15
  • 29
  • Still getting " Running setup.py clean for dlib Failed to build dlib Installing collected packages: dlib Running setup.py install for dlib ... error ERROR: Command errored out with exit status 1:" – Iqbal hossain Jun 01 '20 at 14:44
3

First of all, delete CMakeCache.txt file. Later, just execute inside dlib-xx/build the command below:

cmake -G "NMake Makefiles" ..

If you have more problems with CMAKE_C_COMPILER and CMAKE_CXX_COMPILER, you will have to install MinGW and add to the enviroment variable the path /bin of MinGW.

And if you don't have installed Visual Studio, you would to resolve future problems

DCG
  • 31
  • 4
  • I am facing same problem. Cmake is getting executed when I am running command pip3 install face_recognition. I have installed MinGW. pip3 version is 9.03, Python 3.7 and cmake 3.12.0-rc3. It is still not resolved. I am struggling to find CMakeCache.txt. Need help. – skvp Jul 10 '18 at 07:58
  • 2
    Where is `CMakeCache.txt` file – Waseem Ahmad Naeem Sep 30 '18 at 06:09
  • 1
    CMakeCache file can be found in the build folder – Paul Allsopp Feb 13 '19 at 20:17
3

I met the same problem with you, and it has been solved after installing Visual Studio C++.

韩笑尘
  • 31
  • 2
3

The easiest way is to install MS Visual Studio Community Edition, and select Visual C++ (install anything else you want but they are all optional except C++). This will install CMake and the correct compiler and libs in the correct locations.

  • Download the latest Dlib.
  • CD into the Dlib folder.
  • Make sure the Dlib/build folder is empty ( rm -r -force .\build* )
  • Run: python .\setup.py install

If you get an error, post back here. You are probably missing a dependency or ENV variable.

Paul Allsopp
  • 622
  • 1
  • 9
  • 23
  • 1
    If by "easiest" you mean downloading and installing 6-10GB… ¬_¬ – Synetech May 22 '20 at 01:49
  • 1
    @Synetech : The download is about 600 mb, the disk space required is approximately 5-6 GB. It worked for me and it's 'easiest' solution if don't want to find other work-around.,, Convenience vs. effort :-) – Milind Thakkar May 26 '20 at 17:40
  • 1
    @MilindThakkar, What do convenience or effort have to do with it if the bandwidth and disk space are the limiting factor? – Synetech May 26 '20 at 19:28
  • 1
    @Synetech I've never considered those to be a limiting factor in anything, which is why I posted it as easiest. I should have said "easiest for the user". – Paul Allsopp May 27 '20 at 14:22
0

I have just encountered the same problem yesterday and looked up many resources. And at last I solved it by installing Visual Studio 2017, choosing C++-related component, because it needs the C++ compiler to build the dlib.

Stephen Rauch
  • 47,830
  • 31
  • 106
  • 135
0

you can also go this link (dlib.whl) and download .whl version of dlib and use this command to install it

pip install .\dlib-19.8.1-cp36-cp36m-win_amd64.whl

but you should replace name of the file in above command with any file that you have downloaded

0

I had the same problem. Installing dlib from .whl worked.

pip install https://pypi.python.org/packages/da/06/bd3e241c4eb0a662914b3b4875fc52dd176a9db0d4a2c915ac2ad8800e9e/dlib-19.7.0-cp36-cp36m-win_amd64.whl#md5=b7330a5b2d46420343fbed5df69e6a3f

See this post: https://stackoverflow.com/a/49538054/9524424

Peter
  • 2,120
  • 2
  • 19
  • 33
0

I had a similar problem when installing dlib and pqkmeans Python packages.

  1. Installing CMAKE or MinGW did not help.
  2. I solved it only after installing the Build Tools for Visual Studio from here (so installing Visual Studion IDE, which is quite huge, is not necessary). When installing, I didn't check any additional ticks - the mininal proposed set of packages was enough.
  3. When installing Visual Studio, I run into a problem from this question (traces of older versions of VS) and dealt with it following the answers to this question.
David Dale
  • 10,958
  • 44
  • 73