I am on Ubuntu 15.04, using Python 3.5.1 as Python 3. I have installed PyQt5 using sudo apt-get install python3-pyqt5
, but it didn't work. I also tried installing it from source.
After installing from source, I was able to access PyQt5
from ipython itself.
This is the output of python3 -c "import IPython; print(IPython.sys_info())"
python3 -c "import IPython; print(IPython.sys_info())"
{'commit_hash': '8ff8693',
'commit_source': 'installation',
'default_encoding': 'UTF-8',
'ipython_path': '/usr/local/lib/python3.5/dist-packages/IPython',
'ipython_version': '4.0.3',
'os_name': 'posix',
'platform': 'Linux-3.19.0-42-generic-x86_64-with-Ubuntu-15.04-vivid',
'sys_executable': '/usr/bin/python3',
'sys_platform': 'linux',
'sys_version': '3.5.1 (default, Dec 18 2015, 16:31:51) \n[GCC 4.9.2]'}
Here is the full traceback:
Traceback (most recent call last):
File "/usr/local/bin/ipython3", line 11, in <module>
sys.exit(start_ipython())
File "/usr/local/lib/python3.5/dist-packages/IPython/__init__.py", line 119, in start_ipython
return launch_new_instance(argv=argv, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/traitlets/config/application.py", line 588, in launch_instance
app.initialize(argv)
File "<decorator-gen-111>", line 2, in initialize
File "/usr/local/lib/python3.5/dist-packages/traitlets/config/application.py", line 74, in catch_config_error
return method(app, *args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/IPython/terminal/ipapp.py", line 305, in initialize
super(TerminalIPythonApp, self).initialize(argv)
File "<decorator-gen-7>", line 2, in initialize
File "/usr/local/lib/python3.5/dist-packages/traitlets/config/application.py", line 74, in catch_config_error
return method(app, *args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/IPython/core/application.py", line 386, in initialize
self.parse_command_line(argv)
File "/usr/local/lib/python3.5/dist-packages/IPython/terminal/ipapp.py", line 300, in parse_command_line
return super(TerminalIPythonApp, self).parse_command_line(argv)
File "<decorator-gen-4>", line 2, in parse_command_line
File "/usr/local/lib/python3.5/dist-packages/traitlets/config/application.py", line 74, in catch_config_error
return method(app, *args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/traitlets/config/application.py", line 485, in parse_command_line
return self.initialize_subcommand(subc, subargv)
File "<decorator-gen-3>", line 2, in initialize_subcommand
File "/usr/local/lib/python3.5/dist-packages/traitlets/config/application.py", line 74, in catch_config_error
return method(app, *args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/traitlets/config/application.py", line 416, in initialize_subcommand
subapp = import_item(subapp)
File "/usr/local/lib/python3.5/dist-packages/ipython_genutils/importstring.py", line 31, in import_item
module = __import__(package, fromlist=[obj])
File "/usr/local/lib/python3.5/dist-packages/qtconsole/qtconsoleapp.py", line 60, in <module>
from qtconsole.qt import QtCore, QtGui
File "/usr/local/lib/python3.5/dist-packages/qtconsole/qt.py", line 23, in <module>
QtCore, QtGui, QtSvg, QT_API = load_qt(api_opts)
File "/usr/local/lib/python3.5/dist-packages/qtconsole/qt_loaders.py", line 304, in load_qt
api_options))
ImportError:
Could not load requested Qt binding. Please ensure that
PyQt4 >= 4.7, PyQt5 or PySide >= 1.0.3 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
Tried to load: ['pyqt5', 'pyside', 'pyqt']
Python 2 has a similar issue. This is the output of python -c "import IPython; print(IPython.sys_info())"
:
{'commit_hash': u'f534027',
'commit_source': 'installation',
'default_encoding': 'UTF-8',
'ipython_path': '/usr/local/lib/python2.7/dist-packages/IPython',
'ipython_version': '4.0.0',
'os_name': 'posix',
'platform': 'Linux-3.19.0-42-generic-x86_64-with-Ubuntu-15.04-vivid',
'sys_executable': '/usr/bin/python',
'sys_platform': 'linux2',
'sys_version': '2.7.9 (default, Apr 2 2015, 15:33:21) \n[GCC 4.9.2]'}
and the traceback:
Traceback (most recent call last):
File "/usr/local/bin/ipython", line 11, in <module>
sys.exit(start_ipython())
File "/usr/local/lib/python3.5/dist-packages/IPython/__init__.py", line 119, in start_ipython
return launch_new_instance(argv=argv, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/traitlets/config/application.py", line 588, in launch_instance
app.initialize(argv)
File "<decorator-gen-111>", line 2, in initialize
File "/usr/local/lib/python3.5/dist-packages/traitlets/config/application.py", line 74, in catch_config_error
return method(app, *args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/IPython/terminal/ipapp.py", line 305, in initialize
super(TerminalIPythonApp, self).initialize(argv)
File "<decorator-gen-7>", line 2, in initialize
File "/usr/local/lib/python3.5/dist-packages/traitlets/config/application.py", line 74, in catch_config_error
return method(app, *args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/IPython/core/application.py", line 386, in initialize
self.parse_command_line(argv)
File "/usr/local/lib/python3.5/dist-packages/IPython/terminal/ipapp.py", line 300, in parse_command_line
return super(TerminalIPythonApp, self).parse_command_line(argv)
File "<decorator-gen-4>", line 2, in parse_command_line
File "/usr/local/lib/python3.5/dist-packages/traitlets/config/application.py", line 74, in catch_config_error
return method(app, *args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/traitlets/config/application.py", line 485, in parse_command_line
return self.initialize_subcommand(subc, subargv)
File "<decorator-gen-3>", line 2, in initialize_subcommand
File "/usr/local/lib/python3.5/dist-packages/traitlets/config/application.py", line 74, in catch_config_error
return method(app, *args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/traitlets/config/application.py", line 416, in initialize_subcommand
subapp = import_item(subapp)
File "/usr/local/lib/python3.5/dist-packages/ipython_genutils/importstring.py", line 31, in import_item
module = __import__(package, fromlist=[obj])
File "/usr/local/lib/python3.5/dist-packages/qtconsole/qtconsoleapp.py", line 60, in <module>
from qtconsole.qt import QtCore, QtGui
File "/usr/local/lib/python3.5/dist-packages/qtconsole/qt.py", line 23, in <module>
QtCore, QtGui, QtSvg, QT_API = load_qt(api_opts)
File "/usr/local/lib/python3.5/dist-packages/qtconsole/qt_loaders.py", line 304, in load_qt
api_options))
ImportError:
Could not load requested Qt binding. Please ensure that
PyQt4 >= 4.7, PyQt5 or PySide >= 1.0.3 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
Tried to load: ['pyqt5', 'pyside', 'pyqt']
PyQt5 does not work in Python 2 at all, even though python-pyqt5
is also installed.
If this is not the right place for it, please let me know.