Tuesday, February 1, 2022

[SOLVED] wxPython virtualenv python 3

Issue

I am trying to migrate my projects from Python 2.7.12 to Python 3.5.2. (That is the right thing to do; isn't it?)

I do understand that getting wxPython to work in virtualenv can be a problem, but it works fine on Python 2 if I use this command to create the environment:

virtualenv env --system-site-packages

For Python 3, I use:

virtualenv -p python3 env --system-site-packages

But (as expected) this doesn't pick up wxPython

wxPython is installed at:

/usr/lib/python2.7/dist-packages

but, of course, in

/usr/lib/python3/dist-packages

There is no wxPython.

What do I need to do to use it in my Python 3 environment?

I have entered my virtualenv environment and ran:

pip install -U wxPython

as recommended here, but I get all these error messages


Solution

You appear not to have gtk3 installed on your system.
I made a similar mistake when I built the gtk3 version of wxpython and expected it to look the same as gtk2 it doesn't!
Either install gtk3 or see this Has wxpython SpinCtrl/SpinButton changed between Classic and Phoenix? which how I installed and built wxpython 4.0.0b2 for gtk2 on Linux (there's always a caveat)



Answered By - Rolf of Saxony
Answer Checked By - Marilyn (WPSolving Volunteer)