5

I've installed ipython with 'pip install ipython[all]' as described in the installation page and also have installed the qtconsole dependencies with homebrew (qt, pyqt, and sip). However, when I try to launch the qtconsole from terminal with 'ipython qtconsole', I get the following error message:

Traceback (most recent call last):
  File "/Users/***/.virtualenvs/data-analysis/bin/ipython", line 11, in <module>
   sys.exit(start_ipython())
  File "/Users/***/.virtualenvs/data-analysis/lib/python2.7/site-packages/IPython/__init__.py", line 120, in start_ipython
return launch_new_instance(argv=argv, **kwargs)
  File "/Users/***/.virtualenvs/data-analysis/lib/python2.7/site-packages/IPython/config/application.py", line 563, in launch_instance
app.initialize(argv)
  File "<string>", line 2, in initialize
  File "/Users/***/.virtualenvs/data-analysis/lib/python2.7/site-packages/IPython/config/application.py", line 92, in catch_config_error
    return method(app, *args, **kwargs)
  File "/Users/***/.virtualenvs/data-analysis/lib/python2.7/site-packages/IPython/terminal/ipapp.py", line 321, in initialize
    super(TerminalIPythonApp, self).initialize(argv)
  File "<string>", line 2, in initialize
  File "/Users/***/.virtualenvs/data-analysis/lib/python2.7/site-packages/IPython/config/application.py", line 92, in catch_config_error
    return method(app, *args, **kwargs)
  File "/Users/***/.virtualenvs/data-analysis/lib/python2.7/site-packages/IPython/core/application.py", line 381, in initialize
 self.parse_command_line(argv)
  File "/Users/***/.virtualenvs/data-analysis/lib/python2.7/site-packages/IPython/terminal/ipapp.py", line 316, in parse_command_line
    return super(TerminalIPythonApp, self).parse_command_line(argv)
  File "<string>", line 2, in parse_command_line
  File "/Users/***/.virtualenvs/data-analysis/lib/python2.7/site-packages/IPython/config/application.py", line 92, in catch_config_error
    return method(app, *args, **kwargs)
  File "/Users/***/.virtualenvs/data-analysis/lib/python2.7/site-packages/IPython/config/application.py", line 475, in parse_command_line
    return self.initialize_subcommand(subc, subargv)
  File "<string>", line 2, in initialize_subcommand
  File "/Users/***/.virtualenvs/data-analysis/lib/python2.7/site-packages/IPython/config/application.py", line 92, in catch_config_error
    return method(app, *args, **kwargs)
  File "/Users/***/.virtualenvs/data-analysis/lib/python2.7/site-packages/IPython/config/application.py", line 406, in initialize_subcommand
    subapp = import_item(subapp)
  File "/Users/***/.virtualenvs/data-analysis/lib/python2.7/site-packages/IPython/utils/importstring.py", line 42, in import_item
    module = __import__(package, fromlist=[obj])
  File "/Users/***/.virtualenvs/data-analysis/lib/python2.7/site-packages/IPython/qt/console/qtconsoleapp.py", line 58, in <module>
    from IPython.external.qt import QtCore, QtGui
  File "/Users/***/.virtualenvs/data-analysis/lib/python2.7/site-packages/IPython/external/qt.py", line 23, in <module>
    QtCore, QtGui, QtSvg, QT_API = load_qt(api_opts)
  File "/Users/***/.virtualenvs/data-analysis/lib/python2.7/site-packages/IPython/external/qt_loaders.py", line 258, in load_qt
api_options))
ImportError: 
Could not load requested Qt binding. Please ensure that
PyQt4 >= 4.7 or PySide >= 1.0.3 is available,
and only one is imported per session.

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

What is going wrong here? Any help would be greatly appreciated.

thereislight
  • 285
  • 3
  • 12
  • Note: Similar to issue here (http://stackoverflow.com/questions/25752315/error-loading-ipython-qtconsole?rq=1); that thread, as well as comments below (thanks jihun!), suggest that adding "export PYTHONPATH=/usr/local/lib/python2.7/site-packages:$PYTHONPATH" to .bash_profile solves the issue. – thereislight Oct 12 '14 at 03:45
  • 1
    Helpfull note "How to install PyQt4 on Windows" see here - http://stackoverflow.com/questions/22640640/how-to-install-pyqt4-on-windows-using-pip – Grag2015 Nov 21 '16 at 14:32

1 Answers1

1

Error message says you do not have installed neither PyQt4 nor PySide >=1.0.3. You should check one of two package installed correctly. You said you installed pyqt but you got error. Perhaps, it is pyqt version 3. PyQt version 4 has a different name such as PyQt4. In such cases, you should install pyqt4.

Jihun
  • 1,415
  • 1
  • 12
  • 16
  • I checked the version of pyqt with brew ls --versions and it seems that pyqt, qt, and sip are all up to date. The version numbers are: pyqt 4.11.1; qt 4.8.6; sip 4.16.3. Perhaps I need to manually import pyqt somehow? Or maybe my file path somewhere is messed up? I will try reinstalling pyqt, qt, and sip; we'll see if that works. – thereislight Oct 12 '14 at 03:22
  • Did you check you updated PYTHONPATH like, "export PYTHONPATH=/usr/local/lib/python2.7/site-packages:$PYTHONPATH "? Homebrew usually require that. On the other hand, instead of pip, you can try to install ipython using homebrew, too. – Jihun Oct 12 '14 at 03:27
  • Ah yes, I just did that and it worked beautifully! Thanks so much. As an aside, do you happen to know why homebrew usually requires that/why that line makes it all work? – thereislight Oct 12 '14 at 03:32
  • Since homebrew is not official part of OS, it does not touch /usr/lib. Instead, they install packages in /usr/local/. In contrast, Python is usually default installed by OS. So the python does not look /usr/local/lib unless you explicitly require that. – Jihun Oct 12 '14 at 03:53
  • Hm ok, that kind of makes sense. Thanks again! – thereislight Oct 12 '14 at 05:16