I get the following error
ImportError: cannot import name ‘QtCore’ from ‘PyQt5’ (/usr/lib/python3/dist-packages/PyQt5/init.py)
which makes me think that the module is not installed.
When I try to install it I get:
pip3 install PyQt5
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: PyQt5 in /usr/lib/python3/dist-packages (5.14.1)
I also tried the following and got
sudo pip3 install PyQt5
Requirement already satisfied: PyQt5 in /usr/lib/python3/dist-packages (5.14.1)
WARNING: Running pip as the ‘root’ user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
WARNING: There was an error checking the latest version of pip.
Any idea?
I am running python3.10 on Ubuntu
3
Answers
did you try to launch your program with
python3 program.py
orpython program.py
depending on the one you already use ?Also try to run a
pip3 list
to see if the module is installed.You can try to install with
python3 -m pip install PyQT5
or justpython -m pip install PyQT5
you can try reinstalling
however I recommend using a virtual environment (e.g. using venv module) to install the modules and use them:
then install required modules in your project’s virtual environment
It seems that you need to install/upgrade
matplotlib
.source: ImportError: cannot import name 'QtCore'