简体   繁体   中英

How can I install dlib in macOS when Cmake is reporting error and re-install doesn't work

Trying to download dlib for face_recognition, already downloaded openCV but encountered an error during the process/

I have tried:

  1. pip install dlib , pip3 install dlib and
  2. brew install dlib

I encountered the same error during 1 and different for 2, as follows:

“Error: The following formula
[#, #]
cannot be installed as binary package and must be built from source.
Install the Command Line Tools:
xcode-select –install”

I then try to run xcode-select –intall and failed too...

Anyway, for sake of your ease to read, I'll try to hand-pick the error highlight for you first, as follow:

_"ERROR: Command errored out with exit status 1:”_


_“package init file ‘dlib/__init__.py’ not found (or not a regular file)”_


_“Invoking CMake setup:…..
The C compiler identification is unknown
The CXX compiler identification is unknown
Check for working C compiler: /usr/bin/cc — broken”_


_“The C compiler . “/usr/bin/cc” . is not able to compile a simple test program.”_


_“CMake will not be able to correctly generate this project.”_


_” — Configuring incomplete, errors occurred!”_


_“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:”_

-----------------------------------------------------------
Collecting dlib
Using cached https://files.pythonhosted.org/packages/1e/62/aacb236d21fbd08148b1d517d58a9d80ea31bdcd386d26f21f8b23b1eb28/dlib-19.18.0.tar.gz

#error starts here

Building wheels for collected packages: dlib
Building wheel for dlib (setup.py) … error
ERROR: Command errored out with exit status 1:
command: /Users/bear/.virtualenvs/py3_dlib/bin/python3 -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘”‘”‘/private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-install-zk1urcsc/dlib/setup.py'”‘”‘; __file__='”‘”‘/private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-install-zk1urcsc/dlib/setup.py'”‘”‘;f=getattr(tokenize, ‘”‘”‘open'”‘”‘, open)(__file__);code=f.read().replace(‘”‘”‘\r\n'”‘”‘, ‘”‘”‘\n'”‘”‘);f.close();exec(compile(code, __file__, ‘”‘”‘exec'”‘”‘))’ bdist_wheel -d /private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-wheel-vlvkpttg –python-tag cp37
cwd: /private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-install-zk1urcsc/dlib/
Complete output (67 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.3 (default, Mar 27 2019, 16:54:48)
Invoking CMake setup: ‘cmake /private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-install-zk1urcsc/dlib/tools/python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-install-zk1urcsc/dlib/build/lib.macosx-10.7-x86_64-3.7 -DPYTHON_EXECUTABLE=/Users/bear/.virtualenvs/py3_dlib/bin/python3 -DCMAKE_BUILD_TYPE=Release’
— The C compiler identification is unknown
— The CXX compiler identification is unknown
— Check for working C compiler: /usr/bin/cc
— Check for working C compiler: /usr/bin/cc — broken
CMake Error at /usr/local/Cellar/cmake/3.15.3/share/cmake/Modules/CMakeTestCCompiler.cmake:60 (message):
The C compiler

“/usr/bin/cc”

is not able to compile a simple test program.

It fails with the following output:

Change Dir: /private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-install-zk1urcsc/dlib/build/temp.macosx-10.7-x86_64-3.7/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/make cmTC_cc287/fast && xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:3 (project)

— Configuring incomplete, errors occurred!
See also “/private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-install-zk1urcsc/dlib/build/temp.macosx-10.7-x86_64-3.7/CMakeFiles/CMakeOutput.log”.
See also “/private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-install-zk1urcsc/dlib/build/temp.macosx-10.7-x86_64-3.7/CMakeFiles/CMakeError.log”.
Traceback (most recent call last):
File “”, line 1, in
File “/private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-install-zk1urcsc/dlib/setup.py”, line 261, in
‘Topic :: Software Development’,
File “/Users/bear/.virtualenvs/py3_dlib/lib/python3.7/site-packages/setuptools/__init__.py”, line 145, in setup
return distutils.core.setup(**attrs)
File “/anaconda3/lib/python3.7/distutils/core.py”, line 148, in setup
dist.run_commands()
File “/anaconda3/lib/python3.7/distutils/dist.py”, line 966, in run_commands
self.run_command(cmd)
File “/anaconda3/lib/python3.7/distutils/dist.py”, line 985, in run_command
cmd_obj.run()
File “/Users/bear/.virtualenvs/py3_dlib/lib/python3.7/site-packages/wheel/bdist_wheel.py”, line 192, in run
self.run_command(‘build’)
File “/anaconda3/lib/python3.7/distutils/cmd.py”, line 313, in run_command
self.distribution.run_command(command)
File “/anaconda3/lib/python3.7/distutils/dist.py”, line 985, in run_command
cmd_obj.run()
File “/anaconda3/lib/python3.7/distutils/command/build.py”, line 135, in run
self.run_command(cmd_name)
File “/anaconda3/lib/python3.7/distutils/cmd.py”, line 313, in run_command
self.distribution.run_command(command)
File “/anaconda3/lib/python3.7/distutils/dist.py”, line 985, in run_command
cmd_obj.run()
File “/private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-install-zk1urcsc/dlib/setup.py”, line 135, in run
self.build_extension(ext)
File “/private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-install-zk1urcsc/dlib/setup.py”, line 172, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File “/anaconda3/lib/python3.7/subprocess.py”, line 347, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command ‘[‘cmake’, ‘/private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-install-zk1urcsc/dlib/tools/python’, ‘-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-install-zk1urcsc/dlib/build/lib.macosx-10.7-x86_64-3.7’, ‘-DPYTHON_EXECUTABLE=/Users/bear/.virtualenvs/py3_dlib/bin/python3’, ‘-DCMAKE_BUILD_TYPE=Release’]’ 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: /Users/bear/.virtualenvs/py3_dlib/bin/python3 -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘”‘”‘/private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-install-zk1urcsc/dlib/setup.py'”‘”‘; __file__='”‘”‘/private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-install-zk1urcsc/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 /private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-record-wwx0654z/install-record.txt –single-version-externally-managed –compile –install-headers /Users/bear/.virtualenvs/py3_dlib/include/site/python3.7/dlib
cwd: /private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-install-zk1urcsc/dlib/
Complete output (69 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.3 (default, Mar 27 2019, 16:54:48)
Invoking CMake setup: ‘cmake /private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-install-zk1urcsc/dlib/tools/python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-install-zk1urcsc/dlib/build/lib.macosx-10.7-x86_64-3.7 -DPYTHON_EXECUTABLE=/Users/bear/.virtualenvs/py3_dlib/bin/python3 -DCMAKE_BUILD_TYPE=Release’
— The C compiler identification is unknown
— The CXX compiler identification is unknown
— Check for working C compiler: /usr/bin/cc
— Check for working C compiler: /usr/bin/cc — broken
CMake Error at /usr/local/Cellar/cmake/3.15.3/share/cmake/Modules/CMakeTestCCompiler.cmake:60 (message):
The C compiler

“/usr/bin/cc”

is not able to compile a simple test program.

It fails with the following output:

Change Dir: /private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-install-zk1urcsc/dlib/build/temp.macosx-10.7-x86_64-3.7/CMakeFiles/CMakeTmp

Run Build Command(s):/usr/bin/make cmTC_648b7/fast && xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:3 (project)

— Configuring incomplete, errors occurred!
See also “/private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-install-zk1urcsc/dlib/build/temp.macosx-10.7-x86_64-3.7/CMakeFiles/CMakeOutput.log”.
See also “/private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-install-zk1urcsc/dlib/build/temp.macosx-10.7-x86_64-3.7/CMakeFiles/CMakeError.log”.
Traceback (most recent call last):
File “”, line 1, in
File “/private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-install-zk1urcsc/dlib/setup.py”, line 261, in
‘Topic :: Software Development’,
File “/Users/bear/.virtualenvs/py3_dlib/lib/python3.7/site-packages/setuptools/__init__.py”, line 145, in setup
return distutils.core.setup(**attrs)
File “/anaconda3/lib/python3.7/distutils/core.py”, line 148, in setup
dist.run_commands()
File “/anaconda3/lib/python3.7/distutils/dist.py”, line 966, in run_commands
self.run_command(cmd)
File “/anaconda3/lib/python3.7/distutils/dist.py”, line 985, in run_command
cmd_obj.run()
File “/Users/bear/.virtualenvs/py3_dlib/lib/python3.7/site-packages/setuptools/command/install.py”, line 61, in run
return orig.install.run(self)
File “/anaconda3/lib/python3.7/distutils/command/install.py”, line 545, in run
self.run_command(‘build’)
File “/anaconda3/lib/python3.7/distutils/cmd.py”, line 313, in run_command
self.distribution.run_command(command)
File “/anaconda3/lib/python3.7/distutils/dist.py”, line 985, in run_command
cmd_obj.run()
File “/anaconda3/lib/python3.7/distutils/command/build.py”, line 135, in run
self.run_command(cmd_name)
File “/anaconda3/lib/python3.7/distutils/cmd.py”, line 313, in run_command
self.distribution.run_command(command)
File “/anaconda3/lib/python3.7/distutils/dist.py”, line 985, in run_command
cmd_obj.run()
File “/private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-install-zk1urcsc/dlib/setup.py”, line 135, in run
self.build_extension(ext)
File “/private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-install-zk1urcsc/dlib/setup.py”, line 172, in build_extension
subprocess.check_call(cmake_setup, cwd=build_folder)
File “/anaconda3/lib/python3.7/subprocess.py”, line 347, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command ‘[‘cmake’, ‘/private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-install-zk1urcsc/dlib/tools/python’, ‘-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-install-zk1urcsc/dlib/build/lib.macosx-10.7-x86_64-3.7’, ‘-DPYTHON_EXECUTABLE=/Users/bear/.virtualenvs/py3_dlib/bin/python3’, ‘-DCMAKE_BUILD_TYPE=Release’]’ returned non-zero exit status 1.
—————————————-
ERROR: Command errored out with exit status 1: /Users/bear/.virtualenvs/py3_dlib/bin/python3 -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘”‘”‘/private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-install-zk1urcsc/dlib/setup.py'”‘”‘; __file__='”‘”‘/private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-install-zk1urcsc/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 /private/var/folders/zc/mbmg3rf17ns4v7yfk52qbf680000gn/T/pip-record-wwx0654z/install-record.txt –single-version-externally-managed –compile –install-headers /Users/bear/.virtualenvs/py3_dlib/include/site/python3.7/dlib Check the logs for full command output.

try this link

How can I solve Error of installation Dlib? .

dlib 19.17 is supported for python 3.6 to 3.7.0 if the dlib version is above then it leads to numpy error

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM