pythonpython-3.xpipwxpython

pip building wheel for wxPython on Ubuntu


I have tried to install wxPython on Python versions 3.10, 3.12, and 3.13, and they all fail with much the same error. I've installed as many of the required packages as are necessary. Does anyone have any ideas as to what the problem is?

2025-04-24T15:50:35,367   make[1]: *** [Makefile:28693: coredll_sound_sdl.o] Error 1
2025-04-24T15:50:35,367   make[1]: *** Waiting for unfinished jobs....
2025-04-24T15:50:40,070   make[1]: Leaving directory '/tmp/pip-install-sb8y98_e/wxpython_07aa987c368f479ba95852e8f4be3929/build/wxbld/gtk3'
2025-04-24T15:50:40,071   Error building
2025-04-24T15:50:40,071   ERROR: failed building wxWidgets
2025-04-24T15:50:40,073   Traceback (most recent call last):
2025-04-24T15:50:40,073     File "/tmp/pip-install-sb8y98_e/wxpython_07aa987c368f479ba95852e8f4be3929/build.py", line 1607, in cmd_build_wx
2025-04-24T15:50:40,073       wxbuild.main(wxDir(), build_options)
2025-04-24T15:50:40,073       ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
2025-04-24T15:50:40,073     File "/tmp/pip-install-sb8y98_e/wxpython_07aa987c368f479ba95852e8f4be3929/buildtools/build_wxwidgets.py", line 505, in main
2025-04-24T15:50:40,073       exitIfError(wxBuilder.build(dir=buildDir, options=args), "Error building")
2025-04-24T15:50:40,074       ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-04-24T15:50:40,074     File "/tmp/pip-install-sb8y98_e/wxpython_07aa987c368f479ba95852e8f4be3929/buildtools/build_wxwidgets.py", line 70, in exitIfError
2025-04-24T15:50:40,074       raise builder.BuildError(msg)
2025-04-24T15:50:40,074   buildtools.builder.BuildError: Error building
2025-04-24T15:50:40,074   Finished command: build_wx (7m52.940s)
2025-04-24T15:50:40,074   Finished command: build (7m52.940s)
2025-04-24T15:50:40,130   WARNING: Building this way assumes that all generated files have been
2025-04-24T15:50:40,130   generated already.  If that is not the case then use build.py directly
2025-04-24T15:50:40,130   to generate the source and perform the build stage.  You can use
2025-04-24T15:50:40,130   --skip-build with the bdist_* or install commands to avoid this
2025-04-24T15:50:40,130   message and the wxWidgets and Phoenix build steps in the future.

2025-04-24T15:50:40,130   "/home/cnobile/.virtualenvs/nc3.13/bin/python" -u build.py build
2025-04-24T15:50:40,131   Command '"/home/cnobile/.virtualenvs/nc3.13/bin/python" -u build.py build' failed with exit code 1.
2025-04-24T15:50:40,197   ERROR: Building wheel for wxPython (pyproject.toml) exited with 1
2025-04-24T15:50:40,202   [bold magenta]full command[/]: [blue]/home/cnobile/.virtualenvs/nc3.13/bin/python /home/cnobile/.virtualenvs/nc3.13/lib/python3.13/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py build_wheel /tmp/tmp3i6rdxss[/]
2025-04-24T15:50:40,202   [bold magenta]cwd[/]: /tmp/pip-install-sb8y98_e/wxpython_07aa987c368f479ba95852e8f4be3929
2025-04-24T15:50:40,203   ERROR: Failed building wheel for wxPython
2025-04-24T15:50:40,203 Failed to build wxPython
2025-04-24T15:50:40,266 Remote version of pip: 25.0.1
2025-04-24T15:50:40,266 Local version of pip:  25.0.1
2025-04-24T15:50:40,268 Was pip installed by pip? True
2025-04-24T15:50:40,269 ERROR: Failed to build installable wheels for some pyproject.toml based projects (wxPython)
2025-04-24T15:50:40,269 Exception information:
2025-04-24T15:50:40,269 Traceback (most recent call last):
2025-04-24T15:50:40,269   File "/home/cnobile/.virtualenvs/nc3.13/lib/python3.13/site-packages/pip/_internal/cli/base_command.py", line 106, in _run_wrapper
2025-04-24T15:50:40,269     status = _inner_run()
2025-04-24T15:50:40,269   File "/home/cnobile/.virtualenvs/nc3.13/lib/python3.13/site-packages/pip/_internal/cli/base_command.py", line 97, in _inner_run
2025-04-24T15:50:40,269     return self.run(options, args)
2025-04-24T15:50:40,269            ~~~~~~~~^^^^^^^^^^^^^^^
2025-04-24T15:50:40,269   File "/home/cnobile/.virtualenvs/nc3.13/lib/python3.13/site-packages/pip/_internal/cli/req_command.py", line 67, in wrapper
2025-04-24T15:50:40,269     return func(self, options, args)
2025-04-24T15:50:40,269   File "/home/cnobile/.virtualenvs/nc3.13/lib/python3.13/site-packages/pip/_internal/commands/install.py", line 435, in run
2025-04-24T15:50:40,269     raise InstallationError(
2025-04-24T15:50:40,269     ...<4 lines>...
2025-04-24T15:50:40,269     )
2025-04-24T15:50:40,269 pip._internal.exceptions.InstallationError: Failed to build installable wheels for some pyproject.toml based projects (wxPython)
2025-04-24T15:50:40,270 Removed build tracker: '/tmp/pip-build-tracker-2k4mpfgl'


Solution

  • The make[1]: *** [Makefile:28693: coredll_sound_sdl.o] Error 1 error you have is because of the coredll_sound_sdl.o file you have.


    Try installing the required dependencies since I assume it run on several system libraries. You might be missing SDL-related dependencies.

    sudo apt-get update
    sudo apt-get install -y \
        libgtk-3-dev \
        libwebkit2gtk-4.0-dev \
    # more libraries...
    

    You should also check you SDL version. I recommend versions 2.0.12 or later because wxPython works greatly with them. Use the command:

    sdl2-config --version
    

    Lastly, you can see if your GCC Compiler is working correctly:

    g++ --version
    

    If you don't have it installed, then use:

    sudo apt-get update
    sudo apt-get install build-essential