3

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:

https://flathub.org/apps/details/org.phoenicis.playonlinux

5
  • Please add output of apt-cache policy playonlinux, which playonlinux, which python2, which python3 to the question by editing it.
    – N0rbert
    Jul 17, 2020 at 17:11
  • @N0rbert i've added then environmental information to the beginning of the question - Thanks! Jul 17, 2020 at 17:27
  • 1
    Then yours python venv created problems. Try with normal system-wide python.
    – N0rbert
    Jul 17, 2020 at 17:31
  • i don't see how that could be related to the wxversion module not existing and being retired in the latest version of wxPython. The error message doesn't indicate a python version environment problem, but rather a wxPython version incompatibility IMO Jul 17, 2020 at 17:45
  • The PlayOnLinux depends on Python 2. Install all the stuff using APT.
    – N0rbert
    Jul 17, 2020 at 17:45

2 Answers 2

3

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 with pyenv shell system. If you use global 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 making system first as follows (Note: the command you execute will depend on the versions of python you have installed):

pyenv global system 3.8.3 2.7.18 anaconda3-2019.10

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 that pyenv global is set with system as the first choice.

Many thanks to @N0rbert !!

1
  • It is really great that you found the root of the problem!
    – N0rbert
    Jul 17, 2020 at 20:50
1

You have to simply install latest PlayOnLinux 4.3.4 from the official repository with

sudo add-apt-repository multiverse
sudo apt-get install --reinstall playonlinux=4.3.4-1ubuntu1

and it will depend on Python 2 as it is designed to be.


The complete command to install PlayOnLinux with dependencies is below:

sudo apt-get install cabextract curl fonts-wine gcc-10-base:i386 \
glib-networking:i386 gsfonts gstreamer1.0-plugins-base:i386 \
gstreamer1.0-plugins-good:i386 gstreamer1.0-x:i386 i965-va-driver:i386 \
icoutils imagemagick imagemagick-6-common imagemagick-6.q16 \
intel-media-va-driver:i386 jq libaa1:i386 libaom0:i386 libasn1-8-heimdal:i386 \
libasound2:i386 libasound2-plugins:i386 libasyncns0:i386 libatomic1:i386 \
libavahi-client3:i386 libavahi-common-data:i386 libavahi-common3:i386 \
libavc1394-0:i386 libavcodec58:i386 libavutil56:i386 libblkid1:i386 \
libbrotli1:i386 libbsd0:i386 libbz2-1.0:i386 libc6:i386 libcaca0:i386 \
libcairo-gobject2:i386 libcairo2:i386 libcap2:i386 libcapi20-3:i386 \
libcdparanoia0:i386 libcodec2-0.9:i386 libcom-err2:i386 libcrypt1:i386 \
libcups2:i386 libcurl3-gnutls:i386 libdatrie1:i386 libdb5.3:i386 libdbus-1-3:i386 \
libdrm-amdgpu1:i386 libdrm-intel1:i386 libdrm-nouveau2:i386 libdrm-radeon1:i386 \
libdrm2:i386 libdv4:i386 libedit2:i386 libelf1:i386 libexif12:i386 \
libexpat1:i386 libfaudio0:i386 libffi7:i386 libflac8:i386 libfontconfig1:i386 \
libfreetype6:i386 libfribidi0:i386 libgcc-s1:i386 libgcrypt20:i386 \
libgd3:i386 libgdbm-compat4:i386 libgdbm6:i386 libgdk-pixbuf2.0-0:i386 \
libgl1:i386 libgl1-mesa-dri:i386 libglapi-mesa:i386 libglib2.0-0:i386 \
libglu1-mesa:i386 libglvnd0:i386 libglx-mesa0:i386 libglx0:i386 libgmp10:i386 \
libgnutls30:i386 libgomp1:i386 libgpg-error-l10n libgpg-error0:i386 \
libgphoto2-6:i386 libgphoto2-port12:i386 libgpm2:i386 libgraphite2-3:i386 \
libgsm1:i386 libgssapi-krb5-2:i386 libgssapi3-heimdal:i386 \
libgstreamer-plugins-base1.0-0:i386 libgstreamer-plugins-good1.0-0:i386 \
libgstreamer1.0-0:i386 libgudev-1.0-0:i386 libharfbuzz0b:i386 \
libhcrypto4-heimdal:i386 libheimbase1-heimdal:i386 libheimntlm0-heimdal:i386 \
libhogweed5:i386 libhx509-5-heimdal:i386 libicu66:i386 libidn2-0:i386 \
libiec61883-0:i386 libieee1284-3:i386 libigdgmm11:i386 libilmbase24 \
libjack-jackd2-0:i386 libjbig0:i386 libjpeg-turbo8:i386 libjpeg8:i386 \
libjq1 libk5crypto3:i386 libkeyutils1:i386 libkrb5-26-heimdal:i386 \
libkrb5-3:i386 libkrb5support0:i386 liblcms2-2:i386 libldap-2.4-2:i386 \
libllvm10:i386 liblqr-1-0 libltdl7:i386 liblz4-1:i386 liblzma5:i386 \
libmagickcore-6.q16-6 libmagickcore-6.q16-6-extra libmagickwand-6.q16-6 \
libmount1:i386 libmp3lame0:i386 libmpg123-0:i386 libmysqlclient21:i386 \
libncurses6:i386 libncursesw6:i386 libnetpbm10 libnettle7:i386 \
libnghttp2-14:i386 libnuma1:i386 libodbc1:i386 libogg0:i386 libonig5 \
libopenal1:i386 libopenexr24 libopenjp2-7:i386 libopus0:i386 liborc-0.4-0:i386 \
libosmesa6:i386 libp11-kit0:i386 libpango-1.0-0:i386 libpangocairo-1.0-0:i386 \
libpangoft2-1.0-0:i386 libpcap0.8:i386 libpci3:i386 libpciaccess0:i386 \
libpcre2-8-0:i386 libpcre3:i386 libperl5.30:i386 libpixman-1-0:i386 \
libpng16-16:i386 libproxy1v5:i386 libpsl5:i386 libpulse0:i386 \
libpython2-stdlib libpython2.7-minimal libpython2.7-stdlib libraw1394-11:i386 \
libroken18-heimdal:i386 librsvg2-2:i386 librsvg2-common:i386 librtmp1:i386 \
libsamplerate0:i386 libsane:i386 libsasl2-2:i386 libsasl2-modules:i386 \
libsasl2-modules-db:i386 libsdl2-2.0-0:i386 libselinux1:i386 libsensors5:i386 \
libshine3:i386 libshout3:i386 libslang2:i386 libsnappy1v5:i386 \
libsndfile1:i386 libsndio7.0:i386 libsnmp35:i386 libsoup2.4-1:i386 \
libsoxr0:i386 libspeex1:i386 libsqlite3-0:i386 libssh-4:i386 libssl1.1:i386 \
libstb0:i386 libstdc++6:i386 libswresample3:i386 libsystemd0:i386 \
libtag1v5:i386 libtag1v5-vanilla:i386 libtasn1-6:i386 libthai0:i386 \
libtheora0:i386 libtiff5:i386 libtinfo6:i386 libtwolame0:i386 libudev1:i386 \
libunistring2:i386 libusb-1.0-0:i386 libuuid1:i386 libv4l-0:i386 \
libv4lconvert0:i386 libva-drm2:i386 libva-x11-2:i386 libva2:i386 \
libvdpau1:i386 libvisual-0.4-0:i386 libvkd3d1:i386 libvorbis0a:i386 \
libvorbisenc2:i386 libvpx6:i386 libvulkan1:i386 libwavpack1:i386 \
libwayland-client0:i386 libwayland-cursor0:i386 libwayland-egl1:i386 \
libwebp6:i386 libwebpmux3:i386 libwind0-heimdal:i386 libwine:i386 \
libwrap0:i386 libwxbase3.0-0v5 libwxgtk3.0-gtk3-0v5 libx11-6:i386 \
libx11-xcb1:i386 libx264-155:i386 libx265-179:i386 libxau6:i386 \
libxcb-dri2-0:i386 libxcb-dri3-0:i386 libxcb-glx0:i386 libxcb-present0:i386 \
libxcb-randr0:i386 libxcb-render0:i386 libxcb-shm0:i386 libxcb-sync1:i386 \
libxcb-xfixes0:i386 libxcb1:i386 libxcomposite1:i386 libxcursor1:i386 \
libxdamage1:i386 libxdmcp6:i386 libxext6:i386 libxfixes3:i386 libxi6:i386 \
libxinerama1:i386 libxkbcommon0:i386 libxml2:i386 libxpm4:i386 \
libxrandr2:i386 libxrender1:i386 libxshmfence1:i386 libxslt1.1:i386 \
libxss1:i386 libxv1:i386 libxvidcore4:i386 libxxf86vm1:i386 libzstd1:i386 \
libzvbi0:i386 mesa-va-drivers:i386 mesa-vdpau-drivers:i386 \
mesa-vulkan-drivers:i386 netpbm ocl-icd-libopencl1:i386 \
playonlinux python-wxgtk3.0 python-wxversion python2 python2-minimal \
python2.7 python2.7-minimal va-driver-all:i386 vdpau-driver-all:i386 \
wine wine32:i386 zlib1g:i386

(from command above you can see that two wx-related packages - python-wxgtk3.0 python-wxversion are listed)

6
  • The error suggest that the the issue is wxversion is not found, this has been replaced by wx.version in the latest version of wxPython v4. I could not get wxPython installed with pip until I provided the -f option for the .whl as shown above (due to gtk+ install errors). I don't think there is a whl file for an earlier version of wxPython available that would have the older wxversion module. Jul 17, 2020 at 17:40
  • I ran the commands you suggest successfully and get the same error: 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 Jul 17, 2020 at 17:43
  • 1
    IMHO you have created special additional problems by using pip on top of APT and by using local python on top of system-wide python. Switching to system-wide python will fix the issue. I have just installed PoL on normal 20.04 LTS with normal python, I have no issues here.
    – N0rbert
    Jul 17, 2020 at 17:44
  • Which version of wxPython did you install and how do you install that without using pip? If you're not installing wxPython 4 please share the version and the command. Thank You!! Jul 17, 2020 at 17:54
  • /usr/share/playonlinux/python/check_python.py didn't even run with the system python until adding this check os.environ.has_key("POL_OS"). So that no longer fails. I suspect that /usr/share/playonlinux/bash/find_python is doing something that is incompatible with pyenv. I will investigate further. I need pyenv as a developer. You can easily switch back to the system python, but doing that doesn't solve the issue. Will try to diagnose further. It appears I have everything installed by apt sudo apt search wxpython correctly. Jul 17, 2020 at 18:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .