1

May I know if there are any tricks for installing PyQt5 in Raspberry Pi? After trying to install PyQt5 by using pip, the process hangs at "Preparing metadata". I had tried adding its dependencies already, but the problem below still occurs.

#p/s: I managed to run sudo apt install python3-pyqt5 but still failed to import PyQt5

Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting PyQt5==5.15.2
  Downloading PyQt5-5.15.2.tar.gz (3.3 MB)
     ---------------------------------- 3.3/3.3 MB 2.0 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... |
JunJie Lim
  • 13
  • 4

2 Answers2

0

ok fine... I managed to solve it by following the solution as posted here Can't install PyQt5 On Raspberry pi

JunJie Lim
  • 13
  • 4
0

if you are ok with using conda or mamba to manage environments/packages on your raspberry pi, you can use mambaforge to set up your python environment, and install pyqt5 from their repository. it works easier and faster than having to sort out dependencies and compile from source. (works on raspberry pi 4 running bullseye)

  1. install mambaforge
    • download the install script
    • $ wget https://github.com/conda-forge/miniforge/releases/download/23.1.0-4/Mambaforge-23.1.0-4-Linux-aarch64.sh
    • run the install script
    • $ bash Mambaforge-23.1.0-4-Linux-aarch64.sh
    • answer the installer prompts, recommend letting installer initialize Mambaforge
    • --Do you wish the installer to initialize Mambaforge by running conda init? [yes|no] >>> yes
    • restart the shell
  2. set-up the python virtual environment
    • create the virtual environment (example create a virtual environment called "py311" running python 3.11
    • $ mamba create -n py311 python=3.11
    • enter the new virtual environment
    • $ mamba activate py311
    • install python packages (in this case "pyqt" is the pyqt5 package)
    • $ mamba install pyqt