You are not logged in.
(venv) [tech@archlinux Linux-PredatorSense]$ python3 -m pip install PyQt5
Requirement already satisfied: PyQt5 in ./venv/lib/python3.13/site-packages (5.15.11)
Requirement already satisfied: PyQt5-sip<13,>=12.15 in ./venv/lib/python3.13/site-packages (from PyQt5) (12.17.0)
Requirement already satisfied: PyQt5-Qt5<5.16.0,>=5.15.2 in ./venv/lib/python3.13/site-packages (from PyQt5) (5.15.17)
(venv) [tech@archlinux Linux-PredatorSense]$ sudo python3 -m main.py
Traceback (most recent call last):
File "<frozen runpy>", line 189, in _run_module_as_main
File "<frozen runpy>", line 112, in _get_module_details
File "/home/tech/Apps/Linux-PredatorSense/main.py", line 3, in <module>
from PyQt5 import QtWidgets, QtGui
ModuleNotFoundError: No module named 'PyQt5'
I'm trying to install python packages in a virtual environment. Nothing I've tried is working.
Offline
Likely sudo is configured to not preserve user's environment, so it executes python3 in root's environent, not in your venv.
Offline
I've tried installing system wide by using both
--break-system-packages
and
pipx
Offline
Did you try "python3 -m main.py" rather than "sudo python3 -m main.py"?
For system-wide PyQt5 install it with "pacman -S python-pyqt5".
Offline
"python3 -m main.py" didn't work. I thought I tried pacman already but did it again just in case and it worked. I probably did it before with caps. Now it says it needs module called "PyQt5.QtChart". Don't know how to get that now.
Offline
Seems there're no python bindings for https://archlinux.org/packages/extra/x86_64/qt5-charts/ in the repos
What are you trying to run there? Is there no Qt6 variant? How does it "not work" when not being run as sudo?
Since it apparently depends on full-blown GUI Qt, running that as root is a horrible idea tbw.
Online
python3 -m pip install PyQt5
Why are you doing that? Qt5, PyQt5 has been in the repo for years.
I'm not up to date.
python
Python 3.13.5 (main, Jun 21 2025, 09:35:00) [GCC 15.1.1 20250425] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from PyQt5 import QtWidgets, QtGui
>>> help(QtGui)
Help on module PyQt5.QtGui in PyQt5:
NAME
PyQt5.QtGui
CLASSES
PyQt5.QtCore.QAbstractItemModel(PyQt5.QtCore.QObject)
QStandardItemModel
PyQt5.QtCore.QCoreApplication(PyQt5.QtCore.QObject)
QGuiApplication
PyQt5.QtCore.QEvent(sip.wrapper)
...
Offline