Module not found PyQt6
-
I am using Python 3.10 and have installed PyQt6 using "pip install PyQt6" on Linux Mint 22.
It has been installed in /usr/local/lib/python3.10/dist-packages/PyQt6/bindings/QtWidgets/ for example.
Various Internet pages say it should be installed in "site-packages". That is not true for me.
When I use the following:
from PyQt6.QtWidgets import (QApplication, QWidget, QVBoxLayout, QPushButton, QTextEdit, QTreeWidget, QTreeWidgetItem, QScrollArea) from PyQt6.QtCore import Qt
I receive the following error: "ModuleNotFoundError: No module named 'PyQt6'"
How do I get the module to load?
Is there an ENV variable I need to set?
-
Hi,
Are you sure you started the correct version of Python ?
The installation is clearly 3.10 but if you start a 3.12 interpreter then it won't work.The best way to develop a project in Python is to use virtual environments.
-
Then explicitly call the version of Python you want to use when executing your script.
As for conda VS venv, it highly depends on your goal.
You might also want to consider using something like uv that will help you manage your dependencies and environnement.Since you are starting fresh, I would recommend testing uv.