1

I am trying to install dlib on my Mac OS X (10.15.6), but I'm not successful.

I already have Python 3.7, OpenCV 4.3, cmake, XQuarts and Xcode installed and working on my laptop. Really appreciate your help!

The following is the very long error message I keep getting!

Please let me know if I can provide more detail. Much appreciate it!

Collecting dlib
  Using cached dlib-19.21.0.tar.gz (3.2 MB)
Building wheels for collected packages: dlib
  Building wheel for dlib (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /Users/mehipour/anaconda3/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/cg/ww2hlv_510b6y0wgfh2w425w0000gn/T/pip-install-13tc8pwi/dlib/setup.py'"'"'; __file__='"'"'/private/var/folders/cg/ww2hlv_510b6y0wgfh2w425w0000gn/T/pip-install-13tc8pwi/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/cg/ww2hlv_510b6y0wgfh2w425w0000gn/T/pip-wheel-94za5_u_
       cwd: /private/var/folders/cg/ww2hlv_510b6y0wgfh2w425w0000gn/T/pip-install-13tc8pwi/dlib/
  Complete output (79 lines):
  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.7.3 (default, Mar 27 2019, 16:54:48)
  Invoking CMake setup: 'cmake /private/var/folders/cg/ww2hlv_510b6y0wgfh2w425w0000gn/T/pip-install-13tc8pwi/dlib/tools/python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/private/var/folders/cg/ww2hlv_510b6y0wgfh2w425w0000gn/T/pip-install-13tc8pwi/dlib/build/lib.macosx-10.9-x86_64-3.7 -DPYTHON_EXECUTABLE=/Users/mehipour/anaconda3/bin/python -DCMAKE_BUILD_TYPE=Release'
  -- The C compiler identification is Clang 4.0.1
  -- The CXX compiler identification is Clang 4.0.1
  -- Detecting C compiler ABI info
  -- Detecting C compiler ABI info - failed
  -- Check for working C compiler: /Users/mehipour/anaconda3/bin/x86_64-apple-darwin13.4.0-clang
  -- Check for working C compiler: /Users/mehipour/anaconda3/bin/x86_64-apple-darwin13.4.0-clang - broken
  CMake Error at /usr/local/Cellar/cmake/3.18.1/share/cmake/Modules/CMakeTestCCompiler.cmake:66 (message):
    The C compiler
  
      "/Users/mehipour/anaconda3/bin/x86_64-apple-darwin13.4.0-clang"
  
    is not able to compile a simple test program.
  
    It fails with the following output:
  
      Change Dir: /private/var/folders/cg/ww2hlv_510b6y0wgfh2w425w0000gn/T/pip-install-13tc8pwi/dlib/build/temp.macosx-10.9-x86_64-3.7/CMakeFiles/CMakeTmp
  
      Run Build Command(s):/usr/bin/make cmTC_1a32f/fast && /Library/Developer/CommandLineTools/usr/bin/make  -f CMakeFiles/cmTC_1a32f.dir/build.make CMakeFiles/cmTC_1a32f.dir/build
      Building C object CMakeFiles/cmTC_1a32f.dir/testCCompiler.c.o
      /Users/mehipour/anaconda3/bin/x86_64-apple-darwin13.4.0-clang   -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -o CMakeFiles/cmTC_1a32f.dir/testCCompiler.c.o -c /private/var/folders/cg/ww2hlv_510b6y0wgfh2w425w0000gn/T/pip-install-13tc8pwi/dlib/build/temp.macosx-10.9-x86_64-3.7/CMakeFiles/CMakeTmp/testCCompiler.c
      Linking C executable cmTC_1a32f
      /usr/local/Cellar/cmake/3.18.1/bin/cmake -E cmake_link_script CMakeFiles/cmTC_1a32f.dir/link.txt --verbose=1
      /Users/mehipour/anaconda3/bin/x86_64-apple-darwin13.4.0-clang -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs  CMakeFiles/cmTC_1a32f.dir/testCCompiler.c.o -o cmTC_1a32f
      ld: warning: ignoring file /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/lib/libSystem.tbd, file was built for unsupported file format ( 0x2D 0x2D 0x2D 0x20 0x21 0x74 0x61 0x70 0x69 0x2D 0x74 0x62 0x64 0x0A 0x74 0x62 ) which is not the architecture being linked (x86_64): /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/lib/libSystem.tbd
      ld: dynamic main executables must link with libSystem.dylib for architecture x86_64
      clang-4.0: error: linker command failed with exit code 1 (use -v to see invocation)
      make[1]: *** [cmTC_1a32f] Error 1
      make: *** [cmTC_1a32f/fast] Error 2
  
  
  
  
  
    CMake will not be able to correctly generate this project.
  Call Stack (most recent call first):
    CMakeLists.txt:14 (project)
  
  
  -- Configuring incomplete, errors occurred!
  See also "/private/var/folders/cg/ww2hlv_510b6y0wgfh2w425w0000gn/T/pip-install-13tc8pwi/dlib/build/temp.macosx-10.9-x86_64-3.7/CMakeFiles/CMakeOutput.log".
  See also "/private/var/folders/cg/ww2hlv_510b6y0wgfh2w425w0000gn/T/pip-install-13tc8pwi/dlib/build/temp.macosx-10.9-x86_64-3.7/CMakeFiles/CMakeError.log".
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/private/var/folders/cg/ww2hlv_510b6y0wgfh2w425w0000gn/T/pip-install-13tc8pwi/dlib/setup.py", line 262, in <module>
      'Topic :: Software Development',
    File "/Users/mehipour/anaconda3/lib/python3.7/site-packages/setuptools/__init__.py", line 145, in setup
      return distutils.core.setup(**attrs)
    File "/Users/mehipour/anaconda3/lib/python3.7/distutils/core.py", line 148, in setup
      dist.run_commands()
    File "/Users/mehipour/anaconda3/lib/python3.7/distutils/dist.py", line 966, in run_commands
      self.run_command(cmd)
    File "/Users/mehipour/anaconda3/lib/python3.7/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/Users/mehipour/anaconda3/lib/python3.7/site-packages/wheel/bdist_wheel.py", line 192, in run
      self.run_command('build')
    File "/Users/mehipour/anaconda3/lib/python3.7/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/Users/mehipour/anaconda3/lib/python3.7/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/Users/mehipour/anaconda3/lib/python3.7/distutils/command/build.py", line 135, in run
      self.run_command(cmd_name)
    File "/Users/mehipour/anaconda3/lib/python3.7/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/Users/mehipour/anaconda3/lib/python3.7/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/private/var/folders/cg/ww2hlv_510b6y0wgfh2w425w0000gn/T/pip-install-13tc8pwi/dlib/setup.py", line 135, in run
      self.build_extension(ext)
    File "/private/var/folders/cg/ww2hlv_510b6y0wgfh2w425w0000gn/T/pip-install-13tc8pwi/dlib/setup.py", line 172, in build_extension
      subprocess.check_call(cmake_setup, cwd=build_folder)
    File "/Users/mehipour/anaconda3/lib/python3.7/subprocess.py", line 347, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command '['cmake', '/private/var/folders/cg/ww2hlv_510b6y0wgfh2w425w0000gn/T/pip-install-13tc8pwi/dlib/tools/python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/private/var/folders/cg/ww2hlv_510b6y0wgfh2w425w0000gn/T/pip-install-13tc8pwi/dlib/build/lib.macosx-10.9-x86_64-3.7', '-DPYTHON_EXECUTABLE=/Users/mehipour/anaconda3/bin/python', '-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
DEPRECATION: Could not build wheels for dlib which do not use PEP 517. pip will fall back to legacy 'setup.py install' for these. pip 21.0 will remove support for this functionality. A possible replacement is to fix the wheel build issue reported above. You can find discussion regarding this at https://github.com/pypa/pip/issues/8368.
Installing collected packages: dlib
    Running setup.py install for dlib ... error
    ERROR: Command errored out with exit status 1:
     command: /Users/mehipour/anaconda3/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/cg/ww2hlv_510b6y0wgfh2w425w0000gn/T/pip-install-13tc8pwi/dlib/setup.py'"'"'; __file__='"'"'/private/var/folders/cg/ww2hlv_510b6y0wgfh2w425w0000gn/T/pip-install-13tc8pwi/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/cg/ww2hlv_510b6y0wgfh2w425w0000gn/T/pip-record-04q_e2mw/install-record.txt --single-version-externally-managed --compile --install-headers /Users/mehipour/anaconda3/include/python3.7m/dlib
         cwd: /private/var/folders/cg/ww2hlv_510b6y0wgfh2w425w0000gn/T/pip-install-13tc8pwi/dlib/
    Complete output (81 lines):
    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.7.3 (default, Mar 27 2019, 16:54:48)
    Invoking CMake setup: 'cmake /private/var/folders/cg/ww2hlv_510b6y0wgfh2w425w0000gn/T/pip-install-13tc8pwi/dlib/tools/python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/private/var/folders/cg/ww2hlv_510b6y0wgfh2w425w0000gn/T/pip-install-13tc8pwi/dlib/build/lib.macosx-10.9-x86_64-3.7 -DPYTHON_EXECUTABLE=/Users/mehipour/anaconda3/bin/python -DCMAKE_BUILD_TYPE=Release'
    -- The C compiler identification is Clang 4.0.1
    -- The CXX compiler identification is Clang 4.0.1
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - failed
    -- Check for working C compiler: /Users/mehipour/anaconda3/bin/x86_64-apple-darwin13.4.0-clang
    -- Check for working C compiler: /Users/mehipour/anaconda3/bin/x86_64-apple-darwin13.4.0-clang - broken
    CMake Error at /usr/local/Cellar/cmake/3.18.1/share/cmake/Modules/CMakeTestCCompiler.cmake:66 (message):
      The C compiler
    
        "/Users/mehipour/anaconda3/bin/x86_64-apple-darwin13.4.0-clang"
    
      is not able to compile a simple test program.
    
      It fails with the following output:
    
        Change Dir: /private/var/folders/cg/ww2hlv_510b6y0wgfh2w425w0000gn/T/pip-install-13tc8pwi/dlib/build/temp.macosx-10.9-x86_64-3.7/CMakeFiles/CMakeTmp
    
        Run Build Command(s):/usr/bin/make cmTC_76b3f/fast && /Library/Developer/CommandLineTools/usr/bin/make  -f CMakeFiles/cmTC_76b3f.dir/build.make CMakeFiles/cmTC_76b3f.dir/build
        Building C object CMakeFiles/cmTC_76b3f.dir/testCCompiler.c.o
        /Users/mehipour/anaconda3/bin/x86_64-apple-darwin13.4.0-clang   -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -o CMakeFiles/cmTC_76b3f.dir/testCCompiler.c.o -c /private/var/folders/cg/ww2hlv_510b6y0wgfh2w425w0000gn/T/pip-install-13tc8pwi/dlib/build/temp.macosx-10.9-x86_64-3.7/CMakeFiles/CMakeTmp/testCCompiler.c
        Linking C executable cmTC_76b3f
        /usr/local/Cellar/cmake/3.18.1/bin/cmake -E cmake_link_script CMakeFiles/cmTC_76b3f.dir/link.txt --verbose=1
        /Users/mehipour/anaconda3/bin/x86_64-apple-darwin13.4.0-clang -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe  -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs  CMakeFiles/cmTC_76b3f.dir/testCCompiler.c.o -o cmTC_76b3f
        ld: warning: ignoring file /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/lib/libSystem.tbd, file was built for unsupported file format ( 0x2D 0x2D 0x2D 0x20 0x21 0x74 0x61 0x70 0x69 0x2D 0x74 0x62 0x64 0x0A 0x74 0x62 ) which is not the architecture being linked (x86_64): /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/lib/libSystem.tbd
        ld: dynamic main executables must link with libSystem.dylib for architecture x86_64
        clang-4.0: error: linker command failed with exit code 1 (use -v to see invocation)
        make[1]: *** [cmTC_76b3f] Error 1
        make: *** [cmTC_76b3f/fast] Error 2
    
    
    
    
    
      CMake will not be able to correctly generate this project.
    Call Stack (most recent call first):
      CMakeLists.txt:14 (project)
    
    
    -- Configuring incomplete, errors occurred!
    See also "/private/var/folders/cg/ww2hlv_510b6y0wgfh2w425w0000gn/T/pip-install-13tc8pwi/dlib/build/temp.macosx-10.9-x86_64-3.7/CMakeFiles/CMakeOutput.log".
    See also "/private/var/folders/cg/ww2hlv_510b6y0wgfh2w425w0000gn/T/pip-install-13tc8pwi/dlib/build/temp.macosx-10.9-x86_64-3.7/CMakeFiles/CMakeError.log".
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/cg/ww2hlv_510b6y0wgfh2w425w0000gn/T/pip-install-13tc8pwi/dlib/setup.py", line 262, in <module>
        'Topic :: Software Development',
      File "/Users/mehipour/anaconda3/lib/python3.7/site-packages/setuptools/__init__.py", line 145, in setup
        return distutils.core.setup(**attrs)
      File "/Users/mehipour/anaconda3/lib/python3.7/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/Users/mehipour/anaconda3/lib/python3.7/distutils/dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "/Users/mehipour/anaconda3/lib/python3.7/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/Users/mehipour/anaconda3/lib/python3.7/site-packages/setuptools/command/install.py", line 61, in run
        return orig.install.run(self)
      File "/Users/mehipour/anaconda3/lib/python3.7/distutils/command/install.py", line 545, in run
        self.run_command('build')
      File "/Users/mehipour/anaconda3/lib/python3.7/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/Users/mehipour/anaconda3/lib/python3.7/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/Users/mehipour/anaconda3/lib/python3.7/distutils/command/build.py", line 135, in run
        self.run_command(cmd_name)
      File "/Users/mehipour/anaconda3/lib/python3.7/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/Users/mehipour/anaconda3/lib/python3.7/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/private/var/folders/cg/ww2hlv_510b6y0wgfh2w425w0000gn/T/pip-install-13tc8pwi/dlib/setup.py", line 135, in run
        self.build_extension(ext)
      File "/private/var/folders/cg/ww2hlv_510b6y0wgfh2w425w0000gn/T/pip-install-13tc8pwi/dlib/setup.py", line 172, in build_extension
        subprocess.check_call(cmake_setup, cwd=build_folder)
      File "/Users/mehipour/anaconda3/lib/python3.7/subprocess.py", line 347, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['cmake', '/private/var/folders/cg/ww2hlv_510b6y0wgfh2w425w0000gn/T/pip-install-13tc8pwi/dlib/tools/python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/private/var/folders/cg/ww2hlv_510b6y0wgfh2w425w0000gn/T/pip-install-13tc8pwi/dlib/build/lib.macosx-10.9-x86_64-3.7', '-DPYTHON_EXECUTABLE=/Users/mehipour/anaconda3/bin/python', '-DCMAKE_BUILD_TYPE=Release']' returned non-zero exit status 1.
    ----------------------------------------
ERROR: Command errored out with exit status 1: /Users/mehipour/anaconda3/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/cg/ww2hlv_510b6y0wgfh2w425w0000gn/T/pip-install-13tc8pwi/dlib/setup.py'"'"'; __file__='"'"'/private/var/folders/cg/ww2hlv_510b6y0wgfh2w425w0000gn/T/pip-install-13tc8pwi/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/cg/ww2hlv_510b6y0wgfh2w425w0000gn/T/pip-record-04q_e2mw/install-record.txt --single-version-externally-managed --compile --install-headers /Users/mehipour/anaconda3/include/python3.7m/dlib Check the logs for full command output.
mehipour
  • 11
  • 1
  • Looks like your `clang` is pretty old. Can you get a more recent version? These may be helpful https://www.ics.uci.edu/~pattis/common/handouts/macclion/clang.html https://stackoverflow.com/questions/34617452/how-to-update-xcode-from-command-line – Sounak Aug 11 '20 at 19:29
  • Thanks @Sounak. I tried following the instructions you sent but that didn't work. My Xcode is up to date. I updated my Anaconda and that updated my Clang to version 10.0 (which apparently is not the most recent version). I'm still getting the same error. Interestingly, I have an ubuntu machine that I was able to install dlib on it without any problem, and I just realized that it doesn't have clang installed at all! Any thoughts? – mehipour Aug 13 '20 at 02:09
  • `conda` has its own package manager. Are you using that? Try creating a new virtual environment and install `dlib` with `conda install -c conda-forge dlib` – Sounak Aug 13 '20 at 05:14
  • Alternatively, you can clone the repository, `git clone https://github.com/davisking/dlib` and then use its setup file `python setup.py install` – Sounak Aug 13 '20 at 05:17

0 Answers0