実現したいこと
wxPythonのインストール
発生している問題・分からないこと
wxPythonをインストールしようとするとエラーが出ます。
エラーメッセージ
error
1Collecting wxPython 2 Using cached wxPython-4.2.1.tar.gz (73.7 MB) 3Requirement already satisfied: pillow in /usr/local/lib/python3.8/dist-packages (from wxPython) (10.3.0) 4Requirement already satisfied: six in /usr/local/lib/python3.8/dist-packages (from wxPython) (1.16.0) 5Requirement already satisfied: numpy in /usr/local/lib/python3.8/dist-packages (from wxPython) (1.24.4) 6Building wheels for collected packages: wxPython 7 Building wheel for wxPython (setup.py) ... error 8 ERROR: Command errored out with exit status 1: 9 command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-vvj3lozy/wxPython/setup.py'"'"'; __file__='"'"'/tmp/pip-install-vvj3lozy/wxPython/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 /tmp/pip-wheel-xvlska1_ 10 cwd: /tmp/pip-install-vvj3lozy/wxPython/ 11 Complete output (42 lines): 12 running bdist_wheel 13 running build 14 WARNING: Building this way assumes that all generated files have been 15 generated already. If that is not the case then use build.py directly 16 to generate the source and perform the build stage. You can use 17 --skip-build with the bdist_* or install commands to avoid this 18 message and the wxWidgets and Phoenix build steps in the future. 19 20 "/usr/bin/python3" -u build.py build 21 Will build using: "/usr/bin/python3" 22 3.8.10 (default, Nov 22 2023, 10:22:35) 23 [GCC 9.4.0] 24 Python's architecture is 64bit 25 cfg.VERSION: 4.2.1 26 27 Running command: build 28 Running command: build_wx 29 wxWidgets build options: ['--wxpython', '--unicode', '--gtk3'] 30 Configure options: ['--enable-unicode', '--with-gtk=3', '--enable-sound', '--enable-graphics_ctx', '--enable-display', '--enable-geometry', '--enable-debug_flag', '--enable-optimise', '--disable-debugreport', '--enable-uiactionsim', '--enable-autoidman', '--with-sdl'] 31 /tmp/pip-install-vvj3lozy/wxPython/ext/wxWidgets/configure --enable-unicode --with-gtk=3 --enable-sound --enable-graphics_ctx --enable-display --enable-geometry --enable-debug_flag --enable-optimise --disable-debugreport --enable-uiactionsim --enable-autoidman --with-sdl 32 checking build system type... x86_64-pc-linux-gnu 33 checking host system type... x86_64-pc-linux-gnu 34 checking for toolkit... gtk 35 checking for gcc... no 36 checking for cc... no 37 checking for cl.exe... no 38 configure: error: in `/tmp/pip-install-vvj3lozy/wxPython/build/wxbld/gtk3': 39 configure: error: no acceptable C compiler found in $PATH 40 See `config.log' for more details 41 Error running configure 42 ERROR: failed building wxWidgets 43 Traceback (most recent call last): 44 File "build.py", line 1563, in cmd_build_wx 45 wxbuild.main(wxDir(), build_options) 46 File "/tmp/pip-install-vvj3lozy/wxPython/buildtools/build_wxwidgets.py", line 379, in main 47 exitIfError(wxBuilder.configure(dir=wxRootDir, options=configure_opts), 48 File "/tmp/pip-install-vvj3lozy/wxPython/buildtools/build_wxwidgets.py", line 72, in exitIfError 49 raise builder.BuildError(msg) 50 buildtools.builder.BuildError: Error running configure 51 Finished command: build_wx (0.465s) 52 Finished command: build (0.465s) 53 Command '"/usr/bin/python3" -u build.py build' failed with exit code 1. 54 ---------------------------------------- 55 ERROR: Failed building wheel for wxPython 56 Running setup.py clean for wxPython 57Failed to build wxPython 58Installing collected packages: wxPython 59 Running setup.py install for wxPython ... error 60 ERROR: Command errored out with exit status 1: 61 command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-vvj3lozy/wxPython/setup.py'"'"'; __file__='"'"'/tmp/pip-install-vvj3lozy/wxPython/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-ftcu3o1m/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/jovyan/.local/include/python3.8/wxPython 62 cwd: /tmp/pip-install-vvj3lozy/wxPython/ 63 Complete output (42 lines): 64 running install 65 running build 66 WARNING: Building this way assumes that all generated files have been 67 generated already. If that is not the case then use build.py directly 68 to generate the source and perform the build stage. You can use 69 --skip-build with the bdist_* or install commands to avoid this 70 message and the wxWidgets and Phoenix build steps in the future. 71 72 "/usr/bin/python3" -u build.py build 73 Will build using: "/usr/bin/python3" 74 3.8.10 (default, Nov 22 2023, 10:22:35) 75 [GCC 9.4.0] 76 Python's architecture is 64bit 77 cfg.VERSION: 4.2.1 78 79 Running command: build 80 Running command: build_wx 81 wxWidgets build options: ['--wxpython', '--unicode', '--gtk3'] 82 Configure options: ['--enable-unicode', '--with-gtk=3', '--enable-sound', '--enable-graphics_ctx', '--enable-display', '--enable-geometry', '--enable-debug_flag', '--enable-optimise', '--disable-debugreport', '--enable-uiactionsim', '--enable-autoidman', '--with-sdl'] 83 /tmp/pip-install-vvj3lozy/wxPython/ext/wxWidgets/configure --enable-unicode --with-gtk=3 --enable-sound --enable-graphics_ctx --enable-display --enable-geometry --enable-debug_flag --enable-optimise --disable-debugreport --enable-uiactionsim --enable-autoidman --with-sdl 84 checking build system type... x86_64-pc-linux-gnu 85 checking host system type... x86_64-pc-linux-gnu 86 checking for toolkit... gtk 87 checking for gcc... no 88 checking for cc... no 89 checking for cl.exe... no 90 configure: error: in `/tmp/pip-install-vvj3lozy/wxPython/build/wxbld/gtk3': 91 configure: error: no acceptable C compiler found in $PATH 92 See `config.log' for more details 93 Error running configure 94 ERROR: failed building wxWidgets 95 Traceback (most recent call last): 96 File "build.py", line 1563, in cmd_build_wx 97 wxbuild.main(wxDir(), build_options) 98 File "/tmp/pip-install-vvj3lozy/wxPython/buildtools/build_wxwidgets.py", line 379, in main 99 exitIfError(wxBuilder.configure(dir=wxRootDir, options=configure_opts), 100 File "/tmp/pip-install-vvj3lozy/wxPython/buildtools/build_wxwidgets.py", line 72, in exitIfError 101 raise builder.BuildError(msg) 102 buildtools.builder.BuildError: Error running configure 103 Finished command: build_wx (0.435s) 104 Finished command: build (0.435s) 105 Command '"/usr/bin/python3" -u build.py build' failed with exit code 1. 106 ---------------------------------------- 107ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-vvj3lozy/wxPython/setup.py'"'"'; __file__='"'"'/tmp/pip-install-vvj3lozy/wxPython/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-ftcu3o1m/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/jovyan/.local/include/python3.8/wxPython Check the logs for full command output.
該当のソースコード
pip install wxPython
試したこと・調べたこと
- teratailやGoogle等で検索した
- ソースコードを自分なりに変更した
- 知人に聞いた
- その他
上記の詳細・結果
https://asdm.hatenablog.com/entry/2015/08/28/230147
上記サイトより、
pip install http://www.wxpython.org/Phoenix/snapshot-builds/wxPython-4.2.1-cp38-cp38-win_amd64.whl
pip install -U --pre -f https://wxpython.org/Phoenix/snapshot-builds/wxPython-4.2.1-cp38-cp38-win_amd64.whl
とやってみましたがうまくいきませんでした。
補足
特になし
configure スクリプトの出力メッセージでは以下の様に表示されていますので、C コンパイラがインストールされていないのだろうと思います。(PATH 以外のディレクトリにインストールされているのかもしれませんけれども)
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/tmp/pip-install-vvj3lozy/wxPython/build/wxbld/gtk3':
configure: error: no acceptable C compiler found in $PATH
また、以下のメッセージから、そちらで使用している PC は 64ビット Intel CPU で、OS は Linux なのでしょう。
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
wxPython-4.2.1-cp38-cp38-win_amd64.whl は Windows OS 向けのパッケージ(wheel 形式)なので、Linux システムにはインストールすることができません。
(現時点で Linux システム向けの wheel パッケージは提供されていない模様です)
> 上記サイトより、
>
> pip install http://www.wxpython.org/Phoenix/snapshot-builds/wxPython-4.2.1-cp38-cp38-win_amd64.whl
> pip install -U --pre -f https://wxpython.org/Phoenix/snapshot-builds/wxPython-4.2.1-cp38-cp38-win_amd64.whl
>
> とやってみましたがうまくいきませんでした。

回答2件
あなたの回答
tips
プレビュー