Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ModuleNotFoundError: No module named 'PyQt5' #7252

Closed
1 of 10 tasks
kumarask opened this issue Jun 4, 2018 · 9 comments
Closed
1 of 10 tasks

ModuleNotFoundError: No module named 'PyQt5' #7252

kumarask opened this issue Jun 4, 2018 · 9 comments

Comments

@kumarask
Copy link

kumarask commented Jun 4, 2018

Issue Report Checklist

  • Searched the issues page for similar reports
  • Read the relevant sections of the Spyder Troubleshooting Guide and followed its advice
  • Reproduced the issue after updating with conda update spyder (or pip, if not using Anaconda)
  • Could not reproduce inside jupyter qtconsole (if console-related)
  • Tried basic troubleshooting (if a bug/error)
    • Restarted Spyder
    • Reset preferences with spyder --reset
    • Reinstalled the latest version of Anaconda
    • Tried the other applicable steps from the Troubleshooting Guide
  • Completed the Problem Description, Steps to Reproduce and Version sections below

Problem Description

ModuleNotFoundError: No module named 'PyQt5'
while import form command prompt

What steps reproduce the problem?

open command prompt in windows
cmd

  1. type python
  2. from PyQt import QtCore
  3. ModuleNotFoundError: No module named 'PyQt5' i got this error

What is the expected output? What do you see instead?

Paste Traceback/Error Below (if applicable)

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'PyQt5'

Versions

  • Spyder version:
  • Python version: python3.6
  • Qt version:
  • PyQt version: PyQt5
  • Operating System name/version: windows 10

Dependencies


@ccordoba12
Copy link
Member

Please run

pip install pyqt5

or

conda install pyqt=5

depending on how you installed Spyder

@CAM-Gerlach
Copy link
Member

Thanks for reporting. As the PLEASE READ statement at the top of the issue template clearly states, please complete the checklist before reporting. If you had searched the issue page, you would have noted a large number of similar reports posted, including a few from just a few days ago, with the exact same error detailing clearly how to resolve it in multiple fashions. Additionally, many of the other troubleshooting steps specified in the checklist, which were not indicated as complete, would also resolve it. Therefore, please do all of that and, if it is still not fixed, provide the requested information before re-opening. Thanks, and best of luck!

@kumarask
Copy link
Author

kumarask commented Jul 3, 2018

Thanks!.. It's working now.

@Chinna111
Copy link

Chinna111 commented Mar 28, 2019

I got a solution for that.
Check your python directory correctly installed or Not.
Go to the below a directory by cmd and run the commands.

C:\Users\Chinna\AppData\Local\Programs\Python\Python37-32\Scripts>
pip install PyQt5

Copy your program in the same directory.
your .py program now ready to run successfully.

DEVELOPER EDIT: Do NOT do this, at least if on an Anaconda install. This is not the correct approach and will break Spyder if it is otherwise installed correctly.

@CAM-Gerlach
Copy link
Member

@Chinna111 Thanks for trying to help, but this is a closed, duplicate, resolved issue. Furthermore,

pip install PyQt5

Is NOT the correct approach, at least for the majority of our users on Anaconda installs, and in fact will completely break Spyder if it is installed correctly. Instead, you should follow our troubleshooting guide, which should resolve this, or try conda install --force-reinstall pyqt qt qtpy.

Go to the below a directory by cmd and run the commands.

Copy your program in the same directory.

Neither of these are necessary, as pip doesn't care what directory you're in, only what virtual environment.

@JungChoungGyoon
Copy link

감사합니다 Visual studio code에서 오류가 생겨 끙끙대었는데
가상환경에서 설치안된 모듈때문에 문제가 있었다는것을 이제 알았습니다.
없는 모듈을 pip install <모듈>로 설치하니 잘 작동 합니다

@CAM-Gerlach
Copy link
Member

@JungChoungGyoon Google Translate did a pretty good job with your message. However, this is the repository for the Spyder IDE, which has not relation whatsoever to Visual Studio Code, and as you can see in my comment directly above yours I warn extremely strongly against using pip to install anything Spyder-related due to the high chance of completely breaking your install. Thanks.

@devfahadmunir

This comment has been minimized.

@CAM-Gerlach
Copy link
Member

@fahadmunir3326 Sorry, but please read the thread before posting potentially dangerous advice. As I replied a couple comments above to someone suggesting the same thing (emphasis original):

Thanks for trying to help, but this is a closed, duplicate, resolved issue. Furthermore,

pip install PyQt5

Is NOT the correct approach, at least for the majority of our users on Anaconda installs, and in fact will completely break Spyder if it is installed correctly. Instead, you should follow our troubleshooting guide, which should resolve this, or try conda install --force-reinstall pyqt qt qtpy.

In addition, since this was posted we now offer and recommend our standalone installers that include the correct version of PyQt build right in, and will not break if you install/update packages in your working environment, so this problem can no longer occur at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants