Run a Python Qt application on Ubuntu 20.04
-
wrote on 27 May 2020, 14:54 last edited by PythonQTMarlem
Thanks for the answer. I want to use PyQt5. I have already installed PyCharm. when I call in the terminal:
sudo apt-get install python3-pyqt5 the message "python3-pyqt5 is already the latest version (5.14.1 + dfsg-3build1)".
If I want to do this in the terminal:
/ home / markus / PycharmProjects / PythonTest / venv / bin / python /home/markus/PycharmProjects/PythonTest/Ubuntu.py
comes the error message: raceback (most recent call last):
File "/home/markus/PycharmProjects/PythonTest/Ubuntu.py", line 2, in <module>
from qtpy import QtWidgets
ModuleNotFoundError: No module named 'qtpy'Question: What am I doing wrong?
-
Thanks for the answer. I want to use PyQt5. I have already installed PyCharm. when I call in the terminal:
sudo apt-get install python3-pyqt5 the message "python3-pyqt5 is already the latest version (5.14.1 + dfsg-3build1)".
If I want to do this in the terminal:
/ home / markus / PycharmProjects / PythonTest / venv / bin / python /home/markus/PycharmProjects/PythonTest/Ubuntu.py
comes the error message: raceback (most recent call last):
File "/home/markus/PycharmProjects/PythonTest/Ubuntu.py", line 2, in <module>
from qtpy import QtWidgets
ModuleNotFoundError: No module named 'qtpy'Question: What am I doing wrong?
wrote on 27 May 2020, 15:47 last edited by JonB@PythonQTMarlem said in Run a Python Qt application on Ubuntu 20.04:
from qtpy import QtWidgets
I have never heard of
from qtpy
anything, so where do you get that from/why do you expect it to generate anythong other thanModuleNotFoundError: No module named 'qtpy'
?
Furthermore, although the spacing of your command line seems incorrect, you seem to be running
python
as the name of the executable? I don't know about yourvenv/bin/python
, but did you take the trouble to read what I wrote earlier about this to verify that's correct?Finally, if you are using Python virtual environments, you're on your own for checking the docs about whatever you need to get that working correctly.
-
@PythonQTMarlem said in Run a Python Qt application on Ubuntu 20.04:
from qtpy import QtWidgets
I have never heard of
from qtpy
anything, so where do you get that from/why do you expect it to generate anythong other thanModuleNotFoundError: No module named 'qtpy'
?
Furthermore, although the spacing of your command line seems incorrect, you seem to be running
python
as the name of the executable? I don't know about yourvenv/bin/python
, but did you take the trouble to read what I wrote earlier about this to verify that's correct?Finally, if you are using Python virtual environments, you're on your own for checking the docs about whatever you need to get that working correctly.
wrote on 27 May 2020, 16:05 last edited by PythonQTMarlem@JonB said in [Run a Python Qt application on Ubuntu 20 \ .04] (/ post / 597283):
@PythonQTMarlem said in [Run a Python Qt application on Ubuntu 20 \ .04] (/ post / 597262):
from qtpy import QtWidgets
I saw it in a Youtube video.
probably comes from:
''
import os, sys
from PyQt5 import QtCore, QtWidgets
'' -
@JonB said in [Run a Python Qt application on Ubuntu 20 \ .04] (/ post / 597283):
@PythonQTMarlem said in [Run a Python Qt application on Ubuntu 20 \ .04] (/ post / 597262):
from qtpy import QtWidgets
I saw it in a Youtube video.
probably comes from:
''
import os, sys
from PyQt5 import QtCore, QtWidgets
''wrote on 27 May 2020, 16:17 last edited by@PythonQTMarlem
I don't understand. That saysfrom PyQt5 import QtWidgets
But you say your code has
from qtpy import QtWidgets
with error
ModuleNotFoundError: No module named 'qtpy'
So I'm still not understanding where you get to use
qtpy
from? -
wrote on 27 May 2020, 17:00 last edited by
@JonB said in Run a Python Qt application on Ubuntu 20.04:
PyQt5
how can I check if the installation of PyQt5 in Ubuntu was successful? -
@JonB said in Run a Python Qt application on Ubuntu 20.04:
PyQt5
how can I check if the installation of PyQt5 in Ubuntu was successful?wrote on 27 May 2020, 17:07 last edited by@PythonQTMarlem
You wrote earlier:sudo apt-get install python3-pyqt5 the message "python3-pyqt5 is already the latest version (5.14.1 + dfsg-3build1)".
-
@PythonQTMarlem
You wrote earlier:sudo apt-get install python3-pyqt5 the message "python3-pyqt5 is already the latest version (5.14.1 + dfsg-3build1)".
@JonB AFAIK, qtpy is one of the Python wrappers that allows to use either version of PySide2 or PyQt5 with the same code base.
-
@JonB AFAIK, qtpy is one of the Python wrappers that allows to use either version of PySide2 or PyQt5 with the same code base.
wrote on 27 May 2020, 17:16 last edited by JonB@SGaist said in Run a Python Qt application on Ubuntu 20.04:
@JonB AFAIK, qtpy is one of the Python wrappers that allows to use either version of PySide2 or PyQt5 with the same code base.
Ohhhhh! :)
Well in that case it's not doing a very good job if the OP reports:
comes the error message: raceback (most recent call last): File "/home/markus/PycharmProjects/PythonTest/Ubuntu.py", line 2, in <module> from qtpy import QtWidgets ModuleNotFoundError: No module named 'qtpy'
:) It's not the
QtWidgets
that's at issue, it's theqtpy
. So doesn't he have to install something forqtpy
, presumably? Perhaps to do with where the OP is looking, or I've even suggested he might be executing Python 2.... -
The wrapper has to be installed like any other Python module.
-
Thanks for the answer. I want to use PyQt5. I have already installed PyCharm. when I call in the terminal:
sudo apt-get install python3-pyqt5 the message "python3-pyqt5 is already the latest version (5.14.1 + dfsg-3build1)".
If I want to do this in the terminal:
/ home / markus / PycharmProjects / PythonTest / venv / bin / python /home/markus/PycharmProjects/PythonTest/Ubuntu.py
comes the error message: raceback (most recent call last):
File "/home/markus/PycharmProjects/PythonTest/Ubuntu.py", line 2, in <module>
from qtpy import QtWidgets
ModuleNotFoundError: No module named 'qtpy'Question: What am I doing wrong?
@PythonQTMarlem said in Run a Python Qt application on Ubuntu 20.04:
/ home / markus / PycharmProjects / PythonTest / venv / bin / python
Try with python3 instead with python as python on Ubuntu means Python 2, but you installed for Python 3. @JonB already mentioned that, but it seems you ignored that?
12/12