Skip to content

jessie

wxPython4 (4.0.0b1) on Raspberry Pi 3 Debian 8 Jessie

wxPython-4.0.0a1 has been released in April 2017, unfortunately, there is no wheel build for raspbian.
Using the following command build wxpython each time :

pip install wxpython==4.0.0b1

So, for now, if you want to build wxPython-4 on your raspberry pi 3, and get a plug-and-play and re-usable tarball for others rpi, you can follow those instructions :

Build preparation

about 2,7G will be needed to build wxPython.

apt install dpkg-dev build-essential python3.4-dev libwebkitgtk-dev \
            libjpeg-dev libtiff-dev libgtk2.0-dev libsdl1.2-dev \
            libgstreamer-plugins-base0.10-dev libnotify-dev freeglut3 \
            freeglut3-dev
cd /home/pi
mkdir wxp4
cd wxp4
wget -O wxPython-4.0.0b1.tar.gz 'https://pypi.python.org/packages/be/b5/fc263904687769cb1db2801fb2899f461bd6a7d65f729455cd378456ac41/wxPython-4.0.0b1.tar.gz#md5=83bfed89a46b489a4a93437199e6e598'
tar xzvf wxPython-4.0.0b1.tar.gz
rm wxPython-4.0.0b1.tar.gz
cd wxPython-4.0.0b1/

Build

Be sure to make all following step in the same shell where ${wxp_opts} is defined

wxp_opts=""
wxp_opts="${wxp_opts} --python=/usr/bin/python3.4"
wxp_opts="${wxp_opts} --jobs=1"  # more than one jobs my require more memory than the 1GB available on RPi3
wxp_opts="${wxp_opts} --nodoc"
wxp_opts="${wxp_opts} --release"
wxp_opts="${wxp_opts} --unicode"
wxp_opts="${wxp_opts}"
time python3.4 build.py ${wxp_opts} build_wx

[…]
real 61m47.094s
user 58m4.340s
sys 1m51.910s

time python3.4 build.py ${wxp_opts} build_py

[…]
———— BUILD FINISHED ————
To use wxPython from the build folder (without installing):
– Set your PYTHONPATH variable to /home/pi/wxp4/wxPython-4.0.0b1.
– You may also need to set your (DY)LD_LIBRARY_PATH to /home/pi/wxp4/wxPython-4.0.0b1/build/wxbld/lib,
or wherever the wxWidgets libs have been installed.

Finished command: build_py (188m44.303s)
Done!

real 188m45.462s
user 182m32.760s
sys 5m23.100s

time python3.4 build.py ${wxp_opts} bdist

You have your build available here :

/home/pi/wxp4/wxPython-4.0.0b1/dist/wxPython-4.0.0b1-linux-py3.4.tar.gz

Use

For example :

mkdir ~/dev
cd ~/dev
virtualenv --python=python3.4 --distribute --no-site-packages --unzip-setuptools myvirtualenv
tar xf /home/pi/wxp4/wxPython-4.0.0b1/dist/wxPython-4.0.0b1-linux-py3.4.tar.gz -C ~/dev/myvirtualenv/
echo "${HOME}/dev/myvirtualenv/wxPython-4.0.0b1-linux-py3.4/" >~/dev/myvirtualenv/lib/python3.4/site-packages/wxpython.pth
source ~/dev/myvirtualenv/bin/activate
$ python -c 'import wx; print(wx.version())'
4.0.0b1 gtk2 (phoenix)