3

I have Anaconda with Python 3. I would like to install PyQt6. Through the Anaconda prompt and in the desired environment I tried:

pip install PyQt6

However, when I try:

from PyQt6.QtWidgets import QApplication, QLabel, QMainWindow

I get:

ModuleNotFoundError: No module named 'PyQt6.QtWidgets'; 'PyQt6' is not a package

I also checked through the Anaconda navigator, and it seems PyQt6 is installed. What is the issue?

enter image description here

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
MOON
  • 2,516
  • 4
  • 31
  • 49
  • Are you sure you are using the python provided by anaconda? Many times this type of error occurs when the OP has several python installed, it installs the X package in one of them but uses another python to launch the script – eyllanesc Apr 11 '21 at 21:00

3 Answers3

2

conda-forge packages currently do not have pyqt6 available.

5.12.3 is the latest.

Although pulling pyqt from Anaconda Navigator will give version 5.9.2 at this point in time.

I'd suggest checking conda forge in time: https://anaconda.org/conda-forge/pyqt/files

WillCo
  • 21
  • 5
1

I encountered the same problem. I created an env in the anaconda, and in the env installed spyder and pyq6. Then I run the code as you did in spyder in the env, then it worked.

user1582755
  • 213
  • 1
  • 2
  • 9
0

I've just checked and it seems, that conda-forge still doesn't have a PyQt6 package (or pyqt with a version higher than 5). However, it contains a relatively new PyQt5 version (version 5.15.7 at the moment; the latest available on PyPI is 5.15.9).

Csega
  • 159
  • 1
  • 9