Open bgleonard opened 6 years ago
It's not possible to build pyqt5 as no source distribution is provided: there's nothing to build from. The maintainers (Riverbank) only provide wheels built for Windows, Mac and 64-bit Linux.
The recommended way to install pyqt on Raspberry Pi is with apt.
Feb 2020 Update: sdist now available
I’ve built it from source on the Pi.
Here is the riverbank software source download page: https://www.riverbankcomputing.com/software/pyqt/download5
On Aug 8, 2018, at 5:03 AM, Ben Nuttall notifications@github.com wrote:
It's not possible to build pyqt5 as no source distribution is provided: there's nothing to build from. The maintainers (Riverbank) only provide wheels built for Windows, Mac and 64-bit Linux.
The recommended way to install pyqt on Raspberry Pi is with apt.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
Do you have instructions to build from source on a Pi?
Sure! Here is how I built and installed PyQt5 5.10.1 for Python 3.5 on a 3B+ running Stretch.
sudo apt-get install qt-5default qtdeclarative5-dev qtlocation5-dev libqt5* qttools5-dev qtmultimedia5-dev qt5help qt5multimedia qttranslations5 qt5-make qtbase5-dev
<- updated the list of packages I believe are required to configure and build almost all pyqt modules
wget https://sourceforge.net/projects/pyqt/files/sip/sip-4.19.12/sip-4.19.12.tar.gz
wget https://sourceforge.net/projects/pyqt/files/PyQt5/PyQt-5.10.1/PyQt5_gpl-5.10.1.tar.gz
tar -xvf sip-4.19.12.tar.gz
tar -xvf PyQt5_gpl-5.10.1.tar.gz
cd sip-4.19.12
python3 configure.py --sip-module=PyQt5.sip
make -j5
sudo make install
cd ../PyQt5_gpl-5.10.1
python3 configure.py --qmake /usr/lib/arm-linux-gnueabihf/qt5/bin/qmake --sip-incdir /home/pi/sip-4.19.12/siplib
make -j5
sudo make install
FYI, Phil is working towards a proper source package for PyPI..
https://www.riverbankcomputing.com/pipermail/pyqt/2018-August/040704.html
I am (slowly) moving towards being able to have source packages on PyPI - but that would require you to have Qt already installed.
Update: PyQt5 sdist is available for the last two releases on PyPI.
We just need to know what the build dependencies are, and we'll try and build the wheels.
@altendky are there any docs on this?
@bennuttall, I haven't gotten into that yet. I would expect it would want 'Qt'. I'm not sure what else. Is there somewhere I could go to see the build errors and to try to address them? If not I can just try to do it locally on my rpi and come back with a list of what I have to install.
I'll be able to get the logs. What's the minimum python version supported in the latest version?
Looks like 3.5-3.8. Are the builds not public? I don't know anything yet about how contributions are handled or CI etc.
Looks like these are the instructions. I'll look around. https://www.riverbankcomputing.com/static/Docs/PyQt5/installation.html#building-and-installing-from-source
This is on my main PC (not rpi) which has presumably had some various stuff installed. Just doing this as a first pass. I'll try to follow up on my rpi, then maybe a fresh install on it as well. And woops, I ran install
rather than building a wheel... but, presumably similar requirements to address. This is taking awhile and so I'll share it as is in case you are digging in parallel. I'm going to reinstall my rpi and follow up there.
~/r/piwheels_pyqt5 master ●✚ venv/bin/pip install --no-binary pyqt5 pyqt5
Collecting pyqt5
Using cached PyQt5-5.14.1.tar.gz (3.2 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... error
ERROR: Command errored out with exit status 1:
command: /home/altendky/repos/piwheels_pyqt5/venv/bin/python3 /home/altendky/repos/piwheels_pyqt5/venv/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmpssyu2h6y
cwd: /tmp/pip-install-58up1ux1/pyqt5
Complete output (37 lines):
Querying qmake about your Qt installation...
/usr/bin/qmake -query
Traceback (most recent call last):
File "/home/altendky/repos/piwheels_pyqt5/venv/lib/python3.8/site-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 "/home/altendky/repos/piwheels_pyqt5/venv/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 257, in <module>
main()
File "/home/altendky/repos/piwheels_pyqt5/venv/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 240, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/home/altendky/repos/piwheels_pyqt5/venv/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 107, in prepare_metadata_for_build_wheel
return _get_wheel_metadata_from_wheel(backend, metadata_directory,
File "/home/altendky/repos/piwheels_pyqt5/venv/lib/python3.8/site-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-7f5uxwtr/overlay/lib/python3.8/site-packages/sipbuild/api.py", line 51, in build_wheel
project = AbstractProject.bootstrap('pep517')
File "/tmp/pip-build-env-7f5uxwtr/overlay/lib/python3.8/site-packages/sipbuild/abstract_project.py", line 82, in bootstrap
project.setup(pyproject, tool, tool_description)
File "/tmp/pip-build-env-7f5uxwtr/overlay/lib/python3.8/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-7f5uxwtr/overlay/lib/python3.8/site-packages/pyqtbuild/project.py", line 86, in apply_user_defaults
super().apply_user_defaults(tool)
File "/tmp/pip-build-env-7f5uxwtr/overlay/lib/python3.8/site-packages/sipbuild/project.py", line 202, in apply_user_defaults
self.builder.apply_user_defaults(tool)
File "/tmp/pip-build-env-7f5uxwtr/overlay/lib/python3.8/site-packages/pyqtbuild/builder.py", line 76, in apply_user_defaults
self._get_qt_configuration()
File "/tmp/pip-build-env-7f5uxwtr/overlay/lib/python3.8/site-packages/pyqtbuild/builder.py", line 431, in _get_qt_configuration
for line in project.read_command_pipe([self.qmake, '-query']):
File "/tmp/pip-build-env-7f5uxwtr/overlay/lib/python3.8/site-packages/sipbuild/project.py", line 350, in read_command_pipe
raise UserException("'{0}' failed returning {1}".format(cmd, rc))
sipbuild.exceptions.UserException
----------------------------------------
ERROR: Command errored out with exit status 1: /home/altendky/repos/piwheels_pyqt5/venv/bin/python3 /home/altendky/repos/piwheels_pyqt5/venv/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /tmp/tmpssyu2h6y Check the logs for full command output.
so
apt install qt5-default
then it at least starts running for a long time.
I suppose to capture the most dependencies I ought to be installing the Raspbian Buster Lite image?
Yes
Build log from cp37m here: https://bennuttall.com/files/pyqt.txt
Looks like 3.5-3.8. Are the builds not public? I don't know anything yet about how contributions are handled or CI etc.
Not currently. Builds are made on real Raspberry Pis in a Pi cloud service. The build logs get output into a database, and we can retrieve them from there when we need to.
2020-01-06T00:47:53 Querying qmake about your Qt installation... +
2020-01-06T00:47:53 /usr/bin/qmake -query +
2020-01-06T00:47:53 Traceback (most recent call last): +
2020-01-06T00:47:53 File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/pep517/_in_process.py", line 64, in prepare_metadata_for_build_wheel +
2020-01-06T00:47:53 hook = backend.prepare_metadata_for_build_wheel +
2020-01-06T00:47:53 AttributeError: module 'sipbuild.api' has no attribute 'prepare_metadata_for_build_wheel'
Looks like the same error as I had above. The build is expecting qmake
to have a default Qt chosen. Apparently apt
installing qt5-default
is one option. If you want another I can dig on it. After that it did build for me. Admittedly on my desktop with who knows what else it needed already installed, but that's what I've got for now. I grabbed the latest raspbian to try and wasn't getting any hdmi output and I haven't resolved that yet.
I did also work a bit on updating pyqt5-tools
to the new PyQt5 5.14+ build system last night so I'm getting some exposure there. If you build with sip-build
yourself rather than using pip
you get some more control. Though we may well not need that.
Great, thanks.
Can you do this process to see what dependencies it has? They're not strictly the same as build-deps but would at least shed some light.
When I get my rpi running... sure. :|
I haven't gotten back to fixing my rpi. I've been working through getting the build going for pyqt5-tools. Is there a new error to figure out?
Here is a preliminary procedure that while presumably quite wrong can hopefully be a useful step forward by providing some answers to the questions above and something to correct. I did not get my own Pi running but instead rented one from Mythic Beasts. While that leaves us without Raspbian Lite for the moment (rather regular Raspbian Buster), it does get us exactly the same environment as the real builds will occur in as far as I know.
(it's a .whl but GitHub doesn't accept that file type...) PyQt5-5.14.2-cp35.cp36.cp37.cp38-abi3-manylinux2014_armv7l.zip
Packages providing the missing .so
files:
I X-forwarded and ran below and saw an empty widget shown. Not much of a test but... it ran.
apt install --yes libqt5widgets5
venv/bin/python x.py
import PyQt5.QtWidgets
application = PyQt5.QtWidgets.QApplication([])
widget = PyQt5.QtWidgets.QWidget()
print('about to show')
widget.show()
print('about to exec')
application.exec()
I don't know what the build preferences are for piwheels. Probably don't want manylinux2014 since python3-pip
isn't new enough to handle it (even if I would personally almost always use a virtualenv or venv). I don't know if we generally build against new (maximum features) or old (maximum compatibility) system libraries. I haven't compared this wheel against the official PyQt5 wheels to make sure they contain the expected support.
Let me know what the next step is. Thanks.
@bennuttall, any chance you have time to guide me on the steps to take to get from my 'process' above to whatever files piwheels needs to do the builds?
(it's a .whl but GitHub doesn't accept that file type...) PyQt5-5.14.2-cp35.cp36.cp37.cp38-abi3-manylinux2014_armv7l.zip
Doesn't it have QML support ?
I have a PyQt5 5.15 wheel with qml and android support. it is 15mb. I had extracted it from "Pydroid" app from playstore (some russian dude built that wheel)
Here is the wheel :- (rename it from .zip to .whl) PyQt5-5.15.0-py3-none-any.zip
Adress of that russian guy :- (he doesn't reply emails so you might want to visit him if you want) https://maps.app.goo.gl/YKiHfiPe3wTYvrVK9
Package name: PyQt5 Issue type: Missing package Link to PyPI page: https://pypi.org/project/PyQt5 Link to piwheels page: https://www.piwheels.org/project/PyQt5 Version: all Python version: all