Sunday, May 12, 2024
 Popular · Latest · Hot · Upcoming
3
rated 0 times [  3] [ 0]  / answers: 1 / hits: 3989  / 3 Years ago, wed, may 12, 2021, 10:28:44

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


More From » python

 Answers
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 !!


[#2998] Friday, May 14, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
farnic

Total Points: 409
Total Questions: 117
Total Answers: 125

Location: Andorra
Member since Sat, May 27, 2023
1 Year ago
farnic questions
Wed, Jan 19, 22, 12:39, 2 Years ago
Tue, Oct 18, 22, 16:37, 2 Years ago
Tue, Jun 22, 21, 10:28, 3 Years ago
Sun, Dec 19, 21, 03:29, 2 Years ago
;