Pip cannot install wxPython for Python 3.10 (32-bit)
Question:
I have installed two frameworks of Python 3.10. There is wxPython310
for 64-bit Python. But there aren’t any wxPython
for 32-bit Python.
I tried to install wxPython
with https://wxpython.org/Phoenix/snapshot-builds/wxPython-4.1.2a1.dev5259+d3bdb143.tar.gz
, but it shows me the error code like this.
Running setup.py install for wxPython ... error
error: subprocess-exited-with-error
× Running setup.py install for wxPython did not run successfully.
│ exit code: 1
╰─> [22 lines of output]
C:UserstigerAppDataLocalProgramsPythonPython310-32libsite-packagessetuptoolsdist.py:717: UserWarning: Usage of dash-separated 'license-file' will not be supported in future versions. Please use the underscore name 'license_file' instead
warnings.warn(
C:UserstigerAppDataLocalProgramsPythonPython310-32libsite-packagessetuptoolsdist.py:294: DistDeprecationWarning: use_2to3 is ignored.
warnings.warn(f"{attr} is ignored.", DistDeprecationWarning)
running install
running build
C:UserstigerAppDataLocalTemppip-req-build-b6xigzyzbuild.py:42: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
from distutils.dep_util import newer, newer_group
Traceback (most recent call last):
File "C:UserstigerAppDataLocalTemppip-req-build-b6xigzyzbuild.py", line 49, in <module>
from buildtools.wxpysip import sip_runner
File "C:UserstigerAppDataLocalTemppip-req-build-b6xigzyzbuildtoolswxpysip.py", line 20, in <module>
from sipbuild.code_generator import (set_globals, parse, generateCode,
ModuleNotFoundError: No module named 'sipbuild'
WARNING: Building this way assumes that all generated files have been
generated already. If that is not the case then use build.py directly
to generate the source and perform the build stage. You can use
--skip-build with the bdist_* or install commands to avoid this
message and the wxWidgets and Phoenix build steps in the future.
"C:UserstigerAppDataLocalProgramsPythonPython310-32python.exe" -u build.py build
Command '"C:UserstigerAppDataLocalProgramsPythonPython310-32python.exe" -u build.py build' failed with exit code 1.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> wxPython
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
Answers:
Common problem with installing various versions is python interpreters that used for the installation
Make sure you use compatible version of python to install wxPython310
What IDE you use ?
for all case scenarios I would recommend to make sure that the installation done with the right Python version , if you don’t know then reinstall required versions and make sure the versions you installed support the package
Tutorial for installing : Link
There are some issues with Python 3.10. The easiest way to deal with this situation is to downgrade your python version to 3.9.13.
The last wxPython came before Python 3.10 if I am not mistaken.
I was going through the same situation and tried a couple of solutions because I did not want to downgrade my python version, but I was wasting too much time that I did not have.
So for now just downgrade and wait for new releases, or use Tkinter.
Assuming we are on Linux…
Install a prebuilt wheel
The wxpython
wheel url is ubuntu os version and python version specific – change as necessary. The installation of extra linux packages is because the wxpython wheel (binary) depends on them.
$ pip install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-22.04 wxPython
$ sudo apt-get install libsdl2-mixer-2.0-0 libsdl2-image-2.0-0 libsdl2-2.0-0
then you can successfully
python3
Python 3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import wx
>>>
pip install wxpython – build the wxpython wheel
This builds a wxpython wheel (binary) ourselves from source, rather than using the sometimes limited choice of prebuilt wheels (e.g. there is no arm wheel). It takes a while but is pretty easy and works on intel x86
and also on linux on arm
. See https://github.com/wxWidgets/Phoenix/issues/2225 on why the attrdict3
workaround is needed.
$ sudo apt-get install dpkg-dev build-essential python3-dev freeglut3-dev libgl1-mesa-dev libglu1-mesa-dev libgstreamer-plugins-base1.0-dev libgtk-3-dev libjpeg-dev libnotify-dev libpng-dev libsdl2-dev libsm-dev libtiff-dev libwebkit2gtk-4.0-dev libxtst-dev
$ pip install attrdict3
$ pip install wxpython
I updated my python to 3.10 yesterday and had similar issues.
My guess is you are missing system packages which wxpython is using to install.
please have a look at Prerequisites here. After installing these give it another try. Also it takes significantly longer
I have installed two frameworks of Python 3.10. There is wxPython310
for 64-bit Python. But there aren’t any wxPython
for 32-bit Python.
I tried to install wxPython
with https://wxpython.org/Phoenix/snapshot-builds/wxPython-4.1.2a1.dev5259+d3bdb143.tar.gz
, but it shows me the error code like this.
Running setup.py install for wxPython ... error
error: subprocess-exited-with-error
× Running setup.py install for wxPython did not run successfully.
│ exit code: 1
╰─> [22 lines of output]
C:UserstigerAppDataLocalProgramsPythonPython310-32libsite-packagessetuptoolsdist.py:717: UserWarning: Usage of dash-separated 'license-file' will not be supported in future versions. Please use the underscore name 'license_file' instead
warnings.warn(
C:UserstigerAppDataLocalProgramsPythonPython310-32libsite-packagessetuptoolsdist.py:294: DistDeprecationWarning: use_2to3 is ignored.
warnings.warn(f"{attr} is ignored.", DistDeprecationWarning)
running install
running build
C:UserstigerAppDataLocalTemppip-req-build-b6xigzyzbuild.py:42: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
from distutils.dep_util import newer, newer_group
Traceback (most recent call last):
File "C:UserstigerAppDataLocalTemppip-req-build-b6xigzyzbuild.py", line 49, in <module>
from buildtools.wxpysip import sip_runner
File "C:UserstigerAppDataLocalTemppip-req-build-b6xigzyzbuildtoolswxpysip.py", line 20, in <module>
from sipbuild.code_generator import (set_globals, parse, generateCode,
ModuleNotFoundError: No module named 'sipbuild'
WARNING: Building this way assumes that all generated files have been
generated already. If that is not the case then use build.py directly
to generate the source and perform the build stage. You can use
--skip-build with the bdist_* or install commands to avoid this
message and the wxWidgets and Phoenix build steps in the future.
"C:UserstigerAppDataLocalProgramsPythonPython310-32python.exe" -u build.py build
Command '"C:UserstigerAppDataLocalProgramsPythonPython310-32python.exe" -u build.py build' failed with exit code 1.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> wxPython
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
Common problem with installing various versions is python interpreters that used for the installation
Make sure you use compatible version of python to install wxPython310
What IDE you use ?
for all case scenarios I would recommend to make sure that the installation done with the right Python version , if you don’t know then reinstall required versions and make sure the versions you installed support the package
Tutorial for installing : Link
There are some issues with Python 3.10. The easiest way to deal with this situation is to downgrade your python version to 3.9.13.
The last wxPython came before Python 3.10 if I am not mistaken.
I was going through the same situation and tried a couple of solutions because I did not want to downgrade my python version, but I was wasting too much time that I did not have.
So for now just downgrade and wait for new releases, or use Tkinter.
Assuming we are on Linux…
Install a prebuilt wheel
The wxpython
wheel url is ubuntu os version and python version specific – change as necessary. The installation of extra linux packages is because the wxpython wheel (binary) depends on them.
$ pip install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-22.04 wxPython
$ sudo apt-get install libsdl2-mixer-2.0-0 libsdl2-image-2.0-0 libsdl2-2.0-0
then you can successfully
python3
Python 3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import wx
>>>
pip install wxpython – build the wxpython wheel
This builds a wxpython wheel (binary) ourselves from source, rather than using the sometimes limited choice of prebuilt wheels (e.g. there is no arm wheel). It takes a while but is pretty easy and works on intel x86
and also on linux on arm
. See https://github.com/wxWidgets/Phoenix/issues/2225 on why the attrdict3
workaround is needed.
$ sudo apt-get install dpkg-dev build-essential python3-dev freeglut3-dev libgl1-mesa-dev libglu1-mesa-dev libgstreamer-plugins-base1.0-dev libgtk-3-dev libjpeg-dev libnotify-dev libpng-dev libsdl2-dev libsm-dev libtiff-dev libwebkit2gtk-4.0-dev libxtst-dev
$ pip install attrdict3
$ pip install wxpython
I updated my python to 3.10 yesterday and had similar issues.
My guess is you are missing system packages which wxpython is using to install.
please have a look at Prerequisites here. After installing these give it another try. Also it takes significantly longer