Modulenotfounderror no module named pyqt5 mac os

PyQt5: ModuleNotFoundError: No module named ‘PyQt5’

I have installed Python 3.7.1 and trying to run a form created using QTdesigner.But this error occurred.I have also installed PyQt5 module using

7 Answers 7

Python and pip seem to be running on different versions.

If you’re using various versions of Python, use python -m pip install PyQt5 instead of pip .

Try this : Check your python directory correctly installed or Not. Go to the below a directory by cmd and run the commands.

your PRO.py program now ready to run successfully.

It seems like your pycharm is configured to use virtual environment. Try installing PyQt5 from pycharm terminal. It will install PyQt5 in your virtual environment and it fixed the issue in my case.

You can use pip3 to install a python3 module:

I had a similar error when starting with PyQT5. Do not know if this might answer your question but here was my scenario. I had both python 2.7 and python 3.7 on my machine. My pip 2.7 was added to the path instead of the 3.7. So i removed python 2.7 from the path, reinstalled python 3.7 and added to the path and restarted. After that used pip to install pyqt5 and it worked like a charm

i solved it by using python -m pip install PyQt5 on windows not pip install PyQt5

Источник

ImportError: No module named PytQt5

following are my python, qt and sip versions

I tried to import the PyQt5 by following by this

I got the following error

ImportError: No module named PyQt5.QtWidgets

How can I solve this error.

When I tried to PyQt4, I got following error.

from PyQt4.QtCore import pyqtSlot as Slot RuntimeError: the sip module implements API v10.0 to v10.1 but the PyQt4.QtCore module requires API v8.1

2) extract sip-4.15.3.tar.gz

3) copy sip-4.15.3 to /home/thura

4) type «cd /home/thura/sip-4.15.3»

5) type «python configure.py», press enter, follow the instructions (type yes and press enter)

6) type «make», press enter and type «make install», press enter

7) download PyQt-gpl-5.1.1.tar.gz from here

8) extract PyQt-gpl-5.1.1.tar.gz

9) copy PyQt-gpl-5.1.1 folder to /home/thura folder.

Читайте также:  Usb rip astra linux

10) type «cd /home/thura/PyQt-gpl-5.1.1»

11) type «python configure.py», press enter, following the instructions (type yes and press enter)

12)type «make», press enter and type «make install», press enter

After redo it again. I got the following error

7 Answers 7

If you are on ubuntu, just install pyqt5 with apt-get command:

However, on Ubuntu 14.04 the python-pyqt5 package is left out [source] and need to be installed manually [source]

pip install pyqt5 for python3 for ubuntu

this can be solved under MacOS X by installing pyqt with brew

After getting the help from @Blender, @ekhumoro and @Dan, I understand the Linux and Python more than before. Thank you. I got the an idea by @ekhumoro, it is I didn’t install PyQt5 correctly. So I delete PyQt5 folder and download again. And redo everything from very start.

After redoing, I got the error as my last update at my question. So, when I search at stack, I got the following solution from here

And then, I did «sudo make» and «sudo make install» step by step. After «sudo make install», I got the following error. But I ignored it and I created a simple design with qt designer. And I converted it into python file by pyuic5. Everything are going well.

Источник

pyuic5 — ModuleNotFoundError: No module named PyQt5.sip

I have just installed Anaconda 5.2 with Python 3.6 on my windows system. Also installed pyqt5 and pyqt5-tools via pip with administrator privilege. Now when I run pyuic5.exe for converting ui files it shows following error:

I have tried installing PyQt5-sip package using pip. Buts its already installed in my system.

Why this problem is occurring? How can I solve this problem?

5 Answers 5

According to Agile_Eagle’s suggestion from the comments I just uninstalled pyqt5 and pyqt5-tools packages and the reinstalled them. Problem solved!

PS.: If you still got problems with PyQt, try uninstalling all of the PyQt related libraries:

Then install them again, this will fix:

PPS.:If you got problems uninstalling the libraries, go to your Python folder, like C:\Users\ \AppData\Local\Programs\Python\Python

\Lib\site-packages and manually delete the PyQt folders, then uninstall everything and install again (Make sure you have the latest Python version and upgraded your pip too)

As of June 2019, pyqt5-tools no longer exists. The solution I found was first installing pyqt5-sip and then install pyqt5

Читайте также:  Как удалить recycle bin windows 10

This seems to get rid of the following error: ModuleNotFoundError: No module named ‘PyQt5.sip’

None of the answers above worked for PyQt5 5.13.0 on conda’s python 3.6.

With pyqt5 and pyqt5-sip installed just go into python’s site-packages and copy sip.so from the PyQt5_sip package to PyQt5 folder (or make a symlink) where the rest of Qt’s so modules are.

Seems like a poor decision to pull sip out into a separate package.

I am a Mac user and I had faced a similar issue. However, I understand for window users, what you are looking for is pyuic5.bat and not pyuic5.sip It seems you’ll simply have to provide the full path of the pyuic file(for me, it was under a hidden folder usr in the home directory: /usr/local/Cellar/pyqt/5.10.1_1/bin/pyuic5 ) and do make sure on your terminal(for you, cmd) you have the directory changed to where the *.ui file lies which you wish to convert to a *.py file.

Источник

Error: No module named ‘PyQt5.QtMultimedia’

I am trying to build a GUI integrating videos, and for this I need to import PyQt5.QtMultimedia. Yet when trying to import the module (import PyQt5.QtMultimedia) I receive an error: ModuleNotFoundError: No module named ‘PyQt5.QtMultimedia’.

I am working on Ubuntu 18.04, and my Python packages come from Anaconda. The «conda list» command reports that pyqt is installed properly, version 5.9.2. All the other PyQt5 imports have worked fine so far, it is really only PyQt5.QtMultimedia that causes issues.

This problem is already discussed in these posts: link1, link2, but they do not provide any solution.

I have tried uninstalling (sudo apt-get remove python3-pyqt5.qtmultimedia) and re-installing (sudo apt install python3-pyqt5.qtmultimedia), without success.

Could someone help? My project is really stuck if I can’t fix this issue.

2 Answers 2

So, I managed to solve the problem. Kind of, using brute strength.

There is basically no possible workaround with conda as:

  • conda installs its own version of PyQt5 called pyqt, which includes most (but not all) features of PyQt5, version 5.9.2. This version in particular does not have QtMultimedia, hence the error.
  • you can’t pip install (or regular install) PyQt5 on top of your conda Python. Here it seems to create conflicts and make your whole PyQt setting buggy. To be avoided.

So, the only solution left is not to use Python with conda. I uninstalled conda (certainly not necessary, one may just use base python if installed), and went back to base python. Unfortunately, that also means the packages provided by conda are not available anymore. Still, I managed to install PyQt5 properly, and I can now use QtMultimedia normally.

Читайте также:  Windows extract all command line

cons: fix is extreme as it implies giving up using conda altogether

Источник

No module named PyQt5.sip

After upgrading to python-pyqt5 5.12-2 I get this error when I try to import from QtWidgets

Any idea on how can I solve this issue?

6 Answers 6

In geoptics this fix works on old and new versions:

Try uninstalling and re-installing all PyQt related libraries:

Then install them again, this will fix:

PPS.:If you got problems uninstalling the libraries, go to your Python folder, like C:\Users\ \AppData\Local\Programs\Python\Python

\Lib\site-packages and manually delete the PyQt folders, them uninstall everything and install again (Make sure you have the latest Python version and upgraded your pip too)

If you’re building sip and PyQt5 from source using make files, make sure to check PyQt5 install docs. In particular,

When building PyQt5 v5.11 or later you must configure SIP to create a private copy of the sip module using a command line similar to the following:

python configure.py —sip-module PyQt5.sip

If you already have SIP installed and you just want to build and install the private copy of the module then add the —no-tools option.

You should add PyQt5.sip to hidden imports; that should solve the issue.

I repaired this problem

This problem occurred when upgrading pyqt5 version 5.15.0

There was no problem when I reverted to the previous version.

I have python -V: 3.7.4

PYQT5 5.14.1 and PYSIDE 5.14.1 works fine

In addition to the answer provided by Tadeu (https://stackoverflow.com/a/58880976/12455023) I would also suggest checking version of your libraries to make sure that they match.

This will help you to make sure that no earlier installation is conflicting with your current installation.

In place of library_name use PyQt5 , PyQt5-sip , PyQtWebEngine . If any of them is present in the system, then use pip uninstall
== to remove that library.

Once you made sure that no other versions of these libraries are there, then you can reinstall the preferred version of that library.

Источник

Оцените статью