wxPython in Python3 on GoPiGo OS?

Greetings!

Background:

  1. Python2 has been officially depreciated by the Python maintainers and most, (if not all), Python projects and libraries no longer support Python2.

  2. GoPiGo OS has backwards support for Python2, but Python3 is the default Python build if not specified otherwise.

  3. Certain GoPiGo utilities, such as the control panel, have a dependency on wxPython, which though it supports Python3, does not appear to be available to Python3.

Questions:

  1. Is it possible to make the current wxPython installed in GPGOS accessible to Python3?

  2. If I do a “pip install wxpython”, (that will install the latest version), from within a terminal window after invoking python3, will this overwrite the existing wxPython install that’s accessible to Python2, or will it be its own separate installation, exclusive to Python3?  If it replaces it, it will break any Python2 utilities that depend on wxPython.

  3. Enhancement request:
    @cleoqc and @mitch.kremm
    Since Python3 is now THE supported python release, and (hopefully), everyone has gotten with the program, can we update the utilities that depend on Python2 to work with Python3?

  4. Enhancement request:
    @cleoqc @mitch.kremm
    If I determine that installing wxPython’s latest release (that only supports Python-3 now), effectively solves the problem, how do I tell you of this?

Thanks!

1 Like

Update:
After installing pip using get-pip.py, (both as pi from within Thonny and as root from a root terminal window typing python ./get-pip.py), typing “pip” in Thonny’s python shell returns NameError: name 'pip' is not defined

Viz.;

>>> pip
  Traceback (most recent call last):
     File "<pyshell>", line 1 in <module>
  NameError: name 'pip' is not defined
>>>

What am I doing wrong?

Second question:
How therefore do I install wxPython if I can’t use pip?

I don’t know anything about this situation but there is “pip3” that I use to install stuff. I used to have to do a pip install and a pip3 install, but like you pip is no longer working so now I only do the pip3 install of stuff.

2 Likes

Update:

Pip3 does not work.

From within a terminal window:

pi@Charlie:~ $ python -m pip --version
pip 21.3.1 from /home/pi/.local/lib/python3.7/site-packages/pip (python 3.7)

pi@Charlie:~ $ python -m pip3 --version
/usr/bin/python: No module named pip3

pi@Charlie:~ $ python pip install -U wxPython
python: can't open file 'pip': [Errno 2] No such file or directory

pi@Charlie:~ $ 

In a Thonny shell, none of this works.

I am obviously doing something wrong.

FYI, just in case I forgot to mention this, I’m using GPGOS.

2 Likes

Update:

I figured it out. . . .
“pip” is not a python command, it’s a system command and attempting to run it from within Python is doomed.

Having never used it before, and since the “example” was using Python to discover the version, I “assumed” that pip was always run within Python.

Nope.  It’s a userland command.
:man_facepalming:

2 Likes