Harshit Srivastava
Harshit Srivastava

Reputation: 13

How to fix error while installing dlib on python 3.7.3 64 bit windows 10

I'm trying to install dlib on Windows 10 using anaconda prompt. Using pip install dlib But I'm getting this error

Failed building wheel for dlib
Running setup.py clean for dlib
Failed to build dlib
    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!

I have already installed cmake using pip install cmake and it was successfully downloaded.

Upvotes: 1

Views: 5825

Answers (1)

FlyingTeller
FlyingTeller

Reputation: 20482

By default, your cmake seems to be using a different generator than is supported for your platform. In your cmd, type cmake --help. This will print a list of generators to choose from, mine looks something like this:

The following generators are available on this platform:
  Visual Studio 15 2017 [arch] = Generates Visual Studio 2017 project files.
                                 Optional [arch] can be "Win64" or "ARM".
  Visual Studio 14 2015 [arch] = Generates Visual Studio 2015 project files.
                                 Optional [arch] can be "Win64" or "ARM".
  Visual Studio 12 2013 [arch] = Generates Visual Studio 2013 project files.
                                 Optional [arch] can be "Win64" or "ARM".
  Visual Studio 11 2012 [arch] = Generates Visual Studio 2012 project files.
                                 Optional [arch] can be "Win64" or "ARM".
  Visual Studio 10 2010 [arch] = Generates Visual Studio 2010 project files.
                                 Optional [arch] can be "Win64" or "IA64".
  Visual Studio 9 2008 [arch]  = Generates Visual Studio 2008 project files.
                                 Optional [arch] can be "Win64" or "IA64".

Make sure that you also have the Visual Studio 15 ... line. Then you should be able to run your installation:

  1. Grab the source code, e.g. v19.17
  2. Unzip, and open a cmd in the unzipped source folder
  3. run python setup.py -G Visual Studio 15 2017 Win64

This should tell cmake to use the correct visual studio generator.

Also worth mentioning, since you seem to be using anaconda, is the fact that dlib should be available from the conda-forge and can be installed like thie:

conda install -c conda-forge dlib 

Upvotes: 2

Related Questions