skip to Main Content

I’m trying to import wx, and getting an error.
I’m using wxPython version 4.2.0, installed with pip 22.3.1.
I’m on Windows 10.

Here’s how I get the error and what it says:

Python 3.11.0 (main, Oct 24 2022, 18:26:48) [MSC v.1933 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import wx
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:UserslynnsAppDataLocalProgramsPythonPython311Libsite-packageswx__init__.py", line 17, in <module>
    from wx.core import *
  File "C:UserslynnsAppDataLocalProgramsPythonPython311Libsite-packageswxcore.py", line 12, in <module>
    from ._core import *
ModuleNotFoundError: No module named 'wx._core'

The file this is seemingly asking for (_core) is in that directory (site_packageswx_core).

I’ve tried reinstalling the package through pip, as well as installing it from a source file provided on wxpython.org (that one fails to even build).
Update: I have tried uninstalling and reinstalling everything python related on my pc, and the problem still persists.

I tried looking this problem up and I can’t find anything relevant, and the only two topics that come up here on stackoverflow are not helpful to me.
(Wxpython installation failed) – my package is in the right folder.
(Installation of wxPython on Python 3.7 on Ubuntu 18.04) – using a different python version and OS, and hasn’t been answered.

What’s the cause of this error, and how can it be resolved?

3

Answers


  1. There are currently no official wxPython wheels for Python 3.11 on Windows. But take a look here, you will find unofficial wheels of wxPython for Win10(x64/x86) and Pyhon 3.11:

    https://dev.azure.com/oleksis/wxPython/_build/results?buildId=89&view=artifacts&pathAsName=false&type=publishedArtifacts

    Login or Signup to reply.
  2. I saw the same error as the OP when I installed wxpython with pip

    I was successful using miniconda on Windows 11. I created a conda env with python=3.11 and then used conda to install wxpython.

    See:
    https://docs.conda.io/en/latest/miniconda.html

    Login or Signup to reply.
  3. Uninstall and reinstall wxPython may solve this issue.
    If you have installed wxPython it’s better to uninstall wxWidgets module first before you install wxPython.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search