question-mark
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 does not start up

See original GitHub issue

I tried to start Ipython QtConsole, however failed…

dell@DELL-PC C:\Users\dell
> ipython qtconsole
Traceback (most recent call last):
  File "C:\MyPrograms\Anaconda3\Scripts\ipython-script.py", line 5, in <module>
    sys.exit(start_ipython())
  File "C:\MyPrograms\Anaconda3\lib\site-packages\IPython\__init__.py", line 118, in start_ipython
    return launch_new_instance(argv=argv, **kwargs)
  File "C:\MyPrograms\Anaconda3\lib\site-packages\traitlets\config\application.py", line 591, in launch_instance
    app.initialize(argv)
  File "<decorator-gen-112>", line 2, in initialize
  File "C:\MyPrograms\Anaconda3\lib\site-packages\traitlets\config\application.py", line 75, in catch_config_error
    return method(app, *args, **kwargs)
  File "C:\MyPrograms\Anaconda3\lib\site-packages\IPython\terminal\ipapp.py", line 305, in initialize
    super(TerminalIPythonApp, self).initialize(argv)
  File "<decorator-gen-7>", line 2, in initialize
  File "C:\MyPrograms\Anaconda3\lib\site-packages\traitlets\config\application.py", line 75, in catch_config_error
    return method(app, *args, **kwargs)
  File "C:\MyPrograms\Anaconda3\lib\site-packages\IPython\core\application.py", line 386, in initialize
    self.parse_command_line(argv)
  File "C:\MyPrograms\Anaconda3\lib\site-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 "C:\MyPrograms\Anaconda3\lib\site-packages\traitlets\config\application.py", line 75, in catch_config_error
    return method(app, *args, **kwargs)
  File "C:\MyPrograms\Anaconda3\lib\site-packages\traitlets\config\application.py", line 487, in parse_command_line
    return self.initialize_subcommand(subc, subargv)
  File "<decorator-gen-3>", line 2, in initialize_subcommand
  File "C:\MyPrograms\Anaconda3\lib\site-packages\traitlets\config\application.py", line 75, in catch_config_error
    return method(app, *args, **kwargs)
  File "C:\MyPrograms\Anaconda3\lib\site-packages\traitlets\config\application.py", line 418, in initialize_subcommand
    subapp = import_item(subapp)
  File "C:\MyPrograms\Anaconda3\lib\site-packages\ipython_genutils\importstring.py", line 31, in import_item
    module = __import__(package, fromlist=[obj])
ImportError: No module named 'qtconsole.qtconsoleapp'

dell@DELL-PC C:\Users\dell

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
minrkcommented, Oct 12, 2015

As the ImportError is meant to suggest, you lack the qtconsole package:

conda install qtconsole

then launch with

jupyter qtconsole
0reactions
OW51commented, Apr 23, 2019

Problem statement Qtconsole import error or conflict.

This is the exact error message I was getting

File “uikit/ipython.py”, line 5, in <module> ImportError: No module named qt.console.rich_ipython_widget [28603] Failed to execute script bosetap

and this. Currently-imported Qt library: ‘pyqt’ PyQt4 installed: False PyQt5 installed: False PySide >= 1.0.3 installed: False PySide2 installed: False Tried to load: [‘pyqt’]

you can dig into uikit/ipython.py and see there is an try catch block around the import of new vs old .

QT_API = os.environ.get(‘QT_API’, None) if QT_API not in [QT_API_PYSIDE, QT_API_PYSIDE2, QT_API_PYQT, QT_API_PYQT5, None]: raise RuntimeError(“Invalid Qt API %r, valid values are: %r, %r, %r, %r” % (QT_API, QT_API_PYSIDE, QT_API_PYSIDE2, QT_API_PYQT, QT_API_PYQT5)) if QT_API is None: api_opts = [QT_API_PYQT5, QT_API_PYSIDE2, QT_API_PYSIDE, QT_API_PYQT] else: api_opts = [QT_API]

step 1) I started running things by hand at a python prompt and I convinced myself that qt.console was installed correctly. If you find you can not do this. Install the missing module.

Step 2) if you are using pyqt4 make sure you exclude pyqt5, pyside, and pyside2 modules in your pyinstaller spec file. It might look something like this. This goes in the analysis section excludes=[‘pyqtgraph.graphicsItems.PlotItem.plotConfigTemplate_pyqt5’, ‘pyqtgraph.graphicsItems.PlotItem.plotConfigTemplate_pyqt5’, ‘pyqtgraph.graphicsItems.ViewBox.axisCtrlTemplate_pyqt5’, ‘pyqtgraph.GraphicsScene.exportDialogTemplate_pyqt5’, ‘PyQt5’,’ PyQt5.QtCore’,‘PyQt5.QtGui’,‘PyQt5.QtPrintSupport’, ‘PyQt5.QtSvg’,‘PySide’,‘PySide2’],

This might have been overkill. Once I got it working, I didn’t want to touch it. The optimization is left as an exercise for the reader.

Step3) I’m going to tell you the solution first and then how to get there. The problem was that pyinstaller was putting my pyqt4 executables at the top level in the package. Qtconsole was looking for them in a PyQt4 directory. The following goes in the exe section of your spec file.

      a.binaries + [('PyQt4/QtCore.so','/usr/lib/python2.7/dist-packages/PyQt4/QtCore.so','BINARY'),
            ('PyQt4/QtGui.so','/usr/lib/python2.7/dist-packages/PyQt4/QtGui.so','BINARY'),
            ('PyQt4/QtOpenGL.so','/usr/lib/python2.7/dist-packages/PyQt4/QtOpenGL.so','BINARY'),
            ('PyQt4/QtSvg.so','/usr/lib/python2.7/dist-packages/PyQt4/QtSvg.so','BINARY'),
            ('PyQt4/QtTest.so','/usr/lib/python2.7/dist-packages/PyQt4/QtTest.so','BINARY'),
            ('PyQt4/QtXml.so','/usr/lib/python2.7/dist-packages/PyQt4/QtXml.so','BINARY')
            ],

So, the bad part about this solution is we now get warnings that we have the same executable in two places. The optimization is left as an exercise for the reader. Honestly, I haven’t figured out how to resolve this yet. So, if you do… it would be nice to hear from you. This is how I got to step 3. I think this part is important. I added this to my spec file just for development, not for the customer’s package. The problem with developing the package was it was failing to run and then the tmp/<some random numbers and letters> directory would remove itself. I couldn’t see what the problem was. I knew I had pyqt4 installed and that the application ran by hand. It was very frustrating. So, if you do the below to your spec file you will get a directory built instead of an executable. That directory stays and you can peak inside and see what is going on. Then, you are armed and dangerous to enable the solution. Then when you have it working, you revert this to develop an executable for your customer.

exe = EXE(pyz,           a.scripts,          [],           exclude_binaries=True,           name=‘bosetap’,           debug=False,           bootloader_ignore_signals=False,           strip=False,           upx=True,           console=True )

coll = COLLECT(exe,                a.binaries,                a.zipfiles,                a.datas,                strip=False,                upx=True,                name=‘bosetap’)

Special thanks to my boss as I banged my head against this for 1 week. Happy Trails.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why is IPython QtConsole not launching? - Stack Overflow
Error message says you do not have installed neither PyQt4 nor PySide >=1.0.3. You should check one of two package installed correctly.
Read more >
qtconsole - PyPI
Jupyter QtConsole. Windows tests Macos tests Linux tests Coverage Status Documentation Status Google Group. A rich Qt-based console for working with Jupyter ...
Read more >
Jupyter Qt Console 5.0.2 documentation - Read the Docs
Use qtconsole.rich_jupyter_widget. · Start an IPython kernel inside a PyQt application ( ipkernel_qtapp.py in the ipykernel repository shows how ...
Read more >
Jupyter QtConsole - Getting Started - Tutorialspoint
Overview. The Qt console is a GUI application similar to IPython terminal. However, it provides a number of enhancements which are not available...
Read more >
A Qt Console for IPython
Remote Consoles may not restart or shutdown the kernel. Qt and the QtConsole¶. An important part of working with the QtConsole when 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 Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found