Recently I tried to contribute to the Robotframework project on Github. Specifically to their project RIDE which is a IDE to write Robotframework-style tests. For the development I wanted to use a virtual environment using virtualenv. Unfortunately it is not possible to install the required version wxPython 2.8.12.1 via pip or easy_install. Instead you either have to build it from source or using your own os’ package manager.

This will install wxPython for you, but you can not use it in your virtual environment. After some googling I came across a few Stackoverflow posts but all in all I figured there could be a more comprehensive answer so one does not have to fish all the small details together. Here is how I solved the problem on Ubuntu 14.04.

Installing wxPython 2.8.12.1

RIDE requires you to have at least wxPython 2.8.12.1 installed. So I downloaded the sources from the official repository and build the lib by hand following the instructions on Building wxPython 2.8 for Development and Testing.

I then created my virtual environment and switched into its Python site-packages directory:

cd {virtual environment}/lib/python2.7/site-packages/

I search for the location of my wxPython installation using locate:

locate wxPython

And it turns out it lies at /usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode/. So now I tried what some Stackoverflow posts suggested: linking the sources to my virtual environment. I did so by:

# we are still at {virtual env}/lib/python2.7/site-packages
ln -s /usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode/
ln -s /usr/lib/python2.7/dist-packages/wx.pth
ln -s /usr/lib/python2.7/dist-packages/wxversion.py

Initially I forgot the last file wxversion.py, but this module is imported by RIDEs ride_postinstall.py to check for the existence of wxPython.