実現したいこと
dlibをpythonで使いたい
発生している問題・分からないこと
ライブラリのインストールができない
エラーメッセージ
error
1以下がエラーメッセージですが、ユーザー名を~~~で置換しています。また文字数制限のため、[~]で途中を省略しています。C言語の知識がないためクリティカルな箇所だったらすみません、、 2Using cached dlib-19.24.4.tar.gz (3.3 MB) 3 Installing build dependencies ... done 4 Getting requirements to build wheel ... done 5 Preparing metadata (pyproject.toml) ... done 6Building wheels for collected packages: dlib 7 Building wheel for dlib (pyproject.toml) ... error 8 error: subprocess-exited-with-error 9 10 × Building wheel for dlib (pyproject.toml) did not run successfully. 11 │ exit code: 1 12 ╰─> [142 lines of output] 13 <string>:210: SyntaxWarning: invalid escape sequence '\(' 14 <string>:211: SyntaxWarning: invalid escape sequence '\(' 15 <string>:212: SyntaxWarning: invalid escape sequence '\(' 16 running bdist_wheel 17 running build 18 running build_ext 19 <string>:125: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead. 20 Building extension for Python 3.12.4 (tags/v3.12.4:8e8a4ba, Jun 6 2024, 19:30:16) [MSC v.1940 64 bit (AMD64)] 21 Invoking CMake setup: 'cmake C:\Users\~~~\AppData\Local\Temp\pip-install-3xtpsta2\dlib_7262563d60394c2f8ea578163b17291d\tools\python -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\Users\~~~\AppData\Local\Temp\pip-install-3xtpsta2\dlib_7262563d60394c2f8ea578163b17291d\build\lib.win-amd64-cpython-312 -DPYTHON_EXECUTABLE=C:\Users\~~~\AppData\Local\Programs\Python\Python312\python.exe -DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\Users\~~~\AppData\Local\Temp\pip-install-3xtpsta2\dlib_7262563d60394c2f8ea578163b17291d\build\lib.win-amd64-cpython-312 -A x64' 22 -- Building for: Visual Studio 17 2022 23 -- The C compiler identification is MSVC 19.40.33811.0 24 -- The CXX compiler identification is MSVC 19.40.33811.0 25 -- Detecting C compiler ABI info 26 -- Detecting C compiler ABI info - failed 27 -- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.40.33807/bin/Hostx64/x64/cl.exe 28 -- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.40.33807/bin/Hostx64/x64/cl.exe - broken 29 CMake Error at C:/Program Files/CMake/share/cmake-3.30/Modules/CMakeTestCCompiler.cmake:67 (message): 30 The C compiler 31 32 "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.40.33807/bin/Hostx64/x64/cl.exe" 33 34 is not able to compile a simple test program. 35 36 It fails with the following output: 37 38 Change Dir: 'C:/Users/~~~/AppData/Local/Temp/pip-install-3xtpsta2/dlib_7262563d60394c2f8ea578163b17291d/build/temp.win-amd64-cpython-312/Release/CMakeFiles/CMakeScratch/TryCompile-lscwa2' 39 40 Run Build Command(s): "C:/Program Files/Microsoft Visual Studio/2022/Community/MSBuild/Current/Bin/amd64/MSBuild.exe" cmTC_69ae4.vcxproj /p:Configuration=Debug /p:Platform=x64 /p:VisualStudioVersion=17.0 /v:n 41 42 [~] 43 44 -- Configuring incomplete, errors occurred! 45 Traceback (most recent call last): 46 File "C:\Users\~~~\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module> 47 main() 48 File "C:\Users\~~~\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main 49 json_out['return_val'] = hook(**hook_input['kwargs']) 50 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 51 File "C:\Users\~~~\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 251, in build_wheel 52 return _build_backend().build_wheel(wheel_directory, config_settings, 53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 54 File "C:\Users\~~~\AppData\Local\Temp\pip-build-env-e8ihvs_0\overlay\Lib\site-packages\setuptools\build_meta.py", line 415, in build_wheel 55 return self._build_with_temp_dir( 56 ^^^^^^^^^^^^^^^^^^^^^^^^^^ 57 File "C:\Users\~~~\AppData\Local\Temp\pip-build-env-e8ihvs_0\overlay\Lib\site-packages\setuptools\build_meta.py", line 397, in _build_with_temp_dir 58 self.run_setup() 59 File "C:\Users\~~~\AppData\Local\Temp\pip-build-env-e8ihvs_0\overlay\Lib\site-packages\setuptools\build_meta.py", line 313, in run_setup 60 exec(code, locals()) 61 File "<string>", line 220, in <module> 62 File "C:\Users\~~~\AppData\Local\Temp\pip-build-env-e8ihvs_0\overlay\Lib\site-packages\setuptools\__init__.py", line 103, in setup 63 return distutils.core.setup(**attrs) 64 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 65 File "C:\Users\~~~\AppData\Local\Temp\pip-build-env-e8ihvs_0\overlay\Lib\site-packages\setuptools\_distutils\core.py", line 184, in setup 66 return run_commands(dist) 67 ^^^^^^^^^^^^^^^^^^ 68 File "C:\Users\~~~\AppData\Local\Temp\pip-build-env-e8ihvs_0\overlay\Lib\site-packages\setuptools\_distutils\core.py", line 200, in run_commands 69 dist.run_commands() 70 File "C:\Users\~~~\AppData\Local\Temp\pip-build-env-e8ihvs_0\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 970, in run_commands 71 self.run_command(cmd) 72 File "C:\Users\~~~\AppData\Local\Temp\pip-build-env-e8ihvs_0\overlay\Lib\site-packages\setuptools\dist.py", line 974, in run_command 73 super().run_command(command) 74 File "C:\Users\~~~\AppData\Local\Temp\pip-build-env-e8ihvs_0\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 989, in run_command 75 cmd_obj.run() 76 File "C:\Users\~~~\AppData\Local\Temp\pip-build-env-e8ihvs_0\overlay\Lib\site-packages\setuptools\command\bdist_wheel.py", line 373, in run 77 self.run_command("build") 78 File "C:\Users\~~~\AppData\Local\Temp\pip-build-env-e8ihvs_0\overlay\Lib\site-packages\setuptools\_distutils\cmd.py", line 316, in run_command 79 self.distribution.run_command(command) 80 File "C:\Users\~~~\AppData\Local\Temp\pip-build-env-e8ihvs_0\overlay\Lib\site-packages\setuptools\dist.py", line 974, in run_command 81 super().run_command(command) 82 File "C:\Users\~~~\AppData\Local\Temp\pip-build-env-e8ihvs_0\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 989, in run_command 83 cmd_obj.run() 84 File "C:\Users\~~~\AppData\Local\Temp\pip-build-env-e8ihvs_0\overlay\Lib\site-packages\setuptools\_distutils\command\build.py", line 135, in run 85 self.run_command(cmd_name) 86 File "C:\Users\~~~\AppData\Local\Temp\pip-build-env-e8ihvs_0\overlay\Lib\site-packages\setuptools\_distutils\cmd.py", line 316, in run_command 87 self.distribution.run_command(command) 88 File "C:\Users\~~~\AppData\Local\Temp\pip-build-env-e8ihvs_0\overlay\Lib\site-packages\setuptools\dist.py", line 974, in run_command 89 super().run_command(command) 90 File "C:\Users\~~~\AppData\Local\Temp\pip-build-env-e8ihvs_0\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 989, in run_command 91 cmd_obj.run() 92 File "<string>", line 130, in run 93 File "<string>", line 167, in build_extension 94 File "C:\Users\~~~\AppData\Local\Programs\Python\Python312\Lib\subprocess.py", line 413, in check_call 95 raise CalledProcessError(retcode, cmd) 96 subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\~~~\\AppData\\Local\\Temp\\pip-install-3xtpsta2\\dlib_7262563d60394c2f8ea578163b17291d\\tools\\python', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\~~~\\AppData\\Local\\Temp\\pip-install-3xtpsta2\\dlib_7262563d60394c2f8ea578163b17291d\\build\\lib.win-amd64-cpython-312', '-DPYTHON_EXECUTABLE=C:\\Users\\~~~\\AppData\\Local\\Programs\\Python\\Python312\\python.exe', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\~~~\\AppData\\Local\\Temp\\pip-install-3xtpsta2\\dlib_7262563d60394c2f8ea578163b17291d\\build\\lib.win-amd64-cpython-312', '-A', 'x64']' returned non-zero exit status 1. 97 [end of output] 98 99 note: This error originates from a subprocess, and is likely not a problem with pip. 100 ERROR: Failed building wheel for dlib 101Failed to build dlib 102ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (dlib)
該当のソースコード
pip install dlib
試したこと・調べたこと
- teratailやGoogle等で検索した
- ソースコードを自分なりに変更した
- 知人に聞いた
- その他
上記の詳細・結果
調べると同様のエラーが散見されましたが、それぞれの解決策を試してもうまくいきません。
以下は確認済みです。
・cmakeのインストール(webとpipでインストールするものそれぞれ)
・cmakeのpathを通す。
・visual studioおよびC++開発ツールのインストール
・visual studioのpathを通す。
・pipのアップデート
・dlib-19.24.2で試す。
・python -m pip install dlib
■dlibのpython対応verが3.7くらいまでだったと記憶していますが、仮想環境を作っていないため3.12上で動かしたいです。別のPCではそれで動いてくれています。
error
1Change Dir: 'C:/Users/~~~/AppData/Local/Temp/pip-install-3xtpsta2/dlib_7262563d60394c2f8ea578163b17291d/build/temp.win-amd64-cpython-312/Release/CMakeFiles/CMakeScratch/TryCompile-lscwa2'
の部分がポイントなのかなと思っていますが、記載のTempフォルダにpip-install-3~というフォルダは存在せず理解しかねています。
よろしくお願いします。
補足
windows11
python 3.12
visual studio2022
cmake 3.20
回答1件
あなたの回答
tips
プレビュー