The latest version of wxPython doesn't support the wxversion module. Instead the information is available as wx.version.
Is there any suggested work around to this? Thanks!
My environment is Ubuntu 20.04 LTS, pyenv, python 3.8.3, python 2.7.18, wxPython 4.1.0
$ apt-cache policy playonlinux
playonlinux:
Installed: 4.3.4-1ubuntu1
Candidate: 4.3.4-1ubuntu1
Version table:
*** 4.3.4-1ubuntu1 500
500 http://us.archive.ubuntu.com/ubuntu focal/multiverse amd64 Packages
500 http://us.archive.ubuntu.com/ubuntu focal/multiverse i386 Packages
100 /var/lib/dpkg/status
$ which playonlinux
/usr/bin/playonlinux
# *** note: i'm using pyenv ***
$ pyenv local 2.7.18
$ which python2
/home/dever/.pyenv/shims/python2
$ python2 -V
Python 2.7.18
$ pyenv local 3.8.3
$ which python3
/home/dever/.pyenv/shims/python3
$ python3 -V
Python 3.8.3
Installed Python 3.8.3 configuration has wxPython 4.1.0
$ python
Python 3.8.3 (default, Jul 16 2020, 20:35:40)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import wx
>>> print(wx.version)
<function version at 0x7ff77d3cbd30>
>>> print(wx.version())
4.1.0 gtk3 (phoenix) wxWidgets 3.1.4
>>> quit()
Consequently, the playonlinux command fails with this error:
$ playonlinux
Looking for python... 3.8.3 - skipped
Looking for python2.7... 2.7.18 - Traceback (most recent call last):
File "/usr/share/playonlinux/python/check_python.py", line 1, in <module>
import os, wxversion
ImportError: No module named wxversion
failed tests
Looking for python2.6...
Looking for python2... 2.7.18 - Traceback (most recent call last):
File "/usr/share/playonlinux/python/check_python.py", line 1, in <module>
import os, wxversion
ImportError: No module named wxversion
failed tests
Please install python before trying to run this program
NOTE: For those struggling to install wxPython on Ubuntu 20.04 LTS due to GTK+ error *** Could not run GTK+ test program, checking why...
Try this command (found here: https://wxpython.org/pages/downloads/)
pip install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-20.04 wxPython
For additional context also see: https://discuss.wxpython.org/t/where-to-obtain-wxversion-py/28752
playonlinux installed initially as follows, but reinstalled with standard repository on Ubuntu 20.04 LTS (i upgraded from 19.10):
The version of playonlinux I'm running is for Ubuntu 18.04 (Bionic Version) downloaded from here: https://www.playonlinux.com/en/download.html
For the Bionic version
Type the following commands:
wget -q "http://deb.playonlinux.com/public.gpg" -O- | sudo apt-key add -
sudo wget http://deb.playonlinux.com/playonlinux_bionic.list -O /etc/apt/sources.list.d/playonlinux.list
sudo apt-get update
sudo apt-get install playonlinux
Maybe playonlinux is superseded by the flatpak version?
Looking at the Github link on https://www.playonlinux.com takes you to https://github.com/PhoenicisOrg/ which suggest that perhaps the solution is to migrate to the flatpak version:
Short answer: The problem is related to pyenv, make sure
system
is first choice in global configuration:pyenv global system
or set the python version for the current shell withpyenv shell system
. If you useglobal
you only have set it once.Short explanation: Use
pyenv global system (2nd) (3rd)...
to ensure that playonlinux finds the right python; where (2nd) and (3rd) are pyenv version numbers for your installed interpreters.Long explanation: After getting the curtain rolled back with the really helpful posts by @N0bert, I've discovered that in my case the problem is pyenv related.
Specifically, I can resolve my issue by using the
pyenv global
command and makingsystem
first as follows (Note: the command you execute will depend on the versions of python you have installed):Investigating the problem more, I reviewed the following files:
/usr/share/playonlinux/bash/find_python
/usr/share/playonlinux/python/check_python.py
I made my own copies of these to understand the error better. It turns out the wxversion error is really misleading, the real problem is finding the right python shell to run.
playonlinux
depends on the system python.Initially I thought that running the
pyenv local system
would solve the problem, but because of how pyenv works this was not the case.To ensure that
/usr/share/playonlinux/bash/find_python
resolves to the system installed python, you must make sure thatpyenv global
is set withsystem
as the first choice.Many thanks to @N0rbert !!
You have to simply install latest PlayOnLinux 4.3.4 from the official repository with
and it will depend on Python 2 as it is designed to be.
The complete command to install PlayOnLinux with dependencies is below:
(from command above you can see that two wx-related packages -
python-wxgtk3.0 python-wxversion
are listed)