Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

qtconsole unable to load PyQt5

See original GitHub issue

I installed qtconsole using conda.

conda install jupyter qtconsole

Then when I run qtconsole I get:

Icohedron@DESKTOP-80FCK21:~$ jupyter qtconsole
Traceback (most recent call last):
  File "/home/Icohedron/.local/bin/jupyter-qtconsole", line 7, in <module>
    from qtconsole.qtconsoleapp import main
  File "/home/Icohedron/.local/lib/python3.5/site-packages/qtconsole/", line 60, in <module>
    from qtconsole.qt import QtCore, QtGui
  File "/home/Icohedron/.local/lib/python3.5/site-packages/qtconsole/", line 23, in <module>
    QtCore, QtGui, QtSvg, QT_API = load_qt(api_opts)
  File "/home/Icohedron/.local/lib/python3.5/site-packages/qtconsole/", line 386, in load_qt
    Could not load requested Qt binding. Please ensure that
    PyQt4 >= 4.7, PyQt5, PySide >= 1.0.3 or PySide2 is available,
    and only one is imported per session.

    Currently-imported Qt library:   None
    PyQt4 installed:                 False
    PyQt5 installed:                 False
    PySide >= 1.0.3 installed:       False
    PySide2 installed:               False
    Tried to load:                   ['pyqt5', 'pyside2', 'pyside', 'pyqt']

I then tried to load QtCore from PyQt5 in a Python shell, then QtCore from qtconsole.qt and I got:

Icohedron@DESKTOP-80FCK21:~$ ipython
Python 3.5.2 (default, Nov 23 2017, 16:37:01)
Type 'copyright', 'credits' or 'license' for more information
IPython 6.2.1 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from PyQt5 import QtCore

In [2]: from qtconsole.qt import QtCore
ImportError                               Traceback (most recent call last)
<ipython-input-2-9132f866eeaa> in <module>()
----> 1 from qtconsole.qt import QtCore

~/.local/lib/python3.5/site-packages/qtconsole/ in <module>()
     21     api_opts = [QT_API]
---> 23 QtCore, QtGui, QtSvg, QT_API = load_qt(api_opts)

~/.local/lib/python3.5/site-packages/qtconsole/ in load_qt(api_options)
    384            has_binding(QT_API_PYSIDE),
    385            has_binding(QT_API_PYSIDE2),
--> 386            api_options))
    388 def load_qtest():

    Could not load requested Qt binding. Please ensure that
    PyQt4 >= 4.7, PyQt5, PySide >= 1.0.3 or PySide2 is available,
    and only one is imported per session.

    Currently-imported Qt library:   'pyqt5'
    PyQt4 installed:                 False
    PyQt5 installed:                 False
    PySide >= 1.0.3 installed:       False
    PySide2 installed:               False
    Tried to load:                   ['pyqt5']

List of packages from conda:

# packages in environment at /home/Icohedron/miniconda3:
# Name                    Version                   Build  Channel
asn1crypto                0.24.0                   py37_0  
backcall                  0.1.0                    py37_0  
blas                      1.0                         mkl  
bleach                    3.0.0                    py37_0  
ca-certificates           2018.03.07                    0  
certifi                   2018.8.24                py37_1  
cffi                      1.11.5           py37he75722e_1  
chardet                   3.0.4                    py37_1  
conda                     4.5.11                   py37_0  
conda-env                 2.6.0                         1  
cryptography              2.3.1            py37hc365091_0  
cycler                    0.10.0                   py37_0  
dbus                      1.13.2               h714fa37_1  
decorator                 4.3.0                    py37_0  
entrypoints               0.2.3                    py37_2  
expat                     2.2.6                he6710b0_0  
fastcache                 1.0.2            py37h14c3975_2  
fontconfig                2.13.0               h9420a91_0  
freetype                  2.9.1                h8a8886c_1  
glib                      2.56.2               hd408876_0  
gmp                       6.1.2                h6c8ec71_1  
gmpy2                     2.0.8            py37h10f8cd9_2  
gst-plugins-base          1.14.0               hbbd80ab_1  
gstreamer                 1.14.0               hb453b48_1  
icu                       58.2                 h9c2bf20_1  
idna                      2.7                      py37_0  
intel-openmp              2019.0                      118  
ipykernel                 5.0.0            py37h39e3cac_0  
ipython                   7.0.1            py37h39e3cac_0  
ipython_genutils          0.2.0                    py37_0  
ipywidgets                7.4.2                    py37_0  
jedi                      0.13.1                   py37_0  
jinja2                    2.10                     py37_0  
jpeg                      9b                   h024ee3a_2  
jsonschema                2.6.0                    py37_0  
jupyter                   1.0.0                    py37_7  
jupyter_client            5.2.3                    py37_0  
jupyter_console           6.0.0                    py37_0  
jupyter_core              4.4.0                    py37_0  
kiwisolver                1.0.1            py37hf484d3e_0  
libedit                   3.1.20170329         h6b74fdf_2  
libffi                    3.2.1                hd88cf55_4  
libgcc-ng                 8.2.0                hdf63c60_1  
libgfortran-ng            7.3.0                hdf63c60_0  
libpng                    1.6.34               hb9fc6fc_0  
libsodium                 1.0.16               h1bed415_0  
libstdcxx-ng              8.2.0                hdf63c60_1  
libuuid                   1.0.3                h1bed415_2  
libxcb                    1.13                 h1bed415_1  
libxml2                   2.9.8                h26e45fe_1  
markupsafe                1.0              py37h14c3975_1  
matplotlib                3.0.0            py37h5429711_0  
mistune                   0.8.3            py37h14c3975_1  
mkl                       2019.0                      118  
mkl_fft                   1.0.6            py37h7dd41cf_0  
mkl_random                1.0.1            py37h4414c95_1  
mpc                       1.1.0                h10f8cd9_1  
mpfr                      4.0.1                hdf1c602_3  
mpmath                    1.0.0                    py37_2  
nbconvert                 5.3.1                    py37_0  
nbformat                  4.4.0                    py37_0  
ncurses                   6.1                  hf484d3e_0  
notebook                  5.7.0                    py37_0  
numpy                     1.15.2           py37h1d66e8a_1  
numpy-base                1.15.2           py37h81de0dd_1  
openssl                   1.0.2p               h14c3975_0  
pandoc                                 0  
pandocfilters             1.4.2                    py37_1  
parso                     0.3.1                    py37_0  
pcre                      8.42                 h439df22_0  
pexpect                   4.6.0                    py37_0  
pickleshare               0.7.5                    py37_0  
pip                       10.0.1                   py37_0  
prometheus_client         0.4.0                    py37_0  
prompt_toolkit            2.0.5                    py37_0  
ptyprocess                0.6.0                    py37_0  
pycosat                   0.6.3            py37h14c3975_0  
pycparser                 2.18                     py37_1  
pygments                  2.2.0                    py37_0  
pyopenssl                 18.0.0                   py37_0  
pyparsing                 2.2.2                    py37_0  
pyqt                      5.9.2            py37h05f1152_2  
pysocks                   1.6.8                    py37_0  
python                    3.7.0                hc3d631a_0  
python-dateutil           2.7.3                    py37_0  
pytz                      2018.5                   py37_0  
pyzmq                     17.1.2           py37h14c3975_0  
qt                        5.9.6                h8703b6f_2  
qtconsole                 4.4.1                    py37_0  
readline                  7.0                  h7b6447c_5  
requests                  2.19.1                   py37_0  
ruamel_yaml               0.15.46          py37h14c3975_0  
send2trash                1.5.0                    py37_0  
setuptools                40.2.0                   py37_0  
simplegeneric             0.8.1                    py37_2  
sip                       4.19.8           py37hf484d3e_0  
six                       1.11.0                   py37_1  
sqlite                    3.24.0               h84994c4_0  
sympy                     1.3                      py37_0  
terminado                 0.8.1                    py37_1  
testpath                  0.4.2                    py37_0  
tk                        8.6.8                hbc83047_0  
tornado                   5.1.1            py37h7b6447c_0  
traitlets                 4.3.2                    py37_0  
urllib3                   1.23                     py37_0  
wcwidth                   0.1.7                    py37_0  
webencodings              0.5.1                    py37_1  
wheel                     0.31.1                   py37_0  
widgetsnbextension        3.4.2                    py37_0  
xz                        5.2.4                h14c3975_4  
yaml                      0.1.7                had09818_2  
zeromq                    4.2.5                hf484d3e_1  
zlib                      1.2.11               ha838bed_2  

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

Icohedroncommented, Oct 12, 2018

I discovered the issue. Bash was running the qtconsole installed through pip in my vanilla (non-conda) python. Despite having export PATH="/home/Icohedron/miniconda3/bin:$PATH" in my bashrc, jupyter qtconsole still ran from /home/Icohedron/.local/bin and as such did not find PyQt5 installed from conda. I “fixed” this issue by uninstalling qtconsole from my non-conda pip.

Icohedroncommented, Oct 11, 2018

@2DSharp pyqt is already installed (it automatically installed it with qtconsole as a dependency) and so it doesn’t do anything.

Icohedron@DESKTOP-80FCK21:~$ conda install pyqt
Solving environment: done

# All requested packages already installed.
Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't quit PyQt5 application with embedded iPython Qtconsole
I'm trying to embed an iPython Qtconsole into a PyQt5 app. The embedded console works fine, but when I try to exit the...
Read more >
Installation — Jupyter Qt Console 5.4.0 documentation
Make sure that Qt is installed. Unfortunately, Qt cannot be installed using pip. The next section gives instructions on installing Qt. Installing Qt...
Read more >
qtconsole - PyPI
The Qtconsole is a very lightweight application that largely feels like a terminal, but provides a number of enhancements only possible in a...
Read more >
A Qt Console for IPython - documentation
To start the Qt Console: $> ipython qtconsole. We now have a version of IPython, using the new two-process ZeroMQ Kernel, running in...
Read more >
pip install pyqt5-tools error metadata-generation-failed
You need to have Qt5 installed in the system, and you need to have its qmake in PATH . To install Qt5, you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found