Install wxPython fail ERROR: Could not build wheels for wxpython, which is required to install pyproject.toml-based projects

hello, when i install wxPython, i meet the failure like this, i can’t find de solution method, please help me, thanks

ERROR: Could not build wheels for wxpython, which is required to install pyproject.toml-based projects

the whole information is as below

C:\Users\Administrator>pip install wxpython==4.0.4
Looking in indexes:
Collecting wxpython==4.0.4
Using cached (68.8 MB)
Installing build dependencies … done
Getting requirements to build wheel … done
Installing backend dependencies … done
Preparing metadata (pyproject.toml) … done
Requirement already satisfied: six in d:\python388\lib\site-packages (from wxpython==4.0.4) (1.16.0)
Requirement already satisfied: Pillow in d:\python388\lib\site-packages (from wxpython==4.0.4) (10.2.0)
Building wheels for collected packages: wxpython
Building wheel for wxpython (pyproject.toml) … error
error: subprocess-exited-with-error

× Building wheel for wxpython (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [52 lines of output]
running bdist_wheel
running build DeprecationWarning: dep_util is Deprecated. Use functions from setuptools instead.
from distutils.dep_util import newer, newer_group
Will build using: “d:\python388\python.exe”
3.8.8rc1 (tags/v3.8.8rc1:dfd7d68, Feb 17 2021, 11:01:21) [MSC v.1928 64 bit (AMD64)]
Python’s architecture is 64bit
cfg.VERSION: 4.0.4

  Running command: build
  Running command: build_wx
  Command '"d:\python388\python.exe" -c "import distutils.msvc9compiler as msvc; mc = msvc.MSVCCompiler(); mc.initialize(); print("' failed with exit code 1.
  Traceback (most recent call last):

    File "<string>", line 1, in <module>

    File "d:\python388\lib\distutils\", line 372, in initialize

      vc_env = query_vcvarsall(VERSION, plat_spec)

    File "d:\python388\lib\distutils\", line 261, in query_vcvarsall

      raise DistutilsPlatformError("Unable to find vcvarsall.bat")

  distutils.errors.DistutilsPlatformError: Unable to find vcvarsall.bat
  Finished command: build_wx (0.84s)
  Finished command: build (0.84s)
  C:\Users\Administrator\AppData\Local\Temp\pip-build-env-69jrhm08\overlay\Lib\site-packages\setuptools\ DistDeprecationWarning: use_2to3 is ignored.
    ep.load()(self,, value)
  C:\Users\Administrator\AppData\Local\Temp\pip-build-env-69jrhm08\overlay\Lib\site-packages\setuptools\ SetuptoolsDeprecationWarning: Invalid dash-separated options

          Usage of dash-separated 'license-file' will not be supported in future
          versions. Please use the underscore name 'license_file' instead.

          By 2024-Sep-26, you need to update your project and remove deprecated calls
          or your builds will no longer be supported.

          See for details.

    opt = self.warn_dash_deprecation(opt, section)
  WARNING: Building this way assumes that all generated files have been
  generated already.  If that is not the case then use 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.

  "d:\python388\python.exe" -u build
  Command '"d:\python388\python.exe" -u 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: Failed building wheel for wxpython
Failed to build wxpython
ERROR: Could not build wheels for wxpython, which is required to install pyproject.toml-based projects


This one fails:

import distutils.msvc9compiler as msvc; mc = msvc.MSVCCompiler(); mc.initialize(); print(


DistutilsPlatformError("Unable to find vcvarsall.bat")

Do you have Visual Studio installed?

To avoid the next pitfalls:
Do you have Cygwin installed or WSL with a bash shell?
Is the Scripts dir on the path? Otherwise e.g. sip-build.exe will not be found by the build script.
Instead of pip, you may use this command line:

...[path to python]\python.exe dox etg --nodoc sip build

(For building only. There are options for installation and wheel creation.)

Why do you need exactly Python 3.8 and wxPython 4.0.4?
More recent wxPython versions have binaries for Python 3.8.
This wxPython version has binaries for Python 3.4 to 3.7.

first of all thanks a lot. in fact i’m tring to install robot framework to work,i got some news that only the earlier version of python can adapt to robot framework. So i download python 3.8.8rc1 and follow the suggestion to install. But although it seems install already in dos, but my robot framework-ride can’t work as a GUI, i’m not sure if the version not matching. I’m look forward to your answer, thx again

Python 3.8.8rc1 (tags/v3.8.8rc1:dfd7d68, Feb 17 2021, 11:01:21) [MSC v.1928 64 bit (AMD64)] on win32
Type “help”, “copyright”, “credits” or “license” for more information.

C:\Users\Administrator>pip list
Package Version

attrs 23.2.0
certifi 2024.2.2
cffi 1.16.0
click 8.1.7
colorama 0.4.6
exceptiongroup 1.2.0
grpcio 1.60.1
grpcio-tools 1.60.1
h11 0.14.0
idna 3.6
numpy 1.24.4
outcome 1.3.0.post0
overrides 7.7.0
pillow 10.2.0
pip 24.0
protobuf 4.25.3
psutil 5.9.8
pycparser 2.21
Pygments 2.17.2
PyMySQL 0.9.3
PyPubSub 3.3.0
PySocks 1.7.1
pywin32 306
robotframework 7.0
robotframework-pythonlibcore 4.4.0
robotframework-selenium2library 3.0.0
robotframework-seleniumlibrary 6.2.0
selenium 4.18.1
setuptools 49.2.1
six 1.16.0
sniffio 1.3.1
sortedcontainers 2.4.0
trio 0.25.0
trio-websocket 0.11.1
typing_extensions 4.10.0
urllib3 2.2.1
wrapt 1.16.0
wsproto 1.2.0
wxPython 4.2.1


From the list it seems you have wxPython 4.2.1 installed.
What is the error message if you want to start the GUI of your framework?

4.2.1 is more recent and while all wx versions are compatible, the recent version will not accept some wrong values that older versions were ignoring. E.g. when you add an item to a horizontal sizer and set aligment to ALIGN_LEFT, this will be ignored in 4.0.4 but raise an error in 4.2.1.

Selecting a rc as Python version is a bit of a strange choice. Python 3.8.19 is available for download. This should not make a difference, though.

thx for your advise,my ride already can run as GUI, i’m thinking it’s may be i’m not install python interpreter,thx a lot, i’m trying to finish my work.