Python beginner tries to get wxPython installed

I tried to install wxPython on Windows 10

As told in the installation guide, I tried pip install -U wxPython, it does not work for me. That is the output:

Collecting wxPython
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by ‘NewConnectionError(’<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x000002F404D4C668>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed’)’: /simple/wxpython/
Could not find a version that satisfies the requirement wxPython (from versions: )
No matching distribution found for wxPython

I was only able to download and install the Extra Files, but obviously I am missing all the basic stuff now. The simple starting hello world example does not work:
AttributeError: module ‘wx’ has no attribute ‘App’
Also none of the demo stuff works either.

How to get the basics of wxPython to my computer?

Edit: My Python version is 3.7.2

What version of python are you running? The message is telling you that there is not a version of wxPython that matches your version of python.
Johnf

Looks like pip is having a network error. Are you able to browse to wxPython · PyPI ? If so then you can download a wheel file there that matches your Python version and use pip to install it without needing to download first.

Yes, I can browse there and I already downloaded the demo and samples from there and also the version 4.2.0 windows sources that are offered there. That are the “extras” I mentioned (Headline of the download section is “Index of /wxPython4/extras”).

The wx folder that has been created after extracting the zip file contained lots of pdb files. But since no basic function of wx works, I assumed I am missing the basic files and just got the extras that have been stripped from the basic project.

Neither the demo nor any of the samples work with the files in the wx folder.

File “demo.py”, line 3, in
import Main
File “c:\Code\Python\gurps\wxPython-demo-4.2.0\demo\Main.py”, line 62, in
import wx.adv
ModuleNotFoundError: No module named ‘wx.adv’

I do not know what exactly a wheel file is, and I see no mentioning of such a file on that site.

Edit: I just see that there is also a “Download files”-section. None of the file links there is reachable.

If you click on the Downloads link (https://pypi.org/project/wxPython/#files) the files under the “Built Distributions” section with “.whl” extensions are wheel files.

See: What Are Python Wheels and Why Should You Care? – Real Python for an explanation of wheel files.

Edit: I just downloaded one of the wheel files with no problems.

I clicked on all links, every single one is not reachable for me. I guess my company blocked the address :frowning:
Maybe that is the reason for pip not being able to establish the connection.

I will try to set it up on my private linux machine.

What a journey … starting with pip install wxPython leads to errors over errors, missing prerequisites, errors while running alternate pip- and apt-commands you can find with google to solve the problems with wxPython.

For example:
sudo pip install wxpython leaded to starting an installation but then breaking on ModuleNotFoundError: No module named ‘attrdict’. Then pip install attrdict installed it successfully, still sudo pip install wxpython again complained about attrdict missing.

After getting out of ideas and pages google offered me with (partly or non-)working solutions, I retried pip install wxPython and this time it not only started downloading, it also started a build process and installed successfully in the end. It seems on my journey I collected all prerequisites and updates needed on my linux.

I guess it would be of help to have a list of all needed prerequisites and then offer a script with sudo apt-commands that will install all of them before running pip install wxPython

Many thanks to all of you who answered :slight_smile: