You are not logged in.

#1 2025-09-06 19:40:27

Tech_1207
Member
Registered: 2025-09-06
Posts: 3

Python packages not working even though they are installed

(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

#2 2025-09-06 20:22:31

dimich
Member
From: Kharkiv, Ukraine
Registered: 2009-11-03
Posts: 414

Re: Python packages not working even though they are installed

Likely sudo is configured to not preserve user's environment, so it executes python3 in root's environent, not in your venv.

Offline

#3 2025-09-06 20:26:25

Tech_1207
Member
Registered: 2025-09-06
Posts: 3

Re: Python packages not working even though they are installed

I've tried installing system wide by using both

--break-system-packages

and

pipx

Offline

#4 2025-09-06 20:49:08

dimich
Member
From: Kharkiv, Ukraine
Registered: 2009-11-03
Posts: 414

Re: Python packages not working even though they are installed

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

#5 2025-09-07 00:37:22

Tech_1207
Member
Registered: 2025-09-06
Posts: 3

Re: Python packages not working even though they are installed

"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

#6 2025-09-07 07:26:31

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 69,068

Re: Python packages not working even though they are installed

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.

Offline

#7 2025-09-14 14:49:45

teckk
Member
Registered: 2013-02-21
Posts: 542

Re: Python packages not working even though they are installed

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

Board footer

Powered by FluxBB