Installing PySide 2 for Ubuntu 18.04
-
wrote on 15 Aug 2019, 14:05 last edited by JonB
I presently have a working system:
- Ubuntu 18.04 LTS
- Python 3.6.8 (released with Ubuntu 18.04)
- Qt 5.9.5 (released with Ubuntu 18.04 via
apt-get
) - PyQt 5.10.1 (don't recall whether
apt-get
or direct download)
I should like to play around with PySide 2 now :)
Reading https://wiki.qt.io/Qt_for_Python/GettingStarted, I note:
Platform Requirements
Qt: 5.12 is recommended, but there are Technical Preview wheels for 5.11Questions:
-
Will I indeed need to move to Qt 5.11/12 to get anywhere? Am I whistling in the wind hoping PySide 2 would work with my current Qt?
-
I definitely do not wish to compile anything, neither Qt nor PySide2.
-
I do not believe in Virtual Environments.
-
Is there any successful
apt-get install python3-pyside2
stuff? -
Do I have to do PySide2 via
pip3
? I triedpip3
installing of stuff in the past (Qt? PyQt?). Despite all the documentation/examples showing what to do this way and saying it would be fine, it ended up simply not working/crashing/missing stuff, because it did not know/deal with its dependencies correctly (SSL library stuff among others, I think), and at that point I gave up on it since it simply did not live up to its promises (have never had any problem withapt-get
approach getting things right). But I'll (have to) try again withpip3
if that's the way to go. -
I f I do succeed in doing this all, will it interfere with the working Qt + PyQt system I currently have? I had thought the PySide 2 would be quite separate from the PyQt 5, but I saw somewhere (can't find it now) some post implying you had to keep them apart or something in PySide 2 would overwrite/interfere with something in PyQt.
Anyone with any experience of this? What steps did you follow to get your PySide 2 all working under Linux, please?
-
wrote on 13 Nov 2019, 09:28 last edited by JonB
The long and the short was this is a PyCharm issue (as discovered by my raising a query there). In order to correctly run a project under Debug using either PyQt5 or PySide2, especially if you have both installed, in PyCharm you need to:
File > Settings... > Build, Execution, Deployment > Python Debugger > PyQt compatible, change value from Auto to one of PyQt5 or PySide2 explicitly. -
wrote on 28 Aug 2019, 11:22 last edited by
-
I presently have a working system:
- Ubuntu 18.04 LTS
- Python 3.6.8 (released with Ubuntu 18.04)
- Qt 5.9.5 (released with Ubuntu 18.04 via
apt-get
) - PyQt 5.10.1 (don't recall whether
apt-get
or direct download)
I should like to play around with PySide 2 now :)
Reading https://wiki.qt.io/Qt_for_Python/GettingStarted, I note:
Platform Requirements
Qt: 5.12 is recommended, but there are Technical Preview wheels for 5.11Questions:
-
Will I indeed need to move to Qt 5.11/12 to get anywhere? Am I whistling in the wind hoping PySide 2 would work with my current Qt?
-
I definitely do not wish to compile anything, neither Qt nor PySide2.
-
I do not believe in Virtual Environments.
-
Is there any successful
apt-get install python3-pyside2
stuff? -
Do I have to do PySide2 via
pip3
? I triedpip3
installing of stuff in the past (Qt? PyQt?). Despite all the documentation/examples showing what to do this way and saying it would be fine, it ended up simply not working/crashing/missing stuff, because it did not know/deal with its dependencies correctly (SSL library stuff among others, I think), and at that point I gave up on it since it simply did not live up to its promises (have never had any problem withapt-get
approach getting things right). But I'll (have to) try again withpip3
if that's the way to go. -
I f I do succeed in doing this all, will it interfere with the working Qt + PyQt system I currently have? I had thought the PySide 2 would be quite separate from the PyQt 5, but I saw somewhere (can't find it now) some post implying you had to keep them apart or something in PySide 2 would overwrite/interfere with something in PyQt.
Anyone with any experience of this? What steps did you follow to get your PySide 2 all working under Linux, please?
-
wrote on 11 Sept 2019, 08:37 last edited by
@gf-gepi
Yes, in the end I did have to do it viapip3
.That in itself worked. However, unfortunately it has left me stuck whereby once I have PySide2 installed existing PyQt5 projects which I have can no longer be run under the debugger because of it finding some PySide2 stuff even though the projects do not use PySide2 at all. For my use case, that makes it so I cannot afford to install PySide2 at all for other projects :( I have posted about this to https://bugreports.qt.io/browse/PYSIDE-1080 in the QT BUG forum for PySide2, but nobody has replied about it, so I'm completely stuck at present... :( :( If anyone cares to read that and comment here or there that would be great!
-
wrote on 11 Sept 2019, 13:47 last edited by
@denni-0
You may be right about that, I don't know, I don't like these "virtual environments", so I have never created one.The problem I am reporting ("can't load
QMYSQL
") only occurs when I try to run inside the PyCharm debugger, not if I just run the apps outside. That confuses me, as it seems it's not the environment the program has which causes the problem, rather it's to do with environment/search paths being used by PyCharm debugger which is somehow (incorrectly) picking up (certain) files from the completely unrelated environment, and then complaining. Given this, I am quite unsure who needs the venv, maybe it's just the PyCharm environment, goodness knows. Sigh :( -
wrote on 13 Nov 2019, 09:28 last edited by JonB
The long and the short was this is a PyCharm issue (as discovered by my raising a query there). In order to correctly run a project under Debug using either PyQt5 or PySide2, especially if you have both installed, in PyCharm you need to:
File > Settings... > Build, Execution, Deployment > Python Debugger > PyQt compatible, change value from Auto to one of PyQt5 or PySide2 explicitly. -
Hi,
Just a side note, you might want to consider using virutalenv when dealing with your python projects. This would allow you to have a clean and controlled environment to work in without packages not relevant to your current projects/tests.
-
Hi,
Just a side note, you might want to consider using virutalenv when dealing with your python projects. This would allow you to have a clean and controlled environment to work in without packages not relevant to your current projects/tests.
wrote on 13 Nov 2019, 10:48 last edited by JonB@SGaist
Dear @SGaist ,
Now, it's amazing that you mention that just now, because of my pending https://forum.qt.io/topic/108755/could-not-load-the-qt-platform-plugin-xcb-in-even-though-it-was-found on exactly the "virtual environment" issue.....I have been pulling my hair out over that for 24 hours, and I have literally just discovered the cause (am about to post there). And guess what it turns out to be? Surprise, surprise, it's precisely because the virtual environment I have had to create (using scripts supplied which are supposed to be "robust") there does not work correctly.... :( :(
I have avoided venvs precisely because I do not trust them to get things right, and when they do not it is so difficult to debug and figure out just what is going on. Until now I have always done things system-wide, and have never had the problems venvs introduce.
So, although I have no choice but to use a venv for that new project, I am "surprised" that you & others find they are "good", they do not work robustly enough for me at least! Yes, I do realise they are a necessary evil, and produce other benefits. But (IMHO) they are not tested enough against installed systems other than what the authors "expect", and confirm my expectations that they can introduce more obscure errors than they solve.... Sigh!
-
I did not say it was a perfect solution, just one to consider. There's also conda, using docker, etc.
My suggestion was mainly so you could keep PySide2 and PyQt in two different environnements even though you should be able to have both at the same time. There are even several packages that provide a thin layer so you can keep a common import set and select the implementation to use on startup.
What kind of script are you using to set things up ?
-
I did not say it was a perfect solution, just one to consider. There's also conda, using docker, etc.
My suggestion was mainly so you could keep PySide2 and PyQt in two different environnements even though you should be able to have both at the same time. There are even several packages that provide a thin layer so you can keep a common import set and select the implementation to use on startup.
What kind of script are you using to set things up ?
wrote on 13 Nov 2019, 19:39 last edited by JonB@SGaist
It is actually conda that I am using now in another project. And it turns out somewhere it and my separate install of PySide2 are interfering. But that's all in the other thread.For there and here, my concern is wanting to be able to test situations end users might have. I might set up separate virtual environments, but a user may have Qt or PyQt or PySide2 installed system- or user-wide, and I want to test that.
As you say, I am learning that if you can keep all these things separate via virtual environments it may play better.
In both threads, the problem has actually come as result of PySide2 and the way it's installed.
For this thread the matter is closed, since it was known PyCharm issue. If you want your brain to ache or continue the discussion, have a look at https://forum.qt.io/topic/108755/could-not-load-the-qt-platform-plugin-xcb-in-even-though-it-was-found ;-)
-
Just read it. There's indeed something a bit fishy going on there. I'll continue on this other thread.