I have been developing a Qt5 based application that so far runs on Windows / MacOS / Linux Mint but I am now stuck trying to get PyQt5 module installed on a FriendlyELEC NanoPi Fire3 (Rasberry Pi clone). My Linux skills are modest - able to fluidly move around, deal with permissions, users, samba, editing text files, etc, etc. Far from expert though. Setting this up in Mint was effortless.
After a crash and burn on Stack Overflow.....I thought this group may have some more constructive insight.
The Linux distro id lubuntu as distributed from Friendly. Python 3.5.2.
I have installed Qt5, and the module loads in Python, but none of the PyQt5 modules are available
apt-get install python3-qt5
When trying to install PyQt5 wheel, it fails. Perhaps I need to manually install it somehow? I downloaded the PyQt5 source as a TAR, but not sure how to build it into anything useful.
pip3 install PyQt5
results:
root@FriendlyELEC:/etc/samba# pip3 install PyQt5
Collecting PyQt5
Downloading PyQt5-5.14.1.tar.gz (3.2 MB)
|################################| 3.2 MB 29 kB/s
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 /usr/local/lib/python3.5/dist-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmp6mm9iz7i
cwd: /tmp/pip-install-q4uoq45z/PyQt5
Complete output (35 lines):
Querying qmake about your Qt installation...
/usr/bin/qmake -query
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/pip/_vendor/pep517/_in_process.py", line 103, in prepare_metadata_for_build_wheel
hook = backend.prepare_metadata_for_build_wheel
AttributeError: module 'sipbuild.api' has no attribute 'prepare_metadata_for_build_wheel'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/pip/_vendor/pep517/_in_process.py", line 257, in <module>
main()
File "/usr/local/lib/python3.5/dist-packages/pip/_vendor/pep517/_in_process.py", line 240, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/usr/local/lib/python3.5/dist-packages/pip/_vendor/pep517/_in_process.py", line 108, in prepare_metadata_for_build_wheel
config_settings)
File "/usr/local/lib/python3.5/dist-packages/pip/_vendor/pep517/_in_process.py", line 136, in _get_wheel_metadata_from_wheel
whl_basename = backend.build_wheel(metadata_directory, config_settings)
File "/tmp/pip-build-env-c26iqq62/overlay/lib/python3.5/site-packages/sipbuild/api.py", line 51, in build_wheel
project = AbstractProject.bootstrap('pep517')
File "/tmp/pip-build-env-c26iqq62/overlay/lib/python3.5/site-packages/sipbuild/abstract_project.py", line 82, in bootstrap
project.setup(pyproject, tool, tool_description)
File "/tmp/pip-build-env-c26iqq62/overlay/lib/python3.5/site-packages/sipbuild/project.py", line 387, in setup
self.apply_user_defaults(tool)
File "project.py", line 62, in apply_user_defaults
super().apply_user_defaults(tool)
File "/tmp/pip-build-env-c26iqq62/overlay/lib/python3.5/site-packages/pyqtbuild/project.py", line 86, in apply_user_defaults
super().apply_user_defaults(tool)
File "/tmp/pip-build-env-c26iqq62/overlay/lib/python3.5/site-packages/sipbuild/project.py", line 202, in apply_user_defaults
self.builder.apply_user_defaults(tool)
File "/tmp/pip-build-env-c26iqq62/overlay/lib/python3.5/site-packages/pyqtbuild/builder.py", line 76, in apply_user_defaults
self._get_qt_configuration()
File "/tmp/pip-build-env-c26iqq62/overlay/lib/python3.5/site-packages/pyqtbuild/builder.py", line 463, in _get_qt_configuration
"v{0}".format(self.qt_version_str))
sipbuild.exceptions.UserException
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 /usr/local/lib/python3.5/dist-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmp6mm9iz7i Check the logs for full command output.
I'd also suggest
sudo apt install build-essential
I am going to deviate from the above recommendation of using synaptic / the system package manager for everything. I do use the system packages for some things, but in general, have found that for python, using project-specific virtual environments works better. It allows you to manage dependency versions well, and it also makes it easier to deploy the final code to other machines.
So something like:
cd project_dir
# setup a virtual environment in the venv directory
python3 -m venv venv
# use the virtual environment
source venv/bin/activate
and then the actual stuff. You can verify that you are using the virtual environment versions by something like
type python
type pip
and it should confirm that the ones in the virtual environment are being used.
I am curious.....where should I have been looking for that information if you were not available to deliver the answer on a silver platter? I spent most of yesterday looking for a way to get PyQt5 installed on this Pi clone. Is this as obscure as I think it is, or am I just not looking in the right places?
Not sure what you were looking for? When I Google "python qt5 ubuntu", the first two hits are
https://gist.github.com/ujjwal96/1dcd57542bdaf3c9d1b0dd526ccd44ff and
https://stackoverflow.com/questions/36757752/how-to-install-pyqt5-in-python-3-ubuntu-14-04.
Both explain that you want to
sudo apt-get install python3-pyqt5
Neither mentions the qtwebkit etc. packages which Nominal Animal clued us in on, but these probably weren't your primary stumbling block?
I am curious.....where should I have been looking for that information if you were not available to deliver the answer on a silver platter? I spent most of yesterday looking for a way to get PyQt5 installed on this Pi clone. Is this as obscure as I think it is, or am I just not looking in the right places?
Not sure what you were looking for? When I Google "python qt5 ubuntu", the first two hits are
https://gist.github.com/ujjwal96/1dcd57542bdaf3c9d1b0dd526ccd44ff and
https://stackoverflow.com/questions/36757752/how-to-install-pyqt5-in-python-3-ubuntu-14-04.
Both explain that you want to
sudo apt-get install python3-pyqt5
Neither mentions the qtwebkit etc. packages which Nominal Animal clued us in on, but these probably weren't your primary stumbling block?
The answer is always easier to find when you Google the right answer :-DD
I have already let many of the battle details fall out of my brain, but what I remember is that first I was trying to get it installed an a headless distro that was provided by Friendly. Not sure what the details are, but I was searching and experimenting with that distro and everything I could find at the time simply suggested:
sudo apt-get install PyQt-5
which never worked. I never recall seeing anything suggesting:
sudo apt-get install Python3-Qt5
and definitely did not know of any dependencies like what @Nominal Animal suggested.
apt install python3-pyqt5 python3-pyqt5.{qtsvg,qtwebkit,qtopengl}
Since Linux is still quite new to me....troubleshooting installation issues is not yet part of my skillset. I found various bits and pieces of advice from a number of sources - all of which was leading me down the wrong path. Getting further from the solution. One of my friends that has developed on these FriendlyElec Pi's told me he just compiled from source Qt, all the dependencies, etc, etc.....I was not ready for yet another learning curve so I did not try that.
One of the turning points, was when I realized that I don't believe PyQt5 works outside of a GUI. That is when I switched to lubuntu where it does work just fine.
Either way - I had no idea what to look for. After this, I have spent a lot more time studying Linux and starting to feel more comfortable dealing with troubleshooting. Still a beginner (perhaps now I am an advanced beginner).