# Import Error with PyQt5

**URL:** <https://discourse.psychopy.org/t/import-error-with-pyqt5/2675>\
**Category:** Other\
**Created:** [June 27, 2017, 9:59pm UTC](https://discourse.psychopy.org/t/import-error-with-pyqt5/2675 "2017-06-27T21:59:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dlevitas](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/dlevitas/32/1422_2.png) [@dlevitas](https://discourse.psychopy.org/u/dlevitas)\
**Post date:** [June 27, 2017, 9:59pm UTC](https://discourse.psychopy.org/t/import-error-with-pyqt5/2675/1 "2017-06-27T21:59:46Z")

</div>

Hello,

I recently upgraded Psychopy on my computer (Mac OS X version 10.6.8) to v1.85.2, however when I tried running one of my scripts I received the following error:

```auto
Traceback (most recent call last):
  File "/Users/dscnlab/Desktop/TRW_scan_comp/TRW_comp.py", line 18, in <module>
    from psychopy import locale_setup, visual, core, data, event, logging, sound, gui, microphone
  File "/Volumes/PsychoPy 1/PsychoPy2.app/Contents/Resources/lib/python2.7/psychopy/gui/ __init__.py", line 32, in <module>
    from .qtgui import *
  File "/Volumes/PsychoPy 1/PsychoPy2.app/Contents/Resources/lib/python2.7/psychopy/gui/qtgui.py", line 14, in <module>
    from PyQt5 import QtWidgets
ImportError: No module named PyQt5

```

I tried installing PyQt5 through the terminal with pip install pyqt5, but this didn’t work either. Is there a way I can either install PyQt5 such that Psychopy can import it, or is there a different workaround I should be using?

Thank you for your assistance.

---

<div class="post-metadata">

**Author:** ![dlevitas](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/dlevitas/32/1422_2.png) [@dlevitas](https://discourse.psychopy.org/u/dlevitas)\
**Post date:** [June 27, 2017, 10:00pm UTC](https://discourse.psychopy.org/t/import-error-with-pyqt5/2675/2 "2017-06-27T22:00:21Z")

</div>

Correction: the upgraded Psychopy version is v1.84.2

---

<div class="post-metadata">

**Author:** ![pgigliotti7](https://avatars.discourse-cdn.com/v4/letter/p/7c8e57/32.png) [@pgigliotti7](https://discourse.psychopy.org/u/pgigliotti7)\
**Post date:** [March 9, 2018, 3:45pm UTC](https://discourse.psychopy.org/t/import-error-with-pyqt5/2675/3 "2018-03-09T15:45:41Z")

</div>

I’m having this same problem with a failure to import from pyqt5 in an old Mac os. Any ideas?

---

<div class="post-metadata">

**Author:** ![pgigliotti7](https://avatars.discourse-cdn.com/v4/letter/p/7c8e57/32.png) [@pgigliotti7](https://discourse.psychopy.org/u/pgigliotti7)\
**Post date:** [March 9, 2018, 5:47pm UTC](https://discourse.psychopy.org/t/import-error-with-pyqt5/2675/4 "2018-03-09T17:47:28Z")

</div>

This is the error I’m getting:

##### Running: /Users/erin/Desktop/Exclusion\_Aggression/Working Cyberball PG.py

pyo version 0.8.6 (uses single precision)  
Traceback (most recent call last):  
File “/Users/erin/Desktop/Exclusion\_Aggression/Working Cyberball PG.py”, line 14, in   
from psychopy import locale\_setup, sound, gui, visual, core, data, event, logging  
File “/Users/erin/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/psychopy/gui/ **init**.py”, line 32, in   
from .qtgui import \*  
File “/Users/erin/Applications/PsychoPy2.app/Contents/Resources/lib/python2.7/psychopy/gui/qtgui.py”, line 14, in   
from PyQt5 import QtWidgets  
ImportError: No module named PyQt5

This is the block of code it refers to:  
try:  
from PyQt4 import QtGui  
QtWidgets = QtGui # in qt4 these were all in one package  
from PyQt4.QtCore import Qt  
except Exception:  
from PyQt5 import QtWidgets  
from PyQt5 import QtGui  
from PyQt5.QtCore import Qt

---

<div class="post-metadata">

**Author:** ![pgigliotti7](https://avatars.discourse-cdn.com/v4/letter/p/7c8e57/32.png) [@pgigliotti7](https://discourse.psychopy.org/u/pgigliotti7)\
**Post date:** [March 16, 2018, 2:51pm UTC](https://discourse.psychopy.org/t/import-error-with-pyqt5/2675/5 "2018-03-16T14:51:43Z")

</div>

It seems the problem is that what I assume is a standard python package on psychopy, PyQt5, is not installed on the MacBook. It seems tricky to install packages in psychopy, especially on Macs, and the standard pip install PyQt5 doesn’t work. Can anyone suggest how I could install PyQt5 to resolve this problem.
