V
V
Vladimir Stepanov2020-12-17 16:45:19
pip
Vladimir Stepanov, 2020-12-17 16:45:19

How to install dlib package in PyCharm if pip is not working?

Good afternoon, I've been scratching my head for several days now over the problem of adding a dlib package to PyCharm. When trying to do this, as indicated in the jetbrain manual, it gives the following error (please don't be scared)

poke
Collecting dlib
Using cached dlib-19.21.1.tar.gz (3.6 MB)
Using legacy 'setup.py install' for dlib, since package 'wheel' is not installed.
Installing collected packages: dlib
Running setup.py install for dlib: started
Running setup.py install for dlib: finished with status 'error'

ERROR: Command errored out with exit status 1:
command: 'C:\Program Files\Python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Vladimir\\AppData\\Local\\Temp\\pip-install-wo1po3h2\\dlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\Vladimir\\AppData\\Local\\Temp\\pip-install-wo1po3h2\\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\Vladimir\AppData\Local\Temp\pip-record-pigi9lcb\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\Vladimir\AppData\Roaming\Python\Python38\Include\dlib'
cwd: C:\Users\Vladimir\AppData\Local\Temp\pip-install-wo1po3h2\dlib\
Complete output (62 lines):
running install
running build
running build_py
package init file 'tools\python\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.8.6 (tags/v3.8.6:db45529, Sep 23 2020, 15:52:53) [MSC v.1927 64 bit (AMD64)]
Invoking CMake setup: 'cmake C:\Users\Vladimir\AppData\Local\Temp\pip-install-wo1po3h2\dlib\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\Vladimir\AppData\Local\Temp\pip-install-wo1po3h2\dlib\build\lib.win-amd64-3.8 -DPYTHON_EXECUTABLE=C:\Program Files\Python38\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\Vladimir\AppData\Local\Temp\pip-install-wo1po3h2\dlib\build\lib.win-amd64-3.8 -A x64'
-- Building for: NMake Makefiles
CMake Error at CMakeLists.txt:5 (message):



!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


You must use Visual Studio to build a python extension on windows. If you
are getting this error it means you have not installed Visual C++. Note
that there are many flavors of Visual Studio, like Visual Studio for C#
development. You need to install Visual Studio for C++.


!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!




-- Configuring incomplete, errors occurred!
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\Vladimir\AppData\Local\Temp\pip-install-wo1po3h2\dlib\setup.py", line 223, in
setup(
File "C:\Program Files\Python38\lib\site-packages\setuptools\__init__.py", line 165, in setup
return distutils.core.setup(**attrs)
File "C:\Program Files\Python38\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\Program Files\Python38\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "C:\Program Files\Python38\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Program Files\Python38\lib\site-packages\setuptools\command\install.py", line 61, in run
return orig.install.run(self)
File "C:\Program Files\Python38\lib\distutils\command\install.py", line 545, in run
self.run_command('build')
File "C:\Program Files\Python38\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Program Files\Python38\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Program Files\Python38\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "C:\Program Files\Python38\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Program Files\Python38\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\Users\Vladimir\AppData\Local\Temp\pip-install-wo1po3h2\dlib\setup.py", line 135, in run
self.build_extension(ext)
File "C:\Users\Vladimir\AppData\Local\Temp\pip-install-wo1po3h2\dlib\setup.py", line 172, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File "C:\Program Files\Python38\lib\subprocess.py", line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\Vladimir\\AppData\\Local\\Temp\\pip-install-wo1po3h2\\dlib\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\Vladimir\\AppData\\Local\\Temp\\pip-install-wo1po3h2\\dlib\\build\\lib.win-amd64-3.8', '-DPYTHON_EXECUTABLE=C:\\Program Files\\Python38\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\Vladimir\\AppData\\Local\\Temp\\pip-install-wo1po3h2\\dlib\\build\\lib.win-amd64-3.8', '-A', 'x64']' returned non-zero exit status 1.
----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Program Files\Python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Vladimir\\AppData\\Local\\Temp\\pip-install-wo1po3h2\\dlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\Vladimir\\AppData\\Local\\Temp\\pip-install-wo1po3h2\\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\Vladimir\AppData\Local\Temp\pip-record-pigi9lcb\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\Vladimir\AppData\Roaming\Python\Python38\Include\dlib' Check the logs for full command output.
WARNING: You are using pip version 20.2.1; however, version 20.3.3 is available.
You should consider upgrading via the 'C:\Program Files\Python38\python.exe -m pip install --upgrade pip' command.


By the way, I installed almost all versions of MS VC, but he just doesn't care.
5fdb60a8949de623556718.png

Please save me, my head is already swimming...

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrew, 2020-12-17
@Simpelax

CMake installed?
Here 's a step by step example

A
Andrey Dugin, 2020-12-17
@adugin

Install via anaconda from the menpo channel:
conda install -c menpo dlib

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question