Viewer console not working when running under ipython
See original GitHub issue🐛 Bug
If I run napari from an ipython console with the %gui qt
magic then I can’t access the ipython console from the viewer. Running from python rather than ipython, the console works as expected
To Reproduce
The following opens a viewer, the error is produced when trying to access the console from the viewer
(base) ➜ napari git:(master) ✗ conda activate napari
(napari) ➜ napari git:(master) ✗ ipython
Python 3.9.5 | packaged by conda-forge | (default, Jun 19 2021, 00:27:35)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.24.1 -- An enhanced Interactive Python. Type '?' for help.
In [1]: %gui qt
In [2]: %run examples/add_image.py
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
~/Programming/napari/napari/utils/action_manager.py in <lambda>()
52 def callable(self, context):
53 if not hasattr(self, '_command_with_context'):
---> 54 self._command_with_context = lambda: call_with_context(
55 self.command, context
56 )
~/Programming/napari/napari/utils/action_manager.py in call_with_context(function, context)
41 ]
42 ctx = {k: v for k, v in context.items() if k in context_keys}
---> 43 return function(**ctx)
44
45
~/Programming/napari/napari/_qt/qt_viewer.py in toggle_console_visibility(self, event)
724 """
725 # force instantiation of console if not already instantiated
--> 726 _ = self.console
727
728 viz = not self.dockConsole.isVisible()
AttributeError: 'QtViewer' object has no attribute 'console'
The following works fine
(napari) ➜ napari git:(master) ✗ python examples/add_image.py
This used to work fine on my system, not sure exactly when it broke… will have to do some searching
napari --info
napari: 0.4.10.dev0+g609fd9f4.d20210623
Platform: macOS-11.2.1-x86_64-i386-64bit
System: MacOS 11.2.1
Python: 3.9.5 | packaged by conda-forge | (default, Jun 19 2021, 00:27:35) [Clang 11.1.0 ]
Qt: 5.15.2
PyQt5: 5.15.4
NumPy: 1.21.0
SciPy: 1.7.0
Dask: 2021.06.2
VisPy: 0.6.6
OpenGL:
- GL version: 2.1 Metal - 71.0.7
- MAX_TEXTURE_SIZE: 16384
Screens:
- screen 1: resolution 1440x900, scale 2.0
Plugins:
- console: 0.0.3
- scikit-image: 0.4.10.dev0+g609fd9f4.d20210623
- svg: 0.1.5
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Viewer problem 'non-GUI backend' with Spyder's IPython ...
Hello, I recently updated to Spyder 5 on MacOS and have been using FiPy in combination with Spyder for a long time.
Read more >Spyder 4.2.5 - iPython Console Not Working With Python 3.8.0
And every time I execute the command pip install spyder-kernels. It show the message: Fatal error in launcher: Unable to create process ......
Read more >iPython console gets totally unresponsive when using large ...
After the update PyCharm would crash due to running out of memory when debugging something that had a large DataFrame. I could on...
Read more >IPython Console — Spyder 5 documentation
To connect to a kernel on a remote machine,. Launch a Spyder kernel on the remote host if one is not already running,...
Read more >IPython Console Plugin
To run the IPython Console Plugin, select one of the accessible items listed in the Application Tree View - either an application or...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Console indeed never worked from IPython! It was one of the reasons why I was interested in doing #2378.
I know there’s been some discussion somewhere about disabling that button when running via ipython. still a good idea…
As for pycharm, I’ll need to play with it (don’t have much experience with it). Maybe we can screen share for that?