Spyder: qtpy.PythonQtError: No Qt bindings could be found

Created on 16 Oct 2016  路  16Comments  路  Source: spyder-ide/spyder

Description of your problem

  1. pip install -U spyder
    2.run spyder in mac
    3.errors occur as following
    Traceback (most recent call last):
    File "/usr/local/bin/spyder", line 11, in
    sys.exit(main())
    File "/usr/local/lib/python2.7/site-packages/spyder/app/start.py", line 103, in main
    from spyder.app import mainwindow
    File "/usr/local/lib/python2.7/site-packages/spyder/app/mainwindow.py", line 49, in
    requirements.check_qt()
    File "/usr/local/lib/python2.7/site-packages/spyder/requirements.py", line 39, in check_qt
    import qtpy
    File "/usr/local/lib/python2.7/site-packages/qtpy/init.py", line 125, in
    raise PythonQtError('No Qt bindings could be found')
    qtpy.PythonQtError: No Qt bindings could be found

    Versions and main components

  • Spyder Version:3.0
  • Python Version: 2.7.10
  • Operating system: osx

Most helpful comment

You need to install PyQt4 or PyQt5 because that's not installed automatically by pip.

For PyQt5, just run

pip install pyqt5

All 16 comments

You need to install PyQt4 or PyQt5 because that's not installed automatically by pip.

For PyQt5, just run

pip install pyqt5

@ccordoba12
I ran into this problem. I had to do
brew install pyqt
and it worked.

That gives PyQt4, but now we prefer PyQt5 instead, so you need to run

brew install --with-python pyqt5

pip3 install pyqt5 worked for me

This worked for me on Ubuntu 16.04 Python 2.7.12 default [GCC 5.4.0 20160609] on linux2
sudo apt-get install python-pyqt5 python-pyqt5.qtsvg python-pyqt5.qtwebkit

Hi there,

I think I'm having the same problem but I haven't been able to solve it.

I'm using a virtualenv, from where I have installed brew, spyder and pyqt5.

I think my problem is that brew is installing pyqt5 in a path that my virtualenv cannot find, but I'm not very sure how to procede.

This is what I am getting when:

(py) $ brew install pyqt5

==> Installing dependencies for pyqt: python3, qt, sip
==> Installing pyqt dependency: python3
==> Downloading https://homebrew.bintray.com/bottles/python3-3.6.1.sierra.bottle.1.tar.gz
Already downloaded: /Users/marco/Library/Caches/Homebrew/python3-3.6.1.sierra.bottle.1.tar.gz
==> Pouring python3-3.6.1.sierra.bottle.1.tar.gz
==> Using the sandbox
==> /usr/local/Cellar/python3/3.6.1/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar/python3/3.6.1/
==> /usr/local/Cellar/python3/3.6.1/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar/python3/3.6.1/
==> /usr/local/Cellar/python3/3.6.1/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar/python3/3.6.1/
==> Caveats
Pip, setuptools, and wheel have been installed. To update them
  pip3 install --upgrade pip setuptools wheel

You can install Python packages with
  pip3 install <package>

They will install into the site-package directory
  /usr/local/lib/python3.6/site-packages

See: http://docs.brew.sh/Homebrew-and-Python.html
==> Summary
馃嵑  /usr/local/Cellar/python3/3.6.1: 3,600 files, 55.8MB
==> Installing pyqt dependency: qt
==> Downloading https://homebrew.bintray.com/bottles/qt-5.8.0_2.sierra.bottle.tar.gz
Already downloaded: /Users/marco/Library/Caches/Homebrew/qt-5.8.0_2.sierra.bottle.tar.gz
==> Pouring qt-5.8.0_2.sierra.bottle.tar.gz
==> Caveats
We agreed to the Qt opensource license for you.
If this is unacceptable you should uninstall.

This formula is keg-only, which means it was not symlinked into /usr/local.

Qt 5 has CMake issues when linked

If you need to have this software first in your PATH run:
  echo 'export PATH="/usr/local/opt/qt/bin:$PATH"' >> ~/.bash_profile

For compilers to find this software you may need to set:
    LDFLAGS:  -L/usr/local/opt/qt/lib
    CPPFLAGS: -I/usr/local/opt/qt/include

==> Summary
馃嵑  /usr/local/Cellar/qt/5.8.0_2: 8,667 files, 246.2MB
==> Installing pyqt dependency: sip
==> Downloading https://downloads.sourceforge.net/project/pyqt/sip/sip-4.19.2/sip-4.19.2.tar.gz
Already downloaded: /Users/marco/Library/Caches/Homebrew/sip-4.19.2.tar.gz
==> python configure.py --deployment-target=10.12 --destdir=/usr/local/Cellar/sip/4.19.2/lib/python2.7/site-packages --bindir=/usr/local/Cellar/sip/4.
==> make
==> make install
==> make clean
==> python3 configure.py --deployment-target=10.12 --destdir=/usr/local/Cellar/sip/4.19.2/lib/python3.6/site-packages --bindir=/usr/local/Cellar/sip/4
==> make
==> make install
==> make clean
Traceback (most recent call last):
  File "<string>", line 1, in <module>
AttributeError: 'module' object has no attribute 'getusersitepackages'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
AttributeError: 'module' object has no attribute 'getusersitepackages'
==> Caveats
The sip-dir for Python is /usr/local/share/sip.

Python modules have been installed and Homebrew's site-packages is not
in your Python sys.path, so you will not be able to import the modules
this formula installed. If you plan to develop with these modules,
please run:
  mkdir -p 
  echo 'import site; site.addsitedir("/usr/local/lib/python2.7/site-packages")' >> homebrew.pth
==> Summary
馃嵑  /usr/local/Cellar/sip/4.19.2: 16 files, 1MB, built in 14 seconds
==> Installing pyqt 
==> Downloading https://homebrew.bintray.com/bottles/pyqt-5.8.2.sierra.bottle.tar.gz
Already downloaded: /Users/marco/Library/Caches/Homebrew/pyqt-5.8.2.sierra.bottle.tar.gz
==> Pouring pyqt-5.8.2.sierra.bottle.tar.gz
馃嵑  /usr/local/Cellar/pyqt/5.8.2: 856 files, 24.6MB`

then I try:

(py) $ echo 'export PATH="/usr/local/opt/qt/bin:$PATH"' >> ~/.bash_profile
(py) $ mkdir -p
usage: mkdir [-pv] [-m mode] directory ...
(py) $ echo 'import site; site.addsitedir("/usr/local/lib/python2.7/site-packages")' >> homebrew.pth

and I try to run spyder:

(py) $ spyder
Traceback (most recent call last):
  File "/Users/marco/Documents/py/bin/spyder", line 11, in <module>
    sys.exit(main())
  File "/Users/marco/Documents/py/lib/python2.7/site-packages/spyder/app/start.py", line 103, in main
    from spyder.app import mainwindow
  File "/Users/marco/Documents/py/lib/python2.7/site-packages/spyder/app/mainwindow.py", line 49, in <module>
    requirements.check_qt()
  File "/Users/marco/Documents/py/lib/python2.7/site-packages/spyder/requirements.py", line 39, in check_qt
    import qtpy
  File "/Users/marco/Documents/py/lib/python2.7/site-packages/qtpy/__init__.py", line 125, in <module>
    raise PythonQtError('No Qt bindings could be found')
qtpy.PythonQtError: No Qt bindings could be found

Any ideas what am I doing wrong ?

Best.

@mchijmma Have you managed to solve the problem? I am running into the same issue.
Thanks!

Actually managed to solve it by running:

sudo spyder

I have no idea why I gotta use sudo, but I guess it works.
Good luck everyone :)

@KingGhost at the end I solved it by installing anaconda and just using spyder from a conda virtual env.

But I just checked with sudo spyder and it worked, Thanks !

I had installed spyder successfully before in a separate environment and the version : 3,2,1
Then I installed spyder without any error in a nother environment.
Then when I tried to run it,
I got the same error:
```
No Qt bindings could be found

I ran, 

pip install pyqt5

as @ccordoba12 suggested.
I got this error:
```sh
Could not find a version that satisfies the requirement pyqt5 (from versions: )
No matching distribution found for pyqt5

Then I did,

sudo apt-get install python-pyqt5 python-pyqt5.qtsvg python-pyqt5.qtwebkit

As @citynorman said.

They were installed without a problem but when I ran spyder, I got the same error.

Then I looked what my spyder version. It was 3.2.3

So I uninstalled it and installed the 3.2.1 version and it worked.

pip uninstall spyder
pip install spyder==3.2.1

Versions:

python: 2.7.12
OS : Ubuntu 16.04

I am facing the same issue when trying to install spyder in a python2.7 virtualenv:

I use pip install spyder inside a virtualenv

When I type spyder, it gives me the following error:
Traceback (most recent call last): File "/opt/virtual_caffe/caffe1_p2.7/bin/spyder", line 11, in <module> sys.exit(main()) File "/opt/virtual_caffe/caffe1_p2.7/local/lib/python2.7/site-packages/spyder/app/start.py", line 158, in main from spyder.app import mainwindow File "/opt/virtual_caffe/caffe1_p2.7/local/lib/python2.7/site-packages/spyder/app/mainwindow.py", line 49, in <module> requirements.check_qt() File "/opt/virtual_caffe/caffe1_p2.7/local/lib/python2.7/site-packages/spyder/requirements.py", line 39, in check_qt import qtpy File "/opt/virtual_caffe/caffe1_p2.7/local/lib/python2.7/site-packages/qtpy/__init__.py", line 175, in <module> raise PythonQtError('No Qt bindings could be found') qtpy.PythonQtError: No Qt bindings could be found

I have tried the solution suggested by @aquiire - it does not seem to fix it.

When I install spyder in local user space outside virtualenv, it seems to work fine. Is there a setting that I am missing out? I would really appreciate any help in this regards.

I am facing the same issue when trying to install spyder in a python2.7 virtualenv:

There's nothing we can do about this in our side because PyQt5 doesn't have wheels for Python 2, only Python 3.

@devkicks
a solution can be found here

After installing the pyqt5 packages globally with your os package manager like commented by citynorman, run

pip install vext.pyqt5

To check the status, run vext -l. You should see something like the following:

Running in virtualenv [enabled]
pyqt5.vext

If done on several virtualenv in a row, the cached wheel of vext.pyqt5 should be removed between each install. It can be found with ls ~/.cache/pip/wheels/*/*/*/* on linux.

In Xubuntu 18.04.1 and Python 2 (not my choice!), the following worked perfectly:
sudo apt-get install python-pyqt5 python-pyqt5.qtsvg python-pyqt5.qtwebkit

Yes, I am trying to get these Scientists to face the reality of migration to Python 3 this year. However, it is nice to know that Spyder can help these folks bridge the gap.

Thank you, @ccordoba12

I managed to solve that as follow:
1- Run this on Anaconda prompt : conda install -c anaconda pyqt
2 - Uninstall and install Spyder through Anaconda navigator.

I solved the same issue as following.
conda install spyder [ in virtualenv]

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jdweaver picture jdweaver  路  77Comments

MattJEM picture MattJEM  路  58Comments

CAM-Gerlach picture CAM-Gerlach  路  75Comments

jzzhou715 picture jzzhou715  路  64Comments

goanpeca picture goanpeca  路  106Comments