본문 바로가기
카테고리 없음

vscode python mac os dlib install error 관련

by 이승보 2021. 3. 1.
728x90

python에 face_recognition 라이브러리를 설치하려는데

정말 많은 에러를 만났다..dlib 설치하면서....하..

우선 전체 설치글은 여러글들 중에서도 아래 링크가 나한테 맞은 듯 하고,

hatreasuree.tistory.com/17

그 중에서도 보통 dlib 설치하면서 에러가 많이 생기는데 나같은 경우에는 아래 에러가 생김

(face) appleuicBookAir:face sb$ python3 -m pip install dlib
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 ... error
    ERROR: Command errored out with exit status 1:
     command: /usr/local/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/yk/n12tyj154ds2x5vsysyn_ys80000gp/T/pip-install-2xhucial/dlib/setup.py'"'"'; __file__='"'"'/private/var/folders/yk/n12tyj154ds2x5vsysyn_ys80000gp/T/pip-install-2xhucial/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/yk/n12tyj154ds2x5vsysyn_ys80000gp/T/pip-record-s3rhv81j/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/dlib
         cwd: /private/var/folders/yk/n12tyj154ds2x5vsysyn_ys80000gp/T/pip-install-2xhucial/dlib/
    Complete output (73 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.9.1 (v3.9.1:1e5d33e9b9, Dec  7 2020, 12:10:52)
    Invoking CMake setup: 'cmake /private/var/folders/yk/n12tyj154ds2x5vsysyn_ys80000gp/T/pip-install-2xhucial/dlib/tools/python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/private/var/folders/yk/n12tyj154ds2x5vsysyn_ys80000gp/T/pip-install-2xhucial/dlib/build/lib.macosx-10.9-x86_64-3.9 -DPYTHON_EXECUTABLE=/usr/local/bin/python3 -DCMAKE_BUILD_TYPE=Release'
    -- The C compiler identification is unknown
    -- The CXX compiler identification is unknown
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - failed
    -- 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.19.6/share/cmake/Modules/CMakeTestCCompiler.cmake:66 (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/yk/n12tyj154ds2x5vsysyn_ys80000gp/T/pip-install-2xhucial/dlib/build/temp.macosx-10.9-x86_64-3.9/CMakeFiles/CMakeTmp
    
        Run Build Command(s):/usr/bin/make cmTC_99a3f/fast && xcrun: error: active developer path ("/Applications/Xcode.app/Contents/Developer") does not exist
        Use `sudo xcode-select --switch path/to/Xcode.app` to specify the Xcode that you wish to use for command line developer tools, or use `xcode-select --install` to install the standalone command line developer tools.
        See `man xcode-select` for more details.
    
    
    
    
    
      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/yk/n12tyj154ds2x5vsysyn_ys80000gp/T/pip-install-2xhucial/dlib/build/temp.macosx-10.9-x86_64-3.9/CMakeFiles/CMakeOutput.log".
    See also "/private/var/folders/yk/n12tyj154ds2x5vsysyn_ys80000gp/T/pip-install-2xhucial/dlib/build/temp.macosx-10.9-x86_64-3.9/CMakeFiles/CMakeError.log".
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/yk/n12tyj154ds2x5vsysyn_ys80000gp/T/pip-install-2xhucial/dlib/setup.py", line 223, in <module>
        setup(
      File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/setuptools/__init__.py", line 165, in setup
        return distutils.core.setup(**attrs)
      File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/setuptools/command/install.py", line 61, in run
        return orig.install.run(self)
      File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/command/install.py", line 546, in run
        self.run_command('build')
      File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/command/build.py", line 135, in run
        self.run_command(cmd_name)
      File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/private/var/folders/yk/n12tyj154ds2x5vsysyn_ys80000gp/T/pip-install-2xhucial/dlib/setup.py", line 135, in run
        self.build_extension(ext)
      File "/private/var/folders/yk/n12tyj154ds2x5vsysyn_ys80000gp/T/pip-install-2xhucial/dlib/setup.py", line 172, in build_extension
        subprocess.check_call(cmake_setup, cwd=build_folder)
      File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 373, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['cmake', '/private/var/folders/yk/n12tyj154ds2x5vsysyn_ys80000gp/T/pip-install-2xhucial/dlib/tools/python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/private/var/folders/yk/n12tyj154ds2x5vsysyn_ys80000gp/T/pip-install-2xhucial/dlib/build/lib.macosx-10.9-x86_64-3.9', '-DPYTHON_EXECUTABLE=/usr/local/bin/python3', '-DCMAKE_BUILD_TYPE=Release']' returned non-zero exit status 1.
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/yk/n12tyj154ds2x5vsysyn_ys80000gp/T/pip-install-2xhucial/dlib/setup.py'"'"'; __file__='"'"'/private/var/folders/yk/n12tyj154ds2x5vsysyn_ys80000gp/T/pip-install-2xhucial/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/yk/n12tyj154ds2x5vsysyn_ys80000gp/T/pip-record-s3rhv81j/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Frameworks/Python.framework/Versions/3.9/include/python3.9/dlib Check the logs for full command output.

 

무슨 말인지도 모르겠고 읽기가 싫더라도 에러코드들은 한줄 한줄 정성스레 읽으면 아래와 같은 문구 발견!

Run Build Command(s):/usr/bin/make cmTC_99a3f/fast && xcrun: error: active developer path ("/Applications/Xcode.app/Contents/Developer") does not exist
        Use `sudo xcode-select --switch path/to/Xcode.app` to specify the Xcode that you wish to use for command line developer tools, or use `xcode-select --install` to install the standalone command line developer tools.
        See `man xcode-select` for more details.

xcode 관련해서 뭔가를 해줘야 한다는 말인데 나는 xcode가 깔려있으므로 아래 코드로 해결했음.

sudo xcode-select --switch /Library/Developer/CommandLineTools/

stackoverflow.com/questions/34617452/how-to-update-xcode-from-command-line

결국 dlib와 face_recognition 설ㅊ 완료..후우..

728x90
반응형

댓글