Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 5266

Troubleshooting • Re: Raspi5 fails to pip-install PyQt5 in a Python-Venv

$
0
0
Gents, thank you for the suggestions, but you are missing the main point.

My issue is not about creating a venv - this is almost a trivial task. And it is also not about apt versus pi use. Just as an aside: there is no apt in Windows! And my software has to run in Linux - including Raspi -, Mac, Windows, and in the same way.

The big issue is that Python is plagued by its huge success. And with no "benevolent dictator" at the top, the very large number of modules available to it was bound to create compatibility problems. Even in my medium sized project I am suffering from such compatibility issues. https://sourceforge.net/projects/geigerlog/

Using venv may not be a solution, but is at least a work-around. So, I am defining a set of modules which do work together, and load them into a venv. This does work on all systems I uses, for all software modules, EXCEPT for PyQt5 on a Raspi5!

And my question is about this specific failure!
You are also missing one point of mine.

If you have a version installable in the pi with apt, then you know that version works in the pi and you work with that version in your code.

Therefore for the pi, your install can make that apt install pyqt a prerequisite and then install everything python with a requirements.txt for the pi, with everything version.pinned. For other platforms you can provided their own requirements.txt too. If you can pip install pyqt there without apt, great, it gets done.

You probably have already ran into that type of situation with windows before, where there are no wheels files for windows and pip install will need to compile stuff from source. And in these cases having windows build tool installed is the prerequisite there.

Now what does suck is when you need a specific version of a package in one platform because there is a bug in a previous minor version that you use in another platform. While you can still use the multiple requirements file as described above, your code may end up having to do.one thing if it is running in one platform, but do it differently in another platform. Has not happen too many times to me before, but it does happen. This might happen with pyqt because the versions available via apt usually lags behinds, and sometimes lags behinds by a lot, because it takes time for things to be updated into the main repositores.

And I just thought of this. You can install via apt, but have you tried looking into if the maintainers of pyqt have their own apt repo that. You can add to the list of repos the OS uses? If they do, then it is possible they already have a much later version available for you to install, still via apt. It could help you avoid the lag behind issue above and possibly avoid cross compilation.

Though I'd you do end up having to cross complied, then you also have the choice of providing the wheels files yourself, and avoid apt and having those in your venv. Now you go back to "do I provide these for all platforms so they all get installed the same way, or do I end up with different installs just for the platforms that need it?"

Statistics: Posted by memjr — Sun Aug 11, 2024 2:47 pm



Viewing all articles
Browse latest Browse all 5266

Trending Articles