인프런 커뮤니티 질문&답변

이정이님의 프로필 이미지

작성한 질문수

[OpenCV] 파이썬 딥러닝 영상처리 프로젝트 - 손흥민을 찾아라!

face_recognition,dlib 설치 오류

작성

·

5.9K

1

환경은 window 입니다.

cmake 설치 완료했고, dlib은 conda -c conda-forge dlib 으로 설치가 되었는데

face_recognition 설치가 안됩니다..

python 버전은 3.7.4 입니다.

ollecting face_recognition
  Using cached https://files.pythonhosted.org/packages/1e/95/f6c9330f54ab07bfa032bf3715c12455a381083125d8880c43cbe76bb3d0/face_recognition-1.3.0-py2.py3-none-any.whl
Requirement already satisfied: Click>=6.0 in c:\users\wjdgn\anaconda3\lib\site-packages (from face_recognition) (7.0)
Requirement already satisfied: Pillow in c:\users\wjdgn\anaconda3\lib\site-packages (from face_recognition) (6.2.0)
Collecting face-recognition-models>=0.3.0 (from face_recognition)
  Using cached https://files.pythonhosted.org/packages/cf/3b/4fd8c534f6c0d1b80ce0973d01331525538045084c73c153ee6df20224cf/face_recognition_models-0.3.0.tar.gz
Collecting dlib>=19.7 (from face_recognition)
  Using cached https://files.pythonhosted.org/packages/63/92/05c3b98636661cb80d190a5a777dd94effcc14c0f6893222e5ca81e74fbc/dlib-19.19.0.tar.gz
Requirement already satisfied: numpy in c:\users\wjdgn\anaconda3\lib\site-packages (from face_recognition) (1.16.5)
Building wheels for collected packages: face-recognition-models, dlib
  Building wheel for face-recognition-models (setup.py) ... done
  Created wheel for face-recognition-models: filename=face_recognition_models-0.3.0-py2.py3-none-any.whl size=100566178 sha256=08a3cfdb9127e3778612825b5579887a445527744866581eb6bdf83a8ca399c2
  Stored in directory: C:\Users\wjdgn\AppData\Local\pip\Cache\wheels\d2\99\18\59c6c8f01e39810415c0e63f5bede7d83dfb0ffc039865465f
  Building wheel for dlib (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: 'C:\Users\wjdgn\Anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\wjdgn\\AppData\\Local\\Temp\\pip-install-s56jw3ha\\dlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\wjdgn\\AppData\\Local\\Temp\\pip-install-s56jw3ha\\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 'C:\Users\wjdgn\AppData\Local\Temp\pip-wheel-46xnzren' --python-tag cp37
       cwd: C:\Users\wjdgn\AppData\Local\Temp\pip-install-s56jw3ha\dlib\
  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 (default, Aug  9 2019, 18:34:13) [MSC v.1915 64 bit (AMD64)]
  Invoking CMake setup: 'cmake C:\Users\wjdgn\AppData\Local\Temp\pip-install-s56jw3ha\dlib\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\wjdgn\AppData\Local\Temp\pip-install-s56jw3ha\dlib\build\lib.win-amd64-3.7 -DPYTHON_EXECUTABLE=C:\Users\wjdgn\Anaconda3\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\wjdgn\AppData\Local\Temp\pip-install-s56jw3ha\dlib\build\lib.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/wjdgn/AppData/Local/Temp/pip-install-s56jw3ha/dlib/build/temp.win-amd64-3.7/Release/CMakeFiles/CMakeOutput.log".
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "C:\Users\wjdgn\AppData\Local\Temp\pip-install-s56jw3ha\dlib\setup.py", line 261, in <module>
      'Topic :: Software Development',
    File "C:\Users\wjdgn\Anaconda3\lib\site-packages\setuptools\__init__.py", line 145, in setup
      return distutils.core.setup(**attrs)
    File "C:\Users\wjdgn\Anaconda3\lib\distutils\core.py", line 148, in setup
      dist.run_commands()
    File "C:\Users\wjdgn\Anaconda3\lib\distutils\dist.py", line 966, in run_commands
      self.run_command(cmd)
    File "C:\Users\wjdgn\Anaconda3\lib\distutils\dist.py", line 985, in run_command
      cmd_obj.run()
    File "C:\Users\wjdgn\Anaconda3\lib\site-packages\wheel\bdist_wheel.py", line 192, in run
      self.run_command('build')
    File "C:\Users\wjdgn\Anaconda3\lib\distutils\cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "C:\Users\wjdgn\Anaconda3\lib\distutils\dist.py", line 985, in run_command
      cmd_obj.run()
    File "C:\Users\wjdgn\Anaconda3\lib\distutils\command\build.py", line 135, in run
      self.run_command(cmd_name)
    File "C:\Users\wjdgn\Anaconda3\lib\distutils\cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "C:\Users\wjdgn\Anaconda3\lib\distutils\dist.py", line 985, in run_command
      cmd_obj.run()
    File "C:\Users\wjdgn\AppData\Local\Temp\pip-install-s56jw3ha\dlib\setup.py", line 135, in run
      self.build_extension(ext)
    File "C:\Users\wjdgn\AppData\Local\Temp\pip-install-s56jw3ha\dlib\setup.py", line 172, in build_extension
      subprocess.check_call(cmake_setup, cwd=build_folder)
    File "C:\Users\wjdgn\Anaconda3\lib\subprocess.py", line 347, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\wjdgn\\AppData\\Local\\Temp\\pip-install-s56jw3ha\\dlib\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\wjdgn\\AppData\\Local\\Temp\\pip-install-s56jw3ha\\dlib\\build\\lib.win-amd64-3.7', '-DPYTHON_EXECUTABLE=C:\\Users\\wjdgn\\Anaconda3\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\wjdgn\\AppData\\Local\\Temp\\pip-install-s56jw3ha\\dlib\\build\\lib.win-amd64-3.7', '-A', 'x64']' returned non-zero exit status 1.
  ----------------------------------------
  ERROR: Failed building wheel for dlib
  Running setup.py clean for dlib
Successfully built face-recognition-models
Failed to build dlib
Installing collected packages: face-recognition-models, dlib, face-recognition
  Running setup.py install for dlib ... error
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\wjdgn\Anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\wjdgn\\AppData\\Local\\Temp\\pip-install-s56jw3ha\\dlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\wjdgn\\AppData\\Local\\Temp\\pip-install-s56jw3ha\\dlib\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\wjdgn\AppData\Local\Temp\pip-record-sx2ht87z\install-record.txt' --single-version-externally-managed --compile
         cwd: C:\Users\wjdgn\AppData\Local\Temp\pip-install-s56jw3ha\dlib\
    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 (default, Aug  9 2019, 18:34:13) [MSC v.1915 64 bit (AMD64)]
    Invoking CMake setup: 'cmake C:\Users\wjdgn\AppData\Local\Temp\pip-install-s56jw3ha\dlib\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\wjdgn\AppData\Local\Temp\pip-install-s56jw3ha\dlib\build\lib.win-amd64-3.7 -DPYTHON_EXECUTABLE=C:\Users\wjdgn\Anaconda3\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\wjdgn\AppData\Local\Temp\pip-install-s56jw3ha\dlib\build\lib.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/wjdgn/AppData/Local/Temp/pip-install-s56jw3ha/dlib/build/temp.win-amd64-3.7/Release/CMakeFiles/CMakeOutput.log".
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\wjdgn\AppData\Local\Temp\pip-install-s56jw3ha\dlib\setup.py", line 261, in <module>
        'Topic :: Software Development',
      File "C:\Users\wjdgn\Anaconda3\lib\site-packages\setuptools\__init__.py", line 145, in setup
        return distutils.core.setup(**attrs)
      File "C:\Users\wjdgn\Anaconda3\lib\distutils\core.py", line 148, in setup
        dist.run_commands()
      File "C:\Users\wjdgn\Anaconda3\lib\distutils\dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "C:\Users\wjdgn\Anaconda3\lib\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "C:\Users\wjdgn\Anaconda3\lib\site-packages\setuptools\command\install.py", line 61, in run
        return orig.install.run(self)
      File "C:\Users\wjdgn\Anaconda3\lib\distutils\command\install.py", line 545, in run
        self.run_command('build')
      File "C:\Users\wjdgn\Anaconda3\lib\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "C:\Users\wjdgn\Anaconda3\lib\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "C:\Users\wjdgn\Anaconda3\lib\distutils\command\build.py", line 135, in run
        self.run_command(cmd_name)
      File "C:\Users\wjdgn\Anaconda3\lib\distutils\cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "C:\Users\wjdgn\Anaconda3\lib\distutils\dist.py", line 985, in run_command
        cmd_obj.run()
      File "C:\Users\wjdgn\AppData\Local\Temp\pip-install-s56jw3ha\dlib\setup.py", line 135, in run
        self.build_extension(ext)
      File "C:\Users\wjdgn\AppData\Local\Temp\pip-install-s56jw3ha\dlib\setup.py", line 172, in build_extension
        subprocess.check_call(cmake_setup, cwd=build_folder)
      File "C:\Users\wjdgn\Anaconda3\lib\subprocess.py", line 347, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\wjdgn\\AppData\\Local\\Temp\\pip-install-s56jw3ha\\dlib\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\wjdgn\\AppData\\Local\\Temp\\pip-install-s56jw3ha\\dlib\\build\\lib.win-amd64-3.7', '-DPYTHON_EXECUTABLE=C:\\Users\\wjdgn\\Anaconda3\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\wjdgn\\AppData\\Local\\Temp\\pip-install-s56jw3ha\\dlib\\build\\lib.win-amd64-3.7', '-A', 'x64']' returned non-zero exit status 1.
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\wjdgn\Anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\wjdgn\\AppData\\Local\\Temp\\pip-install-s56jw3ha\\dlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\wjdgn\\AppData\\Local\\Temp\\pip-install-s56jw3ha\\dlib\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\wjdgn\AppData\Local\Temp\pip-record-sx2ht87z\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.

답변 4

1

이정이님의 프로필 이미지
이정이
질문자

해결 했습니다.

visual studio 설치 후 , dlib 19.18.0.tar.gz 를 다운받아 python setup.py install 하여 설치 했고

dlib 만 설치하면 face_recognition은 가볍게 설치됩니다 대신 conda -c conda-forge dlib으로 설치하게 되면 face_recognition은 위와 같은 오류가 뜨면서 설치가 안되고.. pip 쪽으로 설치가 되어야 face_recognition 이 설치가 되더군요..

19.19버전은 계쏙 설치가 안됐고 19.18버전이 잘 설치 됩니다..

관건은 VS 설치일수도 있고.. 아니면 처음부터 19.18버전을 설치했어야 했을지도 모르겠네요..

(python 버전은 3.7.4 입니다)

Visual studio (desktop development with c++)...

설치 안되시는 분은 19.18 버전 tar.gz 다운받으셔서 python setup.py install 해보시면 좋을 것 같네요.

pip install dlib==19.18.0 해봤지만 제대로 설치는 안되네요.

0

저는 그냥 pip3 install --upgrade pip 하고
pip3 install dlib
하니까 됬네요...

저도 해봤지만 설치된 프로그램들이 다른건지 기존 환경에 설치된 모듈 차이인지

저는 안되네요..

0

안녕하세요?

해경하셨다니 다행입니다.

그리고 결과정보 주셔서 감사합니다.

다른 정보와 모아서 수강생 분들에게 공유하도록 하겠습니다.

감사합니다. 

0

안녕하세요?

보내주심 에러만으로는 정확히 확인하기 어려우나 일단 올바른 가상환경에서 설치를 진행하고 있는지 확인하시고 Computer를 종료 후 다시 가상환경을 실행하고 설치해 보세요.

dlib과 face_recognition 설치 간 에러와 해결 방법은 그간 관련된 여러 질문과 제가 특별강의로도 만들어 두었으니 참조하시면 도움이 될겁니다.

감사합니다.