New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.
Already on GitHub?
Sign in
to your account
Closed
prodemmi opened this issue
Jun 8, 2022
· 11 comments
Closed
pip dlib not installing
#2596
prodemmi opened this issue
Jun 8, 2022
· 11 comments
Comments
Hi, when I try to install dlib with pip, I got an error in the gcc version, but the latest gcc version is installed.
Expected Behavior
Since cmake and gcc are installed, the dlib package must be installed properly.
Current Behavior
Collecting dlib
Using cached dlib-19.24.0.tar.gz (3.2 MB)
Preparing metadata (setup.py) … done
Building wheels for collected packages: dlib
Building wheel for dlib (setup.py) … error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [77 lines of output]
running bdist_wheel
running build
running build_py
package init file ‘tools/python/dlib/init.py’ not found (or not a regular file)
running build_ext
Building extension for Python 3.8.12 (default, Jun 6 2022, 21:30:31)
Invoking CMake setup: ‘cmake /tmp/pip-install-hoifmbg8/dlib_2abceb3d874b4ae4bdd246d44369a9ed/tools/python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/tmp/pip-install-hoifmbg8/dlib_2abceb3d874b4ae4bdd246d44369a9ed/build/lib.linux-x86_64-3.8 -DPYTHON_EXECUTABLE=/home/axsut/DFDNet/DFDNet/env/bin/python -DCMAKE_BUILD_TYPE=Release’
— The C compiler identification is GNU 4.8.5
— The CXX compiler identification is GNU 4.8.5
— Detecting C compiler ABI info
— Detecting C compiler ABI info — done
— Check for working C compiler: /usr/bin/cc — skipped
— Detecting C compile features
— Detecting C compile features — done
— Detecting CXX compiler ABI info
— Detecting CXX compiler ABI info — done
— Check for working CXX compiler: /usr/bin/c++ — skipped
— Detecting CXX compile features
— Detecting CXX compile features — done
— Found PythonInterp: /home/axsut/DFDNet/DFDNet/env/bin/python (found version «3.8.12»)
— Found PythonLibs: /usr/local/lib/libpython3.8.a
— Performing Test HAS_CPP14_FLAG
— Performing Test HAS_CPP14_FLAG — Failed
— Performing Test HAS_CPP11_FLAG
— Performing Test HAS_CPP11_FLAG — Success
— pybind11 v2.2.4
— Using CMake version: 3.22.4
— Compiling dlib version: 19.24.0
CMake Error at /tmp/pip-install-hoifmbg8/dlib_2abceb3d874b4ae4bdd246d44369a9ed/dlib/cmake_utils/set_compiler_specific_options.cmake:50 (message):
C++11 is required to use dlib, but the version of GCC you are using is too
old and doesn’t support C++11. You need GCC 4.9 or newer.
Call Stack (most recent call first):
/tmp/pip-install-hoifmbg8/dlib_2abceb3d874b4ae4bdd246d44369a9ed/dlib/cmake_utils/test_for_sse4/CMakeLists.txt:8 (include)
CMake Error at /tmp/pip-install-hoifmbg8/dlib_2abceb3d874b4ae4bdd246d44369a9ed/dlib/cmake_utils/check_if_sse4_instructions_executable_on_host.cmake:13 (try_compile):
Failed to configure test project build system.
Call Stack (most recent call first):
/tmp/pip-install-hoifmbg8/dlib_2abceb3d874b4ae4bdd246d44369a9ed/dlib/cmake_utils/set_compiler_specific_options.cmake:13 (include)
/tmp/pip-install-hoifmbg8/dlib_2abceb3d874b4ae4bdd246d44369a9ed/dlib/CMakeLists.txt:33 (include)
-- Configuring incomplete, errors occurred!
See also "/tmp/pip-install-hoifmbg8/dlib_2abceb3d874b4ae4bdd246d44369a9ed/build/temp.linux-x86_64-3.8/CMakeFiles/CMakeOutput.log".
See also "/tmp/pip-install-hoifmbg8/dlib_2abceb3d874b4ae4bdd246d44369a9ed/build/temp.linux-x86_64-3.8/CMakeFiles/CMakeError.log".
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/tmp/pip-install-hoifmbg8/dlib_2abceb3d874b4ae4bdd246d44369a9ed/setup.py", line 222, in <module>
setup(
File "/home/axsut/DFDNet/DFDNet/env/lib/python3.8/site-packages/setuptools/__init__.py", line 153, in setup
return distutils.core.setup(**attrs)
File "/usr/local/lib/python3.8/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/local/lib/python3.8/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/usr/local/lib/python3.8/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/home/axsut/DFDNet/DFDNet/env/lib/python3.8/site-packages/wheel/bdist_wheel.py", line 299, in run
self.run_command('build')
File "/usr/local/lib/python3.8/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/local/lib/python3.8/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/usr/local/lib/python3.8/distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/usr/local/lib/python3.8/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/local/lib/python3.8/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/tmp/pip-install-hoifmbg8/dlib_2abceb3d874b4ae4bdd246d44369a9ed/setup.py", line 134, in run
self.build_extension(ext)
File "/tmp/pip-install-hoifmbg8/dlib_2abceb3d874b4ae4bdd246d44369a9ed/setup.py", line 171, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File "/usr/local/lib/python3.8/subprocess.py", line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '/tmp/pip-install-hoifmbg8/dlib_2abceb3d874b4ae4bdd246d44369a9ed/tools/python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/tmp/pip-install-hoifmbg8/dlib_2abceb3d874b4ae4bdd246d44369a9ed/build/lib.linux-x86_64-3.8', '-DPYTHON_EXECUTABLE=/home/axsut/DFDNet/DFDNet/env/bin/python', '-DCMAKE_BUILD_TYPE=Release']' returned non-zero exit status 1.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: 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
error: subprocess-exited-with-error
× Running setup.py install for dlib did not run successfully.
│ exit code: 1
╰─> [79 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
Building extension for Python 3.8.12 (default, Jun 6 2022, 21:30:31)
Invoking CMake setup: ‘cmake /tmp/pip-install-hoifmbg8/dlib_2abceb3d874b4ae4bdd246d44369a9ed/tools/python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/tmp/pip-install-hoifmbg8/dlib_2abceb3d874b4ae4bdd246d44369a9ed/build/lib.linux-x86_64-3.8 -DPYTHON_EXECUTABLE=/home/axsut/DFDNet/DFDNet/env/bin/python -DCMAKE_BUILD_TYPE=Release’
— The C compiler identification is GNU 4.8.5
— The CXX compiler identification is GNU 4.8.5
— Detecting C compiler ABI info
— Detecting C compiler ABI info — done
— Check for working C compiler: /usr/bin/cc — skipped
— Detecting C compile features
— Detecting C compile features — done
— Detecting CXX compiler ABI info
— Detecting CXX compiler ABI info — done
— Check for working CXX compiler: /usr/bin/c++ — skipped
— Detecting CXX compile features
— Detecting CXX compile features — done
— Found PythonInterp: /home/axsut/DFDNet/DFDNet/env/bin/python (found version «3.8.12»)
— Found PythonLibs: /usr/local/lib/libpython3.8.a
— Performing Test HAS_CPP14_FLAG
— Performing Test HAS_CPP14_FLAG — Failed
— Performing Test HAS_CPP11_FLAG
— Performing Test HAS_CPP11_FLAG — Success
— pybind11 v2.2.4
— Using CMake version: 3.22.4
— Compiling dlib version: 19.24.0
CMake Error at /tmp/pip-install-hoifmbg8/dlib_2abceb3d874b4ae4bdd246d44369a9ed/dlib/cmake_utils/set_compiler_specific_options.cmake:50 (message):
C++11 is required to use dlib, but the version of GCC you are using is too
old and doesn’t support C++11. You need GCC 4.9 or newer.
Call Stack (most recent call first):
/tmp/pip-install-hoifmbg8/dlib_2abceb3d874b4ae4bdd246d44369a9ed/dlib/cmake_utils/test_for_sse4/CMakeLists.txt:8 (include)
CMake Error at /tmp/pip-install-hoifmbg8/dlib_2abceb3d874b4ae4bdd246d44369a9ed/dlib/cmake_utils/check_if_sse4_instructions_executable_on_host.cmake:13 (try_compile):
Failed to configure test project build system.
Call Stack (most recent call first):
/tmp/pip-install-hoifmbg8/dlib_2abceb3d874b4ae4bdd246d44369a9ed/dlib/cmake_utils/set_compiler_specific_options.cmake:13 (include)
/tmp/pip-install-hoifmbg8/dlib_2abceb3d874b4ae4bdd246d44369a9ed/dlib/CMakeLists.txt:33 (include)
-- Configuring incomplete, errors occurred!
See also "/tmp/pip-install-hoifmbg8/dlib_2abceb3d874b4ae4bdd246d44369a9ed/build/temp.linux-x86_64-3.8/CMakeFiles/CMakeOutput.log".
See also "/tmp/pip-install-hoifmbg8/dlib_2abceb3d874b4ae4bdd246d44369a9ed/build/temp.linux-x86_64-3.8/CMakeFiles/CMakeError.log".
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/tmp/pip-install-hoifmbg8/dlib_2abceb3d874b4ae4bdd246d44369a9ed/setup.py", line 222, in <module>
setup(
File "/home/axsut/DFDNet/DFDNet/env/lib/python3.8/site-packages/setuptools/__init__.py", line 153, in setup
return distutils.core.setup(**attrs)
File "/usr/local/lib/python3.8/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/local/lib/python3.8/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/usr/local/lib/python3.8/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/home/axsut/DFDNet/DFDNet/env/lib/python3.8/site-packages/setuptools/command/install.py", line 61, in run
return orig.install.run(self)
File "/usr/local/lib/python3.8/distutils/command/install.py", line 545, in run
self.run_command('build')
File "/usr/local/lib/python3.8/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/local/lib/python3.8/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/usr/local/lib/python3.8/distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/usr/local/lib/python3.8/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/local/lib/python3.8/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/tmp/pip-install-hoifmbg8/dlib_2abceb3d874b4ae4bdd246d44369a9ed/setup.py", line 134, in run
self.build_extension(ext)
File "/tmp/pip-install-hoifmbg8/dlib_2abceb3d874b4ae4bdd246d44369a9ed/setup.py", line 171, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File "/usr/local/lib/python3.8/subprocess.py", line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '/tmp/pip-install-hoifmbg8/dlib_2abceb3d874b4ae4bdd246d44369a9ed/tools/python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/tmp/pip-install-hoifmbg8/dlib_2abceb3d874b4ae4bdd246d44369a9ed/build/lib.linux-x86_64-3.8', '-DPYTHON_EXECUTABLE=/home/axsut/DFDNet/DFDNet/env/bin/python', '-DCMAKE_BUILD_TYPE=Release']' returned non-zero exit status 1.
[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.
Steps to Reproduce
pip install dlib
Platform: Centos 7.9.2009
Cmake version: 3.22.4
GCC verrsion: 9.2.0
Not sure what to say. The output you pasted says you are using GNU 4.8.5,
which is super old.
…
On Wed, Jun 8, 2022 at 6:30 AM Emad Malekpour ***@***.***> wrote:
Hi, when I try to install dlib with a pipe, I got an error in the gcc
version, but the latest gcc version is installed.
Expected Behavior
Since cmake and gcc are installed, the dlib package must be installed
properly.
Current Behavior
Collecting dlib
Using cached dlib-19.24.0.tar.gz (3.2 MB)
Preparing metadata (setup.py) … done
Building wheels for collected packages: dlib
Building wheel for dlib (setup.py) … error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [77 lines of output]
running bdist_wheel
running build
running build_py
package init file ‘tools/python/dlib/*init*.py’ not found (or not a
regular file)
running build_ext
Building extension for Python 3.8.12 (default, Jun 6 2022, 21:30:31)
Invoking CMake setup: ‘cmake
/tmp/pip-install-hoifmbg8/dlib_2abceb3d874b4ae4bdd246d44369a9ed/tools/python
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/tmp/pip-install-hoifmbg8/dlib_2abceb3d874b4ae4bdd246d44369a9ed/build/lib.linux-x86_64-3.8
-DPYTHON_EXECUTABLE=/home/axsut/DFDNet/DFDNet/env/bin/python
-DCMAKE_BUILD_TYPE=Release’
— The C compiler identification is GNU 4.8.5
— The CXX compiler identification is GNU 4.8.5
— Detecting C compiler ABI info
— Detecting C compiler ABI info — done
— Check for working C compiler: /usr/bin/cc — skipped
— Detecting C compile features
— Detecting C compile features — done
— Detecting CXX compiler ABI info
— Detecting CXX compiler ABI info — done
— Check for working CXX compiler: /usr/bin/c++ — skipped
— Detecting CXX compile features
— Detecting CXX compile features — done
— Found PythonInterp: /home/axsut/DFDNet/DFDNet/env/bin/python (found
version «3.8.12»)
— Found PythonLibs: /usr/local/lib/libpython3.8.a
— Performing Test HAS_CPP14_FLAG
— Performing Test HAS_CPP14_FLAG — Failed
— Performing Test HAS_CPP11_FLAG
— Performing Test HAS_CPP11_FLAG — Success
— pybind11 v2.2.4
— Using CMake version: 3.22.4
— Compiling dlib version: 19.24.0
CMake Error at
/tmp/pip-install-hoifmbg8/dlib_2abceb3d874b4ae4bdd246d44369a9ed/dlib/cmake_utils/set_compiler_specific_options.cmake:50
(message):
C++11 is required to use dlib, but the version of GCC you are using is too
old and doesn’t support C++11. You need GCC 4.9 or newer.
Call Stack (most recent call first):
/tmp/pip-install-hoifmbg8/dlib_2abceb3d874b4ae4bdd246d44369a9ed/dlib/cmake_utils/test_for_sse4/CMakeLists.txt:8
(include)
CMake Error at /tmp/pip-install-hoifmbg8/dlib_2abceb3d874b4ae4bdd246d44369a9ed/dlib/cmake_utils/check_if_sse4_instructions_executable_on_host.cmake:13 (try_compile):
Failed to configure test project build system.
Call Stack (most recent call first):
/tmp/pip-install-hoifmbg8/dlib_2abceb3d874b4ae4bdd246d44369a9ed/dlib/cmake_utils/set_compiler_specific_options.cmake:13 (include)
/tmp/pip-install-hoifmbg8/dlib_2abceb3d874b4ae4bdd246d44369a9ed/dlib/CMakeLists.txt:33 (include)
— Configuring incomplete, errors occurred!
See also «/tmp/pip-install-hoifmbg8/dlib_2abceb3d874b4ae4bdd246d44369a9ed/build/temp.linux-x86_64-3.8/CMakeFiles/CMakeOutput.log».
See also «/tmp/pip-install-hoifmbg8/dlib_2abceb3d874b4ae4bdd246d44369a9ed/build/temp.linux-x86_64-3.8/CMakeFiles/CMakeError.log».
Traceback (most recent call last):
File «<string>», line 2, in <module>
File «<pip-setuptools-caller>», line 34, in <module>
File «/tmp/pip-install-hoifmbg8/dlib_2abceb3d874b4ae4bdd246d44369a9ed/setup.py», line 222, in <module>
setup(
File «/home/axsut/DFDNet/DFDNet/env/lib/python3.8/site-packages/setuptools/__init__.py», line 153, in setup
return distutils.core.setup(**attrs)
File «/usr/local/lib/python3.8/distutils/core.py», line 148, in setup
dist.run_commands()
File «/usr/local/lib/python3.8/distutils/dist.py», line 966, in run_commands
self.run_command(cmd)
File «/usr/local/lib/python3.8/distutils/dist.py», line 985, in run_command
cmd_obj.run()
File «/home/axsut/DFDNet/DFDNet/env/lib/python3.8/site-packages/wheel/bdist_wheel.py», line 299, in run
self.run_command(‘build’)
File «/usr/local/lib/python3.8/distutils/cmd.py», line 313, in run_command
self.distribution.run_command(command)
File «/usr/local/lib/python3.8/distutils/dist.py», line 985, in run_command
cmd_obj.run()
File «/usr/local/lib/python3.8/distutils/command/build.py», line 135, in run
self.run_command(cmd_name)
File «/usr/local/lib/python3.8/distutils/cmd.py», line 313, in run_command
self.distribution.run_command(command)
File «/usr/local/lib/python3.8/distutils/dist.py», line 985, in run_command
cmd_obj.run()
File «/tmp/pip-install-hoifmbg8/dlib_2abceb3d874b4ae4bdd246d44369a9ed/setup.py», line 134, in run
self.build_extension(ext)
File «/tmp/pip-install-hoifmbg8/dlib_2abceb3d874b4ae4bdd246d44369a9ed/setup.py», line 171, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File «/usr/local/lib/python3.8/subprocess.py», line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command ‘[‘cmake’, ‘/tmp/pip-install-hoifmbg8/dlib_2abceb3d874b4ae4bdd246d44369a9ed/tools/python’, ‘-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/tmp/pip-install-hoifmbg8/dlib_2abceb3d874b4ae4bdd246d44369a9ed/build/lib.linux-x86_64-3.8’, ‘-DPYTHON_EXECUTABLE=/home/axsut/DFDNet/DFDNet/env/bin/python’, ‘-DCMAKE_BUILD_TYPE=Release’]’ returned non-zero exit status 1.
[end of output]
note: This error originates from a subprocess, and is likely not a problem
with pip.
ERROR: 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
error: subprocess-exited-with-error
× Running setup.py install for dlib did not run successfully.
│ exit code: 1
╰─> [79 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
Building extension for Python 3.8.12 (default, Jun 6 2022, 21:30:31)
Invoking CMake setup: ‘cmake
/tmp/pip-install-hoifmbg8/dlib_2abceb3d874b4ae4bdd246d44369a9ed/tools/python
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/tmp/pip-install-hoifmbg8/dlib_2abceb3d874b4ae4bdd246d44369a9ed/build/lib.linux-x86_64-3.8
-DPYTHON_EXECUTABLE=/home/axsut/DFDNet/DFDNet/env/bin/python
-DCMAKE_BUILD_TYPE=Release’
— The C compiler identification is GNU 4.8.5
— The CXX compiler identification is GNU 4.8.5
— Detecting C compiler ABI info
— Detecting C compiler ABI info — done
— Check for working C compiler: /usr/bin/cc — skipped
— Detecting C compile features
— Detecting C compile features — done
— Detecting CXX compiler ABI info
— Detecting CXX compiler ABI info — done
— Check for working CXX compiler: /usr/bin/c++ — skipped
— Detecting CXX compile features
— Detecting CXX compile features — done
— Found PythonInterp: /home/axsut/DFDNet/DFDNet/env/bin/python (found
version «3.8.12»)
— Found PythonLibs: /usr/local/lib/libpython3.8.a
— Performing Test HAS_CPP14_FLAG
— Performing Test HAS_CPP14_FLAG — Failed
— Performing Test HAS_CPP11_FLAG
— Performing Test HAS_CPP11_FLAG — Success
— pybind11 v2.2.4
— Using CMake version: 3.22.4
— Compiling dlib version: 19.24.0
CMake Error at
/tmp/pip-install-hoifmbg8/dlib_2abceb3d874b4ae4bdd246d44369a9ed/dlib/cmake_utils/set_compiler_specific_options.cmake:50
(message):
C++11 is required to use dlib, but the version of GCC you are using is too
old and doesn’t support C++11. You need GCC 4.9 or newer.
Call Stack (most recent call first):
/tmp/pip-install-hoifmbg8/dlib_2abceb3d874b4ae4bdd246d44369a9ed/dlib/cmake_utils/test_for_sse4/CMakeLists.txt:8
(include)
CMake Error at /tmp/pip-install-hoifmbg8/dlib_2abceb3d874b4ae4bdd246d44369a9ed/dlib/cmake_utils/check_if_sse4_instructions_executable_on_host.cmake:13 (try_compile):
Failed to configure test project build system.
Call Stack (most recent call first):
/tmp/pip-install-hoifmbg8/dlib_2abceb3d874b4ae4bdd246d44369a9ed/dlib/cmake_utils/set_compiler_specific_options.cmake:13 (include)
/tmp/pip-install-hoifmbg8/dlib_2abceb3d874b4ae4bdd246d44369a9ed/dlib/CMakeLists.txt:33 (include)
— Configuring incomplete, errors occurred!
See also «/tmp/pip-install-hoifmbg8/dlib_2abceb3d874b4ae4bdd246d44369a9ed/build/temp.linux-x86_64-3.8/CMakeFiles/CMakeOutput.log».
See also «/tmp/pip-install-hoifmbg8/dlib_2abceb3d874b4ae4bdd246d44369a9ed/build/temp.linux-x86_64-3.8/CMakeFiles/CMakeError.log».
Traceback (most recent call last):
File «<string>», line 2, in <module>
File «<pip-setuptools-caller>», line 34, in <module>
File «/tmp/pip-install-hoifmbg8/dlib_2abceb3d874b4ae4bdd246d44369a9ed/setup.py», line 222, in <module>
setup(
File «/home/axsut/DFDNet/DFDNet/env/lib/python3.8/site-packages/setuptools/__init__.py», line 153, in setup
return distutils.core.setup(**attrs)
File «/usr/local/lib/python3.8/distutils/core.py», line 148, in setup
dist.run_commands()
File «/usr/local/lib/python3.8/distutils/dist.py», line 966, in run_commands
self.run_command(cmd)
File «/usr/local/lib/python3.8/distutils/dist.py», line 985, in run_command
cmd_obj.run()
File «/home/axsut/DFDNet/DFDNet/env/lib/python3.8/site-packages/setuptools/command/install.py», line 61, in run
return orig.install.run(self)
File «/usr/local/lib/python3.8/distutils/command/install.py», line 545, in run
self.run_command(‘build’)
File «/usr/local/lib/python3.8/distutils/cmd.py», line 313, in run_command
self.distribution.run_command(command)
File «/usr/local/lib/python3.8/distutils/dist.py», line 985, in run_command
cmd_obj.run()
File «/usr/local/lib/python3.8/distutils/command/build.py», line 135, in run
self.run_command(cmd_name)
File «/usr/local/lib/python3.8/distutils/cmd.py», line 313, in run_command
self.distribution.run_command(command)
File «/usr/local/lib/python3.8/distutils/dist.py», line 985, in run_command
cmd_obj.run()
File «/tmp/pip-install-hoifmbg8/dlib_2abceb3d874b4ae4bdd246d44369a9ed/setup.py», line 134, in run
self.build_extension(ext)
File «/tmp/pip-install-hoifmbg8/dlib_2abceb3d874b4ae4bdd246d44369a9ed/setup.py», line 171, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File «/usr/local/lib/python3.8/subprocess.py», line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command ‘[‘cmake’, ‘/tmp/pip-install-hoifmbg8/dlib_2abceb3d874b4ae4bdd246d44369a9ed/tools/python’, ‘-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/tmp/pip-install-hoifmbg8/dlib_2abceb3d874b4ae4bdd246d44369a9ed/build/lib.linux-x86_64-3.8’, ‘-DPYTHON_EXECUTABLE=/home/axsut/DFDNet/DFDNet/env/bin/python’, ‘-DCMAKE_BUILD_TYPE=Release’]’ returned non-zero exit status 1.
[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.
Steps to Reproduce
pip install dlib
Platform: Centos 7.9.2009
Cmake version: 3.22.4
GCC verrsion: 9.2.0
—
Reply to this email directly, view it on GitHub
<#2596>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABPYFRZXKAKPH7KGC3G4EQ3VOBY3XANCNFSM5YGAUTAQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
Like what does g++ --version
say when you type it in a terminal?
Like what does
g++ --version
say when you type it in a terminal?
This is the output:
[root@server ~]# g++ —version
g++ (GCC) 9.2.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
🤷 the build output you pasted said it was using the old version.
Warning: this issue has been inactive for 35 days and will be automatically closed on 2022-07-24 if there is no further activity.
If you are waiting for a response but haven’t received one it’s possible your question is somehow inappropriate. E.g. it is off topic, you didn’t follow the issue submission instructions, or your question is easily answerable by reading the FAQ, dlib’s official compilation instructions, dlib’s API documentation, or a Google search.
Collecting dlib
Using cached dlib-19.24.0.tar.gz (3.2 MB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status ‘done’
Building wheels for collected packages: dlib
Building wheel for dlib (setup.py): started
Building wheel for dlib (setup.py): finished with status ‘error’
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’
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [10 lines of output]
running bdist_wheel
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
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: Failed building wheel for dlib
error: subprocess-exited-with-error
× Running setup.py install for dlib did not run successfully.
│ exit code: 1
╰─> [12 lines of output]
running install
/usr/lib/python3/dist-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
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
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.
ERROR: CMake must be installed to build dlib
.
You have to install CMake Get it from cmake.org.
Collecting dlib==19.4
Downloading dlib-19.4.0.tar.gz (4.0 MB)
—————————————- 4.0/4.0 MB 595.8 kB/s eta 0:00:00
Preparing metadata (setup.py) … done
Building wheels for collected packages: dlib
Building wheel for dlib (setup.py) … error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [39 lines of output]
running bdist_wheel
running build
Detected Python architecture: 64bit
Detected platform: win32
Configuring cmake …
C:Program FilesPython310libsubprocess.py:959: RuntimeWarning: line buffering (buffering=1) isn’t supported in binary mode, the default buffer size will be used
self.stdout = io.open(c2pread, ‘rb’, bufsize)
Traceback (most recent call last):
File «», line 2, in
File «», line 34, in
File «C:UsersHPAppDataLocalTemppip-install-c08tomm3dlib_e9ee89625c5f489db3a055aad39ae254setup.py», line 607, in
setup(
File «C:Program FilesPython310libsite-packagessetuptools_init_.py», line 87, in setup
return distutils.core.setup(**attrs)
File «C:Program FilesPython310libsite-packagessetuptools_distutilscore.py», line 177, in setup
return run_commands(dist)
File «C:Program FilesPython310libsite-packagessetuptools_distutilscore.py», line 193, in run_commands
dist.run_commands()
File «C:Program FilesPython310libsite-packagessetuptools_distutilsdist.py», line 968, in run_commands
self.run_command(cmd)
File «C:Program FilesPython310libsite-packagessetuptoolsdist.py», line 1217, in run_command
super().run_command(command)
File «C:Program FilesPython310libsite-packagessetuptools_distutilsdist.py», line 987, in run_command
cmd_obj.run()
File «C:Program FilesPython310libsite-packageswheelbdist_wheel.py», line 325, in run
self.run_command(«build»)
File «C:Program FilesPython310libsite-packagessetuptools_distutilscmd.py», line 317, in run_command
self.distribution.run_command(command)
File «C:Program FilesPython310libsite-packagessetuptoolsdist.py», line 1217, in run_command
super().run_command(command)
File «C:Program FilesPython310libsite-packagessetuptools_distutilsdist.py», line 987, in run_command
cmd_obj.run()
File «C:UsersHPAppDataLocalTemppip-install-c08tomm3dlib_e9ee89625c5f489db3a055aad39ae254setup.py», line 405, in run
self.build_dlib()
File «C:UsersHPAppDataLocalTemppip-install-c08tomm3dlib_e9ee89625c5f489db3a055aad39ae254setup.py», line 558, in build_dlib
if run_process(cmake_cmd):
File «C:UsersHPAppDataLocalTemppip-install-c08tomm3dlib_e9ee89625c5f489db3a055aad39ae254setup.py», line 298, in run_process
while t.isAlive():
AttributeError: ‘Thread’ object has no attribute ‘isAlive’. Did you mean: ‘is_alive’?
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: 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
error: subprocess-exited-with-error
× Running setup.py install for dlib did not run successfully.
│ exit code: 1
╰─> [44 lines of output]
running install
C:Program FilesPython310libsite-packagessetuptoolscommandinstall.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build
Detected Python architecture: 64bit
Detected platform: win32
Removing build directory C:UsersHPAppDataLocalTemppip-install-c08tomm3dlib_e9ee89625c5f489db3a055aad39ae254./tools/python/build
Configuring cmake …
C:Program FilesPython310libsubprocess.py:959: RuntimeWarning: line buffering (buffering=1) isn’t supported in binary mode, the default buffer size will be used
self.stdout = io.open(c2pread, ‘rb’, bufsize)
Traceback (most recent call last):
File «», line 2, in
File «», line 34, in
File «C:UsersHPAppDataLocalTemppip-install-c08tomm3dlib_e9ee89625c5f489db3a055aad39ae254setup.py», line 607, in
setup(
File «C:Program FilesPython310libsite-packagessetuptools_init_.py», line 87, in setup
return distutils.core.setup(**attrs)
File «C:Program FilesPython310libsite-packagessetuptools_distutilscore.py», line 177, in setup
return run_commands(dist)
File «C:Program FilesPython310libsite-packagessetuptools_distutilscore.py», line 193, in run_commands
dist.run_commands()
File «C:Program FilesPython310libsite-packagessetuptools_distutilsdist.py», line 968, in run_commands
self.run_command(cmd)
File «C:Program FilesPython310libsite-packagessetuptoolsdist.py», line 1217, in run_command
super().run_command(command)
File «C:Program FilesPython310libsite-packagessetuptools_distutilsdist.py», line 987, in run_command
cmd_obj.run()
File «C:Program FilesPython310libsite-packagessetuptoolscommandinstall.py», line 68, in run
return orig.install.run(self)
File «C:Program FilesPython310libsite-packagessetuptools_distutilscommandinstall.py», line 695, in run
self.run_command(‘build’)
File «C:Program FilesPython310libsite-packagessetuptools_distutilscmd.py», line 317, in run_command
self.distribution.run_command(command)
File «C:Program FilesPython310libsite-packagessetuptoolsdist.py», line 1217, in run_command
super().run_command(command)
File «C:Program FilesPython310libsite-packagessetuptools_distutilsdist.py», line 987, in run_command
cmd_obj.run()
File «C:UsersHPAppDataLocalTemppip-install-c08tomm3dlib_e9ee89625c5f489db3a055aad39ae254setup.py», line 405, in run
self.build_dlib()
File «C:UsersHPAppDataLocalTemppip-install-c08tomm3dlib_e9ee89625c5f489db3a055aad39ae254setup.py», line 558, in build_dlib
if run_process(cmake_cmd):
File «C:UsersHPAppDataLocalTemppip-install-c08tomm3dlib_e9ee89625c5f489db3a055aad39ae254setup.py», line 298, in run_process
while t.isAlive():
AttributeError: ‘Thread’ object has no attribute ‘isAlive’. Did you mean: ‘is_alive’?
[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./
I have amd rayzen 5 4500U CPU. I cannot install dlib why?
I installed Cmake. Cant fix
dlib 19.4 is super old. Use the current version
ERROR: CMake must be installed to build dlib
.You have to install CMake Get it from cmake.org.
This helped me. Thanks
select 14 instead 11
g++ -std=c++14 -O3 -I.. ../dlib/all/source.cpp -lpthread -lX11 example.cpp
Содержание
- Как установить пакет dlib в PyCharm если pip не работает?
- Русские Блоги
- Импорт Pygame библиотеки в PyCharm не удалось, и решение
- ERROR: Could not install packages due to an EnvironmentError: HTTPSConnectionPool(host=’files.pythonhosted.org’, port=443): Max retries exceeded with url:…
- Как установить пакет dlib в PyCharm если pip не работает?
Как установить пакет dlib в PyCharm если pip не работает?
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 FilesPython38python.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(‘»‘»‘rn’»‘»‘, ‘»‘»‘n’»‘»‘);f.close();exec(compile(code, __file__, ‘»‘»‘exec’»‘»‘))’ install —record ‘C:UsersVladimirAppDataLocalTemppip-record-pigi9lcbinstall-record.txt’ —single-version-externally-managed —user —prefix= —compile —install-headers ‘C:UsersVladimirAppDataRoamingPythonPython38Includedlib’
cwd: C:UsersVladimirAppDataLocalTemppip-install-wo1po3h2dlib
Complete output (62 lines):
running install
running build
running build_py
package init file ‘toolspythondlib__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:UsersVladimirAppDataLocalTemppip-install-wo1po3h2dlibtoolspython -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:UsersVladimirAppDataLocalTemppip-install-wo1po3h2dlibbuildlib.win-amd64-3.8 -DPYTHON_EXECUTABLE=C:Program FilesPython38python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:UsersVladimirAppDataLocalTemppip-install-wo1po3h2dlibbuildlib.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:UsersVladimirAppDataLocalTemppip-install-wo1po3h2dlibsetup.py», line 223, in
setup(
File «C:Program FilesPython38libsite-packagessetuptools__init__.py», line 165, in setup
return distutils.core.setup(**attrs)
File «C:Program FilesPython38libdistutilscore.py», line 148, in setup
dist.run_commands()
File «C:Program FilesPython38libdistutilsdist.py», line 966, in run_commands
self.run_command(cmd)
File «C:Program FilesPython38libdistutilsdist.py», line 985, in run_command
cmd_obj.run()
File «C:Program FilesPython38libsite-packagessetuptoolscommandinstall.py», line 61, in run
return orig.install.run(self)
File «C:Program FilesPython38libdistutilscommandinstall.py», line 545, in run
self.run_command(‘build’)
File «C:Program FilesPython38libdistutilscmd.py», line 313, in run_command
self.distribution.run_command(command)
File «C:Program FilesPython38libdistutilsdist.py», line 985, in run_command
cmd_obj.run()
File «C:Program FilesPython38libdistutilscommandbuild.py», line 135, in run
self.run_command(cmd_name)
File «C:Program FilesPython38libdistutilscmd.py», line 313, in run_command
self.distribution.run_command(command)
File «C:Program FilesPython38libdistutilsdist.py», line 985, in run_command
cmd_obj.run()
File «C:UsersVladimirAppDataLocalTemppip-install-wo1po3h2dlibsetup.py», line 135, in run
self.build_extension(ext)
File «C:UsersVladimirAppDataLocalTemppip-install-wo1po3h2dlibsetup.py», line 172, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File «C:Program FilesPython38libsubprocess.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 FilesPython38python.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(‘»‘»‘rn’»‘»‘, ‘»‘»‘n’»‘»‘);f.close();exec(compile(code, __file__, ‘»‘»‘exec’»‘»‘))’ install —record ‘C:UsersVladimirAppDataLocalTemppip-record-pigi9lcbinstall-record.txt’ —single-version-externally-managed —user —prefix= —compile —install-headers ‘C:UsersVladimirAppDataRoamingPythonPython38Includedlib’ 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 FilesPython38python.exe -m pip install —upgrade pip’ command.
К слову, MS VC я поставил почти все версии, но ему просто плевать.
Спасите меня пожалуйста, уже голова плывет.
Источник
Русские Блоги
Импорт Pygame библиотеки в PyCharm не удалось, и решение
ERROR: Could not install packages due to an EnvironmentError: HTTPSConnectionPool(host=’files.pythonhosted.org’, port=443): Max retries exceeded with url:…
- Спрос: Используйте PyCharm к программе в Win10, где требуется сторонняя библиотека Pygame.
- Предварительное решение: Установка сторонних библиотек с программным обеспечением PyCharm.
- шаг:
- Нажмите на PyCharm Программное обеспечение в строке меню: Файл -> Настройки
- Нажмите, в свою очередь: Проект: Plane_Battle -> Project Переводчик -> Список плагинов+«Открыть библиотеку программного обеспечения страницу поиска сторонних производителей.
Потому что мой проект называется Plane_Battle, список слева меню показывает Project Plane_Battle. Вы можете быть-> Проект: Ваше имя проекта
Введите «Pygame» Enter «Pygame» в окне поиска, искать сторонние библиотеки
- Следующие советы могут появиться в случае неудобной скорости сети:
Не паникуйте, просто еще несколько раз!
Программное обеспечение находит позже, нажмите кнопку установки кнопки в левом нижнем углу, ожидая, чтобы установить .
Но, к сожалению, установка имеет ошибку!
Нажмите на оперативное сообщение об ошибке, чтобы получить следующее сообщение:
- Загрузите исходную сеть слишком медленно, то соединение не подключен к серверу;
- Версия PIP является слишком низкой и должна быть повышена.
Изменить загруженный адрес источника:
Нажмите на нижний левый угол управления, а затем всплывают на следующей странице, нажмите справа плюс, добавить новый источник:
После выбора нового источника, нажмите кнопку OK, чтобы обновить, а затем нажмите кнопку Установить Установить пакет.
К несчастью! Еще об ошибке! Действительно Действительно
Обновление версии PIP:
В соответствии с модулем импорта, ошибка проворная информацию можно увидеть, мой PyCharm путь D:liangplanes_battlevenvScripts
Следовательно, терминал для Windows входит в путь выше и обновляет PIP в рамках этого пути.
Шаги: «WIN кнопка + г» -> CMD -> d: -> d: лян planes_battle venv Scripts -> python.exe -m pip install —upgrade pip -i http://pypi.douban.com/simple —trusted-host pypi.douban.com
После завершения обновления, вернитесь к шагу 4, найти Pygame после выбора, нажмите кнопку Установить в нижнем левом углу, чтобы установить пакет, продолжить установку .
К сожалению, может быть, вы можете также установить неудачными! Действительно Действительно
- Окончательный большой трюкТак как он не может быть установлен с помощью программного обеспечения, то сообщения об ошибке, мы можем также попытаться установить в терминальной среде:
Точно так же, как и обновление метод PIP, сначала введите путь окружения проекта PyCharm и введите команду следующую строку:
Источник Douban используется, конечно, вы можете также изменить его на официальный источник Али или Ubuntu
Таким образом, библиотека Pygame успешно. D:liangplanes_battlevenvScripts Он устанавливается в среде Конечно, необходимо помнить, что проект выбирает только интерпретатор для ссылки на библиотеку Pygame.:
Источник
Как установить пакет dlib в PyCharm если pip не работает?
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 FilesPython38python.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(‘»‘»‘rn’»‘»‘, ‘»‘»‘n’»‘»‘);f.close();exec(compile(code, __file__, ‘»‘»‘exec’»‘»‘))’ install —record ‘C:UsersVladimirAppDataLocalTemppip-record-pigi9lcbinstall-record.txt’ —single-version-externally-managed —user —prefix= —compile —install-headers ‘C:UsersVladimirAppDataRoamingPythonPython38Includedlib’
cwd: C:UsersVladimirAppDataLocalTemppip-install-wo1po3h2dlib
Complete output (62 lines):
running install
running build
running build_py
package init file ‘toolspythondlib__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:UsersVladimirAppDataLocalTemppip-install-wo1po3h2dlibtoolspython -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:UsersVladimirAppDataLocalTemppip-install-wo1po3h2dlibbuildlib.win-amd64-3.8 -DPYTHON_EXECUTABLE=C:Program FilesPython38python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:UsersVladimirAppDataLocalTemppip-install-wo1po3h2dlibbuildlib.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:UsersVladimirAppDataLocalTemppip-install-wo1po3h2dlibsetup.py», line 223, in
setup(
File «C:Program FilesPython38libsite-packagessetuptools__init__.py», line 165, in setup
return distutils.core.setup(**attrs)
File «C:Program FilesPython38libdistutilscore.py», line 148, in setup
dist.run_commands()
File «C:Program FilesPython38libdistutilsdist.py», line 966, in run_commands
self.run_command(cmd)
File «C:Program FilesPython38libdistutilsdist.py», line 985, in run_command
cmd_obj.run()
File «C:Program FilesPython38libsite-packagessetuptoolscommandinstall.py», line 61, in run
return orig.install.run(self)
File «C:Program FilesPython38libdistutilscommandinstall.py», line 545, in run
self.run_command(‘build’)
File «C:Program FilesPython38libdistutilscmd.py», line 313, in run_command
self.distribution.run_command(command)
File «C:Program FilesPython38libdistutilsdist.py», line 985, in run_command
cmd_obj.run()
File «C:Program FilesPython38libdistutilscommandbuild.py», line 135, in run
self.run_command(cmd_name)
File «C:Program FilesPython38libdistutilscmd.py», line 313, in run_command
self.distribution.run_command(command)
File «C:Program FilesPython38libdistutilsdist.py», line 985, in run_command
cmd_obj.run()
File «C:UsersVladimirAppDataLocalTemppip-install-wo1po3h2dlibsetup.py», line 135, in run
self.build_extension(ext)
File «C:UsersVladimirAppDataLocalTemppip-install-wo1po3h2dlibsetup.py», line 172, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File «C:Program FilesPython38libsubprocess.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 FilesPython38python.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(‘»‘»‘rn’»‘»‘, ‘»‘»‘n’»‘»‘);f.close();exec(compile(code, __file__, ‘»‘»‘exec’»‘»‘))’ install —record ‘C:UsersVladimirAppDataLocalTemppip-record-pigi9lcbinstall-record.txt’ —single-version-externally-managed —user —prefix= —compile —install-headers ‘C:UsersVladimirAppDataRoamingPythonPython38Includedlib’ 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 FilesPython38python.exe -m pip install —upgrade pip’ command.
К слову, MS VC я поставил почти все версии, но ему просто плевать.
Спасите меня пожалуйста, уже голова плывет.
Источник
I was trying to install dlib library for face recognition in pycharm,
pip install dlib
I’m using virtual environment and base interpreter is C:UsersAyushmanAppDataLocalProgramsPythonPython38-32python.exe
Already installed cmake and pip.
python—version 3.8.3
pip—version 20.1.1
When I tried to install from setting, I got this error message:
Try to run this command from the system terminal. Make sure that you use the correct version of 'pip' installed for your Python interpreter located at 'C:UsersAyushmanPycharmProjectsdemoProjectvenvScriptspython.exe'.
When I used terminal, I got this error message:
Collecting dlib
Using cached dlib-19.19.0.tar.gz (3.2 MB)
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: Command errored out with exit status 1:
command: 'c:usersayushmanpycharmprojectsdemoprojectvenvscriptspython.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Ayushman
\AppData\Local\Temp\pip-install-7crglpz8\dlib\setup.py'"'"'; __file__='"'"'C:\Users\Ayushman\AppData\Local\Temp\pip-install-7crglpz8\dlib\setup.py'"'"'
;f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' ins
tall --record 'C:UsersAyushmanAppDataLocalTemppip-record-id9u7hlkinstall-record.txt' --single-version-externally-managed --compile --install-headers 'c:users
ayushmanpycharmprojectsdemoprojectvenvincludesitepython3.8dlib'
cwd: C:UsersAyushmanAppDataLocalTemppip-install-7crglpz8dlib
Complete output (80 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.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:20:19) [MSC v.1925 32 bit (Intel)]
Invoking CMake setup: 'cmake C:UsersAyushmanAppDataLocalTemppip-install-7crglpz8dlibtoolspython -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:UsersAyushmanAppDa
taLocalTemppip-install-7crglpz8dlibbuildlib.win32-3.8 -DPYTHON_EXECUTABLE=c:usersayushmanpycharmprojectsdemoprojectvenvscriptspython.exe -DCMAKE_LIBRARY
_OUTPUT_DIRECTORY_RELEASE=C:UsersAyushmanAppDataLocalTemppip-install-7crglpz8dlibbuildlib.win32-3.8'
-- Building for: NMake Makefiles
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:3 (project):
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 at CMakeLists.txt:3 (project):
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/Ayushman/AppData/Local/Temp/pip-install-7crglpz8/dlib/build/temp.win32-3.8/Release/CMakeFiles/CMakeOutput.log".
See also "C:/Users/Ayushman/AppData/Local/Temp/pip-install-7crglpz8/dlib/build/temp.win32-3.8/Release/CMakeFiles/CMakeError.log".
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:UsersAyushmanAppDataLocalTemppip-install-7crglpz8dlibsetup.py", line 223, in <module>
setup(
File "c:usersayushmanpycharmprojectsdemoprojectvenvlibsite-packagessetuptools__init__.py", line 144, in setup
return distutils.core.setup(**attrs)
File "C:UsersAyushmanAppDataLocalProgramsPythonPython38-32libdistutilscore.py", line 148, in setup
dist.run_commands()
File "C:UsersAyushmanAppDataLocalProgramsPythonPython38-32libdistutilsdist.py", line 966, in run_commands
self.run_command(cmd)
File "C:UsersAyushmanAppDataLocalProgramsPythonPython38-32libdistutilsdist.py", line 985, in run_command
cmd_obj.run()
File "c:usersayushmanpycharmprojectsdemoprojectvenvlibsite-packagessetuptoolscommandinstall.py", line 61, in run
return orig.install.run(self)
File "C:UsersAyushmanAppDataLocalProgramsPythonPython38-32libdistutilscommandinstall.py", line 545, in run
self.run_command('build')
File "C:UsersAyushmanAppDataLocalProgramsPythonPython38-32libdistutilscmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:UsersAyushmanAppDataLocalProgramsPythonPython38-32libdistutilsdist.py", line 985, in run_command
cmd_obj.run()
File "C:UsersAyushmanAppDataLocalProgramsPythonPython38-32libdistutilscommandbuild.py", line 135, in run
self.run_command(cmd_name)
File "C:UsersAyushmanAppDataLocalProgramsPythonPython38-32libdistutilscmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:UsersAyushmanAppDataLocalProgramsPythonPython38-32libdistutilsdist.py", line 985, in run_command
cmd_obj.run()
File "C:UsersAyushmanAppDataLocalTemppip-install-7crglpz8dlibsetup.py", line 135, in run
self.build_extension(ext)
File "C:UsersAyushmanAppDataLocalTemppip-install-7crglpz8dlibsetup.py", line 172, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File "C:UsersAyushmanAppDataLocalProgramsPythonPython38-32libsubprocess.py", line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\Users\Ayushman\AppData\Local\Temp\pip-install-7crglpz8\dlib\tools\python', '-DCMAKE_LIBRARY_OUTPUT
_DIRECTORY=C:\Users\Ayushman\AppData\Local\Temp\pip-install-7crglpz8\dlib\build\lib.win32-3.8', '-DPYTHON_EXECUTABLE=c:\users\ayushman\pycharmprojects\d
emoproject\venv\scripts\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\Ayushman\AppData\Local\Temp\pip-install-7crglpz8\dlib\build\lib.w
in32-3.8']' returned non-zero exit status 1.
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:usersayushmanpycharmprojectsdemoprojectvenvscriptspython.exe' -u -c 'import sys, setuptools, tokenize; sys.a
rgv[0] = '"'"'C:\Users\Ayushman\AppData\Local\Temp\pip-install-7crglpz8\dlib\setup.py'"'"'; __file__='"'"'C:\Users\Ayushman\AppData\Local\Temp\pip-inst
all-7crglpz8\dlib\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code
, __file__, '"'"'exec'"'"'))' install --record 'C:UsersAyushmanAppDataLocalTemppip-record-id9u7hlkinstall-record.txt' --single-version-externally-managed --co
mpile --install-headers 'c:usersayushmanpycharmprojectsdemoprojectvenvincludesitepython3.8dlib' Check the logs for full command output.
Как установить пакет dlib в PyCharm если pip не работает?
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 FilesPython38python.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(‘»‘»‘rn’»‘»‘, ‘»‘»‘n’»‘»‘);f.close();exec(compile(code, __file__, ‘»‘»‘exec’»‘»‘))’ install —record ‘C:UsersVladimirAppDataLocalTemppip-record-pigi9lcbinstall-record.txt’ —single-version-externally-managed —user —prefix= —compile —install-headers ‘C:UsersVladimirAppDataRoamingPythonPython38Includedlib’
cwd: C:UsersVladimirAppDataLocalTemppip-install-wo1po3h2dlib
Complete output (62 lines):
running install
running build
running build_py
package init file ‘toolspythondlib__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:UsersVladimirAppDataLocalTemppip-install-wo1po3h2dlibtoolspython -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:UsersVladimirAppDataLocalTemppip-install-wo1po3h2dlibbuildlib.win-amd64-3.8 -DPYTHON_EXECUTABLE=C:Program FilesPython38python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:UsersVladimirAppDataLocalTemppip-install-wo1po3h2dlibbuildlib.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:UsersVladimirAppDataLocalTemppip-install-wo1po3h2dlibsetup.py», line 223, in
setup(
File «C:Program FilesPython38libsite-packagessetuptools__init__.py», line 165, in setup
return distutils.core.setup(**attrs)
File «C:Program FilesPython38libdistutilscore.py», line 148, in setup
dist.run_commands()
File «C:Program FilesPython38libdistutilsdist.py», line 966, in run_commands
self.run_command(cmd)
File «C:Program FilesPython38libdistutilsdist.py», line 985, in run_command
cmd_obj.run()
File «C:Program FilesPython38libsite-packagessetuptoolscommandinstall.py», line 61, in run
return orig.install.run(self)
File «C:Program FilesPython38libdistutilscommandinstall.py», line 545, in run
self.run_command(‘build’)
File «C:Program FilesPython38libdistutilscmd.py», line 313, in run_command
self.distribution.run_command(command)
File «C:Program FilesPython38libdistutilsdist.py», line 985, in run_command
cmd_obj.run()
File «C:Program FilesPython38libdistutilscommandbuild.py», line 135, in run
self.run_command(cmd_name)
File «C:Program FilesPython38libdistutilscmd.py», line 313, in run_command
self.distribution.run_command(command)
File «C:Program FilesPython38libdistutilsdist.py», line 985, in run_command
cmd_obj.run()
File «C:UsersVladimirAppDataLocalTemppip-install-wo1po3h2dlibsetup.py», line 135, in run
self.build_extension(ext)
File «C:UsersVladimirAppDataLocalTemppip-install-wo1po3h2dlibsetup.py», line 172, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File «C:Program FilesPython38libsubprocess.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 FilesPython38python.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(‘»‘»‘rn’»‘»‘, ‘»‘»‘n’»‘»‘);f.close();exec(compile(code, __file__, ‘»‘»‘exec’»‘»‘))’ install —record ‘C:UsersVladimirAppDataLocalTemppip-record-pigi9lcbinstall-record.txt’ —single-version-externally-managed —user —prefix= —compile —install-headers ‘C:UsersVladimirAppDataRoamingPythonPython38Includedlib’ 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 FilesPython38python.exe -m pip install —upgrade pip’ command.
К слову, MS VC я поставил почти все версии, но ему просто плевать.
Install Dlib on Windows
In this post, we will provide step by step instructions on how to install Dlib on Windows.
Compiling Python modules such as NumPy, SciPy etc. is a tedious task. Anaconda is a great Python distribution which comes with a lot of pre-compiled Python packages. So we will use Anaconda as our Python distribution.
An alternative to Anaconda is that you install official Python library and use Christoph Gohlke’s awesome repository to install pre-compiled Python modules.
This tutorial is based on using Anaconda so we may not be able to help if you choose to use Gohlke’s precompiled binaries or if you compile Python libraries from source.
If you intend to use Dlib only in C++ projects, you can skip Python installation part.
Now let’s go through the steps to install Dlib. Follow our previous post Install OpenCV3 on Windows to complete Step 1, 2 and 3.
Step 1: Install Visual Studio 2015
Step 2: Install CMake v3.8.2
Step 3: Install Anaconda 3
Step 4: Download Dlib
Step 5: Build Dlib library
Extract this compressed file. Open Windows PowerShell or Command Prompt and move to the directory where you have extracted this file.
If you are running these commands on Command Prompt replace ` (backtick) with ^ (caret).
Dlib will be installed within dlib-19.6buildinstall directory. We will use CMake to build Dlib examples but you can use Visual Studio too. This directory (dlib-19.6buildinstall) contains include and library folders which you can specify in Visual Studio to build projects using Dlib.
Step 6: Update user environment variable – dlib_DIR
This environment variable is needed for CMake to find out where Dlib is installed. CMake looks for a file named dlibConfig.cmake within directory dlib_DIR to find Dlib’s include and library directories.
- Press Windows Super key, search for “environment variables”.
- Click Environment Variables in System Properties window.
- Click New in “User Variables” (in upper half of window).
- Under variable name write dlib_DIR and under variable value write full path to directory dlib-19.6buildinstalllibcmakedlib
On my machine path is: D:programmingdlib-19.6buildinstalllibcmakedlib
This directory contains file “dlibConfig.cmake”. This is used by CMake to configure dlib_LIBS and dlib_INCLUDE_DIRS variables to generate project files. Before assigning the value to variable dlib_DIR make sure that this path has file dlibConfig.cmake. - Now click ok to save and close environment variables window.
Note: If you have an open Command Prompt/Power Shell window before these values were updated, you have to close and open a new Command Prompt/Power Shell window again.
Step 7: Build Dlib examples
We will use our CMakeLists.txt file instead of one which is shipped with Dlib.
Download modified CMakeLists.txt file and put it in dlib-19.6examples directory and replace the default one with this one. Then follow the steps given below:
Once build is complete, it will generate executables for all examples in examplesbuildRelease folder.
Step 8: Test Dlib’s C++ example
We will test Face Landmark Detection demo to check whether we have installed Dlib correctly.
Download trained model of facial landmarks from Dlib’s website. Extract this file (shape_predictor_68_face_landmarks.dat.bz2) to Dlib’s root directory (dlib-19.6).
Step 9: Install Dlib’s Python module (Only Anaconda 3)
Compiling Python bindings for Dlib from source is non-trivial. You have to compile Boost.Python from scratch and configure some environment variables (such as BOOST_ROOT and BOOST_LIBRARYDIR) before you can compile Python module of Dlib. We are skipping that part for now. A complete tutorial on how to build Dlib Python bindings from source will be released in future.
To save time and efforts it is suggested to use Anaconda 3. You can install a compiled binary of dlib v19.4 from Anaconda. At the time this article was updated Dlib’s latest available version on Anaconda’s conda-forge repository is 19.4. So we will install v19.4 instead of 19.6
Step 10: Test Dlib’s Python example
Subscribe & Download Code
If you liked this article and would like to download code (C++ and Python) and example images used in this post, please click here. Alternately, sign up to receive a free Computer Vision Resource Guide. In our newsletter, we share OpenCV tutorials and examples written in C++/Python, and Computer Vision and Machine Learning algorithms and news.
Русские Блоги
Введение в библиотеку dlib под windows, решение проблем с установкой и простые примеры (python)
1. Введение в dlib
Dlib — это современный фреймворк C ++, который решает проблемы реализации алгоритмов машинного обучения и разработки сложного программного обеспечения. Он широко используется в промышленных и академических областях исследований, включая роботов, встраиваемые устройства и мобильные телефоны. А в крупномасштабной высокопроизводительной вычислительной среде открытый исходный код DLib делает его удобным и бесплатным.
Основные возможности Dlib: полная документация, высококачественный код, алгоритмы машинного обучения, алгоритмы научных вычислений, алгоритмы вывода модели графа, обработка изображений, многопоточность, сетевое программирование, графический пользовательский интерфейс, сжатие данных А алгоритм интеграции можно посмотреть в описании официального сайта:http://dlib.net
Два, установка dlib
Установка библиотеки dlib все еще обычно сталкивается с небольшими проблемами, и мне потребовалось много времени, чтобы использовать ее в первый раз. Позвольте мне объяснить здесь, что моя среда — 64-битная win7 + Python3.6.6 + opencv-python 4.0.0.21.
1. Сначала установите модуль opencv
напрямую введите pip install opencv-python в режиме cmd
2. Установите библиотеку dlib.
В Интернете есть много мнений. Большинство из них говорят, что сначала нужно установить cmake и boost, но это не обязательно. Вот два простых метода:
Метод 1. Введите pip install dlib == 19.6.1 непосредственно в режиме cmd, как показано на рисунке ниже (конечно, вы также можете установить другие версии, метод аналогичен, я установил его позже 19.7.0 версия)
Метод 2. Установка непосредственно в pycharm (но обратите внимание на соответствующий номер версии, потому что pycharm по умолчанию является последней версией)
File-settings-Project Interpreter-…
Дополнение: установка прошла успешно, когда я пришел сюда, но некоторые друзья, должно быть, обнаружили, что, хотя проблем с import dlib нет, при запуске кода сообщалось об ошибке: Detector = dlib.get_frontal_face_detector () AttributeError: module ‘ dlib ‘не имеет атрибута’get_frontal_face_detector’ или не может открыть’get_frontal_face_detector ‘и другие проблемы, поскольку вы не загрузили библиотеку лиц shape_predictor_68_face_landmarks, вам необходимо загрузить ее, разархивировать и поместить в папку, где находится ваш код.
Ссылка для загрузки библиотеки Face:http://dlib.net/files/shape_predictor_68_face_landmarks.dat.bz2
3. Простой небольшой пример: обнаружение лиц и выделение ключевых точек на любом изображении.
(1) Принцип и шаги:
а) Сначала прочтите изображение с помощью opencv (img = cv2.imread («duoren.jpg»)
б) Вызовите средство извлечения лиц, предоставленное библиотекой dlib, и обнаружите, что на изображении нет лиц. Если лиц нет, выведите количество обнаруженных лиц и выполните выделение ориентиров. Вывод: лицо не обнаружено
Detector = dlib.get_frontal_face_detector () # Используйте средство извлечения лиц, предоставленное библиотекой dlib
predictor = dlib.shape_predictor (‘shape_predictor_68_face_landmarks.dat’) # Создайте средство извлечения функций
c) Используйте cv2.circle, чтобы нарисовать круг для каждой характерной точки, всего 68
cv2.circle(img, pos, 5, color=(0, 255, 0))
(2) Отображение эффекта:
Рис. 1. Режим одиночной игры.
Рис. 2. Многопользовательский режим.
4. Получение кода:
Отсканируйте код и следуйте за общедоступной учетной записью WeChat «StrongerTang», введите ключевое слово «dlib small example», чтобы получить его.
Другие материалы доступны бесплатно.
I tried a lot to install pip install dlib
but it always shows an error and I reinstalled cmake
.
pip install dlib Collecting dlib Using cached https://files.pythonhosted.org/packages/1e/62/aacb236d21fbd08148b1d517d58a9d80ea31bdcd386d26f21f8b23b1eb28/dlib-19.18.0.tar.gz Building wheels for collected packages: dlib Building wheel for dlib (setup.py) ... error ERROR: Command errored out with exit status 1: command: 'c:program filespython37python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:UsershpAppDataLocalTemppip-install-yynf7muedlibsetup.py'"'"'; __file__='"'"'C:UsershpAppDataLocalTemppip-install-yynf7muedlibsetup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:UsershpAppDataLocalTemppip-wheel-0eyy_3vd' --python-tag cp37 cwd: C:UsershpAppDataLocalTemppip-install-yynf7muedlib Complete output (55 lines): 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.4 (tags/v3.7.4:e09359112e, Jul 8 2019, 20:34:20) [MSC v.1916 64 bit (AMD64)] Invoking CMake setup: 'cmake C:UsershpAppDataLocalTemppip-install-yynf7muedlibtoolspython -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:UsershpAppDataLocalTemppip-install-yynf7muedlibbuildlib.win-amd64-3.7 -DPYTHON_EXECUTABLE=c:program filespython37python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:UsershpAppDataLocalTemppip-install-yynf7muedlibbuildlib.win-amd64-3.7 -A x64' -- Building for: NMake Makefiles CMake Error at CMakeLists.txt:3 (project): 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/hp/AppData/Local/Temp/pip-install-yynf7mue/dlib/build/temp.win-amd64-3.7/Release/CMakeFiles/CMakeOutput.log". Traceback (most recent call last): File "<string>", line 1, in <module> File "C:UsershpAppDataLocalTemppip-install-yynf7muedlibsetup.py", line 261, in <module> 'Topic :: Software Development', File "c:program filespython37libsite-packagessetuptools__init__.py", line 145, in setup return distutils.core.setup(**attrs) File "c:program filespython37libdistutilscore.py", line 148, in setup dist.run_commands() File "c:program filespython37libdistutilsdist.py", line 966, in run_commands self.run_command(cmd) File "c:program filespython37libdistutilsdist.py", line 985, in run_command cmd_obj.run() File "c:program filespython37libsite-packageswheelbdist_wheel.py", line 192, in run self.run_command('build') File "c:program filespython37libdistutilscmd.py", line 313, in run_command self.distribution.run_command(command) File "c:program filespython37libdistutilsdist.py", line 985, in run_command cmd_obj.run() File "c:program filespython37libdistutilscommandbuild.py", line 135, in run self.run_command(cmd_name) File "c:program filespython37libdistutilscmd.py", line 313, in run_command self.distribution.run_command(command) File "c:program filespython37libdistutilsdist.py", line 985, in run_command cmd_obj.run() File "C:UsershpAppDataLocalTemppip-install-yynf7muedlibsetup.py", line 135, in run self.build_extension(ext) File "C:UsershpAppDataLocalTemppip-install-yynf7muedlibsetup.py", line 172, in build_extension subprocess.check_call(cmake_setup, cwd=build_folder) File "c:program filespython37libsubprocess.py", line 347, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['cmake', 'C:UsershpAppDataLocalTemppip-install-yynf7muedlibtoolspython', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:UsershpAppDataLocalTemppip-install-yynf7muedlibbuildlib.win-amd64-3.7', '-DPYTHON_EXECUTABLE=c:program filespython37python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:UsershpAppDataLocalTemppip-install-yynf7muedlibbuildlib.win-amd64-3.7', '-A', 'x64']' returned non-zero exit status 1. ---------------------------------------- ERROR: 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 ERROR: Command errored out with exit status 1: command: 'c:program filespython37python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:UsershpAppDataLocalTemppip-install-yynf7muedlibsetup.py'"'"'; __file__='"'"'C:UsershpAppDataLocalTemppip-install-yynf7muedlibsetup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:UsershpAppDataLocalTemppip-record-qzmuuf53install-record.txt' --single-version-externally-managed --compile cwd: C:UsershpAppDataLocalTemppip-install-yynf7muedlib Complete output (57 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 (tags/v3.7.4:e09359112e, Jul 8 2019, 20:34:20) [MSC v.1916 64 bit (AMD64)] Invoking CMake setup: 'cmake C:UsershpAppDataLocalTemppip-install-yynf7muedlibtoolspython -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:UsershpAppDataLocalTemppip-install-yynf7muedlibbuildlib.win-amd64-3.7 -DPYTHON_EXECUTABLE=c:program filespython37python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:UsershpAppDataLocalTemppip-install-yynf7muedlibbuildlib.win-amd64-3.7 -A x64' -- Building for: NMake Makefiles CMake Error at CMakeLists.txt:3 (project): 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/hp/AppData/Local/Temp/pip-install-yynf7mue/dlib/build/temp.win-amd64-3.7/Release/CMakeFiles/CMakeOutput.log". Traceback (most recent call last): File "<string>", line 1, in <module> File "C:UsershpAppDataLocalTemppip-install-yynf7muedlibsetup.py", line 261, in <module> 'Topic :: Software Development', File "c:program filespython37libsite-packagessetuptools__init__.py", line 145, in setup return distutils.core.setup(**attrs) File "c:program filespython37libdistutilscore.py", line 148, in setup dist.run_commands() File "c:program filespython37libdistutilsdist.py", line 966, in run_commands self.run_command(cmd) File "c:program filespython37libdistutilsdist.py", line 985, in run_command cmd_obj.run() File "c:program filespython37libsite-packagessetuptoolscommandinstall.py", line 61, in run return orig.install.run(self) File "c:program filespython37libdistutilscommandinstall.py", line 545, in run self.run_command('build') File "c:program filespython37libdistutilscmd.py", line 313, in run_command self.distribution.run_command(command) File "c:program filespython37libdistutilsdist.py", line 985, in run_command cmd_obj.run() File "c:program filespython37libdistutilscommandbuild.py", line 135, in run self.run_command(cmd_name) File "c:program filespython37libdistutilscmd.py", line 313, in run_command self.distribution.run_command(command) File "c:program filespython37libdistutilsdist.py", line 985, in run_command cmd_obj.run() File "C:UsershpAppDataLocalTemppip-install-yynf7muedlibsetup.py", line 135, in run self.build_extension(ext) File "C:UsershpAppDataLocalTemppip-install-yynf7muedlibsetup.py", line 172, in build_extension subprocess.check_call(cmake_setup, cwd=build_folder) File "c:program filespython37libsubprocess.py", line 347, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['cmake', 'C:UsershpAppDataLocalTemppip-install-yynf7muedlibtoolspython', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:UsershpAppDataLocalTemppip-install-yynf7muedlibbuildlib.win-amd64-3.7', '-DPYTHON_EXECUTABLE=c:program filespython37python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:UsershpAppDataLocalTemppip-install-yynf7muedlibbuildlib.win-amd64-3.7', '-A', 'x64']' returned non-zero exit status 1. ---------------------------------------- ERROR: Command errored out with exit status 1: 'c:program filespython37python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:UsershpAppDataLocalTemppip-install-yynf7muedlibsetup.py'"'"'; __file__='"'"'C:UsershpAppDataLocalTemppip-install-yynf7muedlibsetup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:UsershpAppDataLocalTemppip-record-qzmuuf53install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
Microsoft Windows [Version 6.3.9600]
(c) Корпорация Майкрософт (Microsoft Corporation), 2013. Все права защищены.
C:UsersПользователь>cd C:UsersПользовательDesktopabcface_recognition
C:UsersПользовательDesktopabcface_recognition>pip install -r requirements.t
xt
Requirement already satisfied: face_recognition_models in c:usersпользователь
appdatalocalprogramspythonpython39libsite-packages (from -r requirements.t
xt (line 1)) (0.3.0)
Requirement already satisfied: Click>=6.0 in c:usersпользовательappdatalocal
programspythonpython39libsite-packages (from -r requirements.txt (line 2))
(7.1.2)
Requirement already satisfied: numpy in c:usersпользовательappdatalocalprog
ramspythonpython39libsite-packages (from -r requirements.txt (line 4)) (1.19
.5)
Requirement already satisfied: Pillow in c:usersпользовательappdatalocalpro
gramspythonpython39libsite-packages (from -r requirements.txt (line 5)) (8.1
.0)
Requirement already satisfied: scipy>=0.17.0 in c:usersпользовательappdatalo
calprogramspythonpython39libsite-packages (from -r requirements.txt (line 6
)) (1.6.0)
Collecting dlib>=19.3.0
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 … error
ERROR: Command errored out with exit status 1:
command: ‘c:usersпользовательappdatalocalprogramspythonpython39pyth
on.exe’ -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘»‘»‘C:\Users\П
ользователь\AppData\Local\Temp\pip-install-gvk7i_m4\dlib_d9750b72c6af4a139f
a1acc1550d2cea\setup.py'»‘»‘; __file__='»‘»‘C:\Users\Пользователь\AppData\L
ocal\Temp\pip-install-gvk7i_m4\dlib_d9750b72c6af4a139fa1acc1550d2cea\setup.p
y'»‘»‘;f=getattr(tokenize, ‘»‘»‘open'»‘»‘, open)(__file__);code=f.read().replace
(‘»‘»‘rn'»‘»‘, ‘»‘»‘n'»‘»‘);f.close();exec(compile(code, __file__, ‘»‘»‘exec’
«‘»‘))’ install —record ‘C:UsersПользовательAppDataLocalTemppip-record-u0
po2078install-record.txt’ —single-version-externally-managed —compile —insta
ll-headers ‘c:usersпользовательappdatalocalprogramspythonpython39Include
dlib’
cwd: C:UsersПользовательAppDataLocalTemppip-install-gvk7i_m4dlib
_d9750b72c6af4a139fa1acc1550d2cea
Complete output (55 lines):
running install
running build
running build_py
package init file ‘toolspythondlib__init__.py’ not found (or not a regula
r file)
running build_ext
Traceback (most recent call last):
File «C:UsersПользовательAppDataLocalTemppip-install-gvk7i_m4dlib_d
9750b72c6af4a139fa1acc1550d2ceasetup.py», line 120, in get_cmake_version
out = subprocess.check_output([‘cmake’, ‘—version’])
File «c:usersпользовательappdatalocalprogramspythonpython39libsub
process.py», line 420, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File «c:usersпользовательappdatalocalprogramspythonpython39libsub
process.py», line 501, in run
with Popen(*popenargs, **kwargs) as process:
File «c:usersпользовательappdatalocalprogramspythonpython39libsub
process.py», line 947, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File «c:usersпользовательappdatalocalprogramspythonpython39libsub
process.py», line 1416, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] Не удается найти указанный файл
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File «<string>», line 1, in <module>
File «C:UsersПользовательAppDataLocalTemppip-install-gvk7i_m4dlib_d
9750b72c6af4a139fa1acc1550d2ceasetup.py», line 223, in <module>
setup(
File «c:usersпользовательappdatalocalprogramspythonpython39libsit
e-packagessetuptools__init__.py», line 165, in setup
return distutils.core.setup(**attrs)
File «c:usersпользовательappdatalocalprogramspythonpython39libdis
tutilscore.py», line 148, in setup
dist.run_commands()
File «c:usersпользовательappdatalocalprogramspythonpython39libdis
tutilsdist.py», line 966, in run_commands
self.run_command(cmd)
File «c:usersпользовательappdatalocalprogramspythonpython39libdis
tutilsdist.py», line 985, in run_command
cmd_obj.run()
File «c:usersпользовательappdatalocalprogramspythonpython39libsit
e-packagessetuptoolscommandinstall.py», line 61, in run
return orig.install.run(self)
File «c:usersпользовательappdatalocalprogramspythonpython39libdis
tutilscommandinstall.py», line 546, in run
self.run_command(‘build’)
File «c:usersпользовательappdatalocalprogramspythonpython39libdis
tutilscmd.py», line 313, in run_command
self.distribution.run_command(command)
File «c:usersпользовательappdatalocalprogramspythonpython39libdis
tutilsdist.py», line 985, in run_command
cmd_obj.run()
File «c:usersпользовательappdatalocalprogramspythonpython39libdis
tutilscommandbuild.py», line 135, in run
self.run_command(cmd_name)
File «c:usersпользовательappdatalocalprogramspythonpython39libdis
tutilscmd.py», line 313, in run_command
self.distribution.run_command(command)
File «c:usersпользовательappdatalocalprogramspythonpython39libdis
tutilsdist.py», line 985, in run_command
cmd_obj.run()
File «C:UsersПользовательAppDataLocalTemppip-install-gvk7i_m4dlib_d
9750b72c6af4a139fa1acc1550d2ceasetup.py», line 129, in run
cmake_version = self.get_cmake_version()
File «C:UsersПользовательAppDataLocalTemppip-install-gvk7i_m4dlib_d
9750b72c6af4a139fa1acc1550d2ceasetup.py», line 122, in get_cmake_version
raise RuntimeError(«n**************************************************
*****************n» +
RuntimeError:
*******************************************************************
CMake must be installed to build the following extensions: _dlib_pybind11
*******************************************************************
—————————————-
ERROR: Command errored out with exit status 1: ‘c:usersпользовательappdatalo
calprogramspythonpython39python.exe’ -u -c ‘import sys, setuptools, tokenize
; sys.argv[0] = ‘»‘»‘C:\Users\Пользователь\AppData\Local\Temp\pip-install-
gvk7i_m4\dlib_d9750b72c6af4a139fa1acc1550d2cea\setup.py'»‘»‘; __file__='»‘»‘C:
\Users\Пользователь\AppData\Local\Temp\pip-install-gvk7i_m4\dlib_d9750b72
c6af4a139fa1acc1550d2cea\setup.py'»‘»‘;f=getattr(tokenize, ‘»‘»‘open'»‘»‘, open
)(__file__);code=f.read().replace(‘»‘»‘rn'»‘»‘, ‘»‘»‘n'»‘»‘);f.close();exec(c
ompile(code, __file__, ‘»‘»‘exec'»‘»‘))’ install —record ‘C:UsersПользователь
AppDataLocalTemppip-record-u0po2078install-record.txt’ —single-version-ext
ernally-managed —compile —install-headers ‘c:usersпользовательappdatalocal
programspythonpython39Includedlib’ Check the logs for full command output.
C:UsersПользовательDesktopabcface_recognition>