Skip to content

Instantly share code, notes, and snippets.

@ekardon
Last active September 16, 2023 15:23
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ekardon/f16c3de55d37929b1b10105ef11623ee to your computer and use it in GitHub Desktop.
Save ekardon/f16c3de55d37929b1b10105ef11623ee to your computer and use it in GitHub Desktop.

It's impossible to install PyQt5 out of the box with pip in Raspbian Buster

Here is what I did

It's quite long beat with me. (First part is from official guide with extended dependencies https://wiki.qt.io/Building_Qt_5_from_Git) First we enable source repo

sudo nano /etc/apt/sources.list

To enable it we need to uncomment in the following way

deb http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
deb-src http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free

Then we need to update

sudo apt update

To prevent further missing problem reinstall cmake

sudo apt install --reinstall cmake

Now its ready. We will install dependencies as suggested by Qt5 devs

sudo apt-cache search qt | grep -oE "(^(lib)?qt[^ ]*5[^ ]*)" > packages.txt
cat packages.txt | xargs sudo apt install -y

Remove serialbus and webview fpackages from packages.txt

cat packages.txt | xargs sudo apt build-dep -y

There are some additional dependencies:

sudo apt install libxcb-xinerama0-dev

Build essentials

sudo apt-get install build-essential perl python git

Libxcb

sudo apt-get install '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev

Accessibility

sudo apt install libatspi2* libdbus-1*

QtWebkit

sudo apt-get install flex bison gperf libicu-dev libxslt-dev ruby

QtWebEngine

sudo apt-get install libssl-dev libxcursor-dev libxcomposite-dev libxdamage-dev libxrandr-dev libdbus-1-dev libfontconfig1-dev libcap-dev libxtst-dev libpulse-dev libudev-dev libpci-dev libnss3-dev libasound2-dev libxss-dev libegl1-mesa-dev gperf bison

QtMultimedia

sudo apt-get install libasound2-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev

QDoc

sudo apt install libclang-6.0-dev llvm-6.0

After installing all dependencies now we can insall PyQt5 First we update pip and setuptools

pip3 install --upgrade pip
pip3 install --upgrade setuptools

Then we install it The following command will take a lot of time, because it compiles PyQt5 from its source. That's why this package is so small (3.2MB)

pip3 -v install pyqt5 --user

If skips some packages check following packages

To enable QtDesigner

sudo apt-get install qttools5-*

To enable QtHelp

sudo apt install qttools5-dev qttools5-dev-tools libqt5help5

To enable QtMultimedia and QtMultimediaWidgets

sudo apt-get install qtmultimedia5-dev libqt5multimediawidgets5 libqt5multimedia5-plugins libqt5multimedia5 libqt5multimedia*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment