Python Forum
Anaconda 5.1 Python can't see PYQT5
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Anaconda 5.1 Python can't see PYQT5
#1
Hi

I'm trying to write my first Python GUI application and have installed Anaconda 5.1 (Mac OSX) which includes PYQT5 and Python 3.6.

I'm also using the included VS Code as an IDE

I'm trying to use the above import statements from the beginning of a tutorial I ‘m following.


import sys
from PyQt5.QtWidgets import QApplication, QWidget
but I'm getting an error stating
E0611:No name 'QApplication' in module 'PyQt5.QtWidgets'
E0611:No name 'QWidget' in module 'PyQt5.QtWidgets'

It looks like PYQT5 needs additional configuration to get working as I assume the errors relate to the complier not locating PYQT5. Does anyone know what I can do to clear these errors?

Thanks in advance
Reply
#2
Do you get this error from:
  • launch anaconda prompt
  • run:
    python
  • from PyQt5.QtWidgets import QApplication, QWidget
??
Reply
#3
Hi Larz60+

Just tried your suggestion and it worked fine, no errors running the commands within Terminal.
Does that mean its likely a VS Code setup issue?

Thanks for the help

Pete



(May-05-2018, 12:25 PM)Larz60+ Wrote: Do you get this error from:
  • launch anaconda prompt
  • run:
    python
  • from PyQt5.QtWidgets import QApplication, QWidget
??
Reply
#4
I can't be sure, I run vs code, but only once in a while for working on markdown.
How do you launch VS Code?
Reply
#5
Hi

It seems to be working now??, I started trying multiple versions on Python through VSCode and have returned to "Anaconda, Inc. Python 3.6.4 (base)" and the GUI example is loading now. I'm still seeing the errors though.

If it isn't too much trouble, would you mind trying the following code in your version of VSCode to see if you see the same?

import sys
from PyQt5.QtWidgets import QApplication, QWidget

if __name__ == '__main__':
    
    app = QApplication(sys.argv)

    w = QWidget()
    w.resize(250, 150)
    w.move(300, 300)
    w.setWindowTitle('Simple')
    w.show()
    
    sys.exit(app.exec_())
Below is what I see

[Image: 10z5pfs.png]

Thanks

Pete
Reply
#6
It complain about the same for me in Pylint.
Open Command Palette and type pylint
Set enable to off,Pylint check for a lot of stuff that's is not errors(Traceback).
It's way to noise to have on all the time,
i only turn it on when i have code that want to check for all kind stuff like Coding Standard PEP-8 ect.
Reply
#7
Thanks snippsat

I just turned it off, I'm only working on a personal project so not too worried about the coding standards.

Cheers for the help guys
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Question Python 3.10 and PyQt5(6) zazen000 2 7,629 Jun-14-2021, 05:02 PM
Last Post: deanhystad
  [PyQt] Control a combobox from another python file PyQt5 prath 0 2,245 May-05-2020, 03:22 PM
Last Post: prath
  Huge code problems (buttons(PyQt5),PyQt5 Threads, Windows etc) ZenWoR 0 2,785 Apr-06-2019, 11:15 PM
Last Post: ZenWoR
  Best Practice for making an .exe for PyQT5 w/ Anaconda? krypterro 0 2,642 Jul-05-2018, 03:18 PM
Last Post: krypterro
  [PyQt] how to install pyqt5 for python 3.5.2 64bit lemonred 2 21,242 Oct-28-2016, 03:25 PM
Last Post: lemonred

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020