I successfully installed wxPython (latest version) but get the following exception at line 12 of core.py:
from ._core import *
Exception has occurred: ModuleNotFoundError (note: full exception trace is shown but execution is paused at: _run_module_as_main)
No module named 'wx.core’
File “C:\Users\dcox1\Development\wxpython\venv\Lib\site-packages\wx\core.py”, line 12, in
from .core import *
File "C:\Users\dcox1\Development\wxpython\venv\Lib\site-packages\wx_init.py", line 17, in
from wx.core import *
File "C:\Users\dcox1\Development\wxpython\venv\Lib\site-packages\wx_init.py", line 11, in
import wx.version
File “C:\Users\dcox1\AppData\Local\Programs\Python\Python311\Lib\runpy.py”, line 88, in _run_code
exec(code, run_globals)
File “C:\Users\dcox1\AppData\Local\Programs\Python\Python311\Lib\runpy.py”, line 198, in _run_module_as_main (Current frame)
return _run_code(code, main_globals, None,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named ‘wx._core’
I have uninstalled and reinstalled a couple of times with the same result. Installation for me was more than simply pip install wxPython. I have to first install “attrdict3” and “requests” and, of course, Visual Studio Community Edition (I’m on Windows 11). As I say, with these caveats, installation is a success:
(venv) C:\Users\dcox1\Development\wxpython>pip install wxPython
Collecting wxPython
Using cached wxPython-4.2.0.tar.gz (71.0 MB)
Preparing metadata (setup.py) … done
Requirement already satisfied: pillow in c:\users\dcox1\development\wxpython\venv\lib\site-packages (from wxPython) (9.4.0)
Requirement already satisfied: six in c:\users\dcox1\development\wxpython\venv\lib\site-packages (from wxPython) (1.16.0)
Requirement already satisfied: numpy in c:\users\dcox1\development\wxpython\venv\lib\site-packages (from wxPython) (1.24.2)
Installing collected packages: wxPython
DEPRECATION: wxPython is being installed using the legacy ‘setup.py install’ method, because it does not have a ‘pyproject.toml’ and the ‘wheel’ package is not installed. pip 23.1 will enforce this behaviour change. A possible replacement is to enable the ‘–use-pep517’ option. Discussion can be found at https://github.com/pypa/pip/issues/8559
Running setup.py install for wxPython … done
Successfully installed wxPython-4.2.0
pip list gives the following:
(venv) C:\Users\dcox1\Development\wxpython>pip list
Package Version
attrdict3 2.0.2
certifi 2022.12.7
charset-normalizer 3.1.0
idna 3.4
install 1.3.5
numpy 1.24.2
Pillow 9.4.0
pip 23.0.1
requests 2.28.2
setuptools 65.5.0
six 1.16.0
urllib3 1.26.15
wxPython 4.2.0