Home Software Hardware Misc About

Installing wxPython on Raspberry Pi

1. Install wxPython dependencies:

sudo apt install libjpeg-dev libtiff5-dev libnotify-dev libgtk2.0-dev libgtk-3-dev libsdl1.2-dev libgstreamer-plugins-base0.10-dev libwebkitgtk-dev freeglut3 freeglut3-dev

2. Set GPU memory to 80MB or 64MB:

Preferences --> Raspberry Pi Config --> Performance


3. Set swap to 1GB or 2GB:

sudo nano /etc/dphys-swapfile
and change CONF_SWAPFILE=1000 or CONF_SWAPFILE=2000 (needs a reboot, but we will do that after the next step).


4. Turn off the GUI:

Preferences -> Raspberry Pi Configuration -> At Boot, select To CLI and reboot to CLI.


5. Install wxPython:

sudo pip3 install wxPython
(wait a couple of hours and don't panic.)


6. Return to GUI

sudo raspi-config
and go to BootOptions -> B1 Desktop / CLI -> B4 Desktop Autologin -> double 'TAB' -> Finish and reboot.


7. Download wxPython Demo and docs:

Go to https://extras.wxpython.org/wxPython4/extras/, open the folder corresponding to the installed version, download both demo and docs and extract them somewhere.


Adapted from here.