napari: Missing user warning - qt event loop should be started before launching napari
🐛 Bug
Failing to use the %gui qt
magic in ipython/jupyter before launching napari no longer shows you a handy warning message explaining
To Reproduce
Steps to reproduce the behavior:
conda create -n napari-testenv python=3.7 pip
conda activate napari-testenv
- Start
ipython
and then import napari and show the viewer.
import napari
viewer = napari.Viewer()
You’ll see this blank, black napari window (not what we want), and there is no error message explaining that the user should try to use %gui qt
before starting napari.
Expected behavior
I expected a warning message to be printed to the terminal, telling the user that they should start the qt loop (with %gui qt
or similar) before starting napari.
Environment
- Please copy and paste the information at napari info option in help menubar here:
napari: 0.2.4.dev736+g79ab358
Platform: Linux-5.8.0-41-generic-x86_64-with-debian-bullseye-sid
System: Ubuntu 20.04.2 LTS
Python: 3.7.9 | packaged by conda-forge | (default, Dec 9 2020, 21:08:20) [GCC 9.3.0]
Qt: 5.15.2
PyQt5: 5.15.2
NumPy: 1.20.1
SciPy: 1.6.0
Dask: 2021.02.0
VisPy: 0.6.6
OpenGL:
- GL version: 4.6 (Compatibility Profile) Mesa 20.2.6
- MAX_TEXTURE_SIZE: 16384
Screens:
- screen #1: resolution 1920x1080, scale 1.0
- screen #2: resolution 1920x1080, scale 1.0
Plugins:
- svg: 0.1.4
- Any other relevant information:
Additional context
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 32 (32 by maintainers)
ok, so it looks like I can reproduce this (on ubuntu) without even using napari:
need to figure out why this happens on ubuntu, and whether it’s unique to 20.04. @goanpeca, any insight here?
I think it’s a bit different to the matplotlib example because in my view the real power with napari is interactivity, whereas in matplotlib you generally want to construct the entire figure before seeing it.
But I’m not trying to start a philosophical argument here. I just missed that there was an intentional change here & was trying to be helpful by flagging it.
You monster! 😂
as i laid out above, I’m not a fan… but it’s a democracy and I’m happy to be outvoted! 😂 I absolutely think we have an obligation to those who already use
gui_qt()
to make sure it doesn’t break without a solid deprecation period. And I also definitely think we should continue to tell people about%gui qt
in our documentation, just as we always have, and to make sure that it works well with napari. But I use napari in IPython all the time without%gui qt
and I really don’t want to be warned about it. It feels akin to matplotlib warning you everytime you made a figure “hey you forgot to useplt.ion()
!”I did try with master yesterday, I’ll give it another go now
yeah, I don’t get the black screen either… so I’d need to know more about how the script is being run.