0

I installed Python 3.7 on my raspberry pi with the help of Installing Python 3.7.0 on Raspbian tutorial and wanted to use it to start my script which uses PyQt5 but its throwing a ModuleNotFoundError. PyQt5 is installed and working with 3.4.2 why is it not working with 3.7 ?

Traceback (most recent call last):
  File "gui.py", line 8, in <module>
    from PyQt5 import QtCore, QtGui, QtWidgets
ModuleNotFoundError: No module named 'PyQt5'

Thanks in advance for any kind of help !

2

You can't install an out-of-distribution Python version and expect system Python packages to work. They're compiled for Python 3.5 that's included in the distribution.

I suggest you upgrade to Buster (unreleased/testing) to get system Python 3.7 and PyQt from the distribution.

To upgrade to Buster, edit /etc/apt/sources.list and replace stretch with buster on both lines, then run apt update and apt dist-upgrade.

  • Wait, are you on Raspbian Jessie? First start from a new Stretch image, then upgrade to Buster. – ben_nuttall Mar 14 at 13:05
1

You should switch to Ubuntu Mate for Raspberry Pi

I used the recommended version for ARMv7, though Raspi3 has actually a ARMv8 processor. Ubuntu has, compared to Raspbian, a newer version of Python3 as part of the system. I had to fiddle with the config file a little bit, offset and stuff. Make sure you have the right keyboard layout before changing the password after starting the first time. Then I upgraded the whole system first, inclusive dist-upgrade, which took some rounds. Then I had to install python3-pyqt5, and then Electrum worked. I ran it with 'run_electrum', I didn't try to install it.

If you stay with Raspbian, you'll need to compile PyQt on your own. Do not try to upgrade your whole system to Buster, it might fail completely and need a new install of the whole OS.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.