napari: Unable to open another viewer after closing another one in the same program
🐛 Bug
Napari can’t open multiple viewers inside a for loop, note that they are not being executed at the same time. This used to work in 0.4.6, it might be related to #2977.
I’m not sure where to start to fix this.
To Reproduce
Steps to reproduce the behavior:
- Execute the following code.
import napari
for i in range(10):
viewer = napari.Viewer()
napari.run()
- Close the first viewer.
- Subsequent viewers do not work as expected, they open all at once.
Expected behavior
To open the next viewer as usual after the previous one was closed.
Environment
napari: 0.4.10
Platform: Linux-5.8.0-59-generic-x86_64-with-glibc2.17
System: Ubuntu 20.04.2 LTS
Python: 3.8.10 (default, Jun 4 2021, 15:09:15) [GCC 7.5.0]
Qt: 5.15.2
PyQt5: 5.15.4
NumPy: 1.21.0
SciPy: 1.7.0
Dask: 2021.05.1
VisPy: 0.7.0
OpenGL:
- GL version: 4.6.0 NVIDIA 460.73.01
- MAX_TEXTURE_SIZE: 32768
Screens:
- screen 1: resolution 3440x1440, scale 1.0
Plugins:
- console: 0.0.3
- napari-dexp: 0.0.1.dev1
- napari-ibacktracker: 0.1.dev20+gb5119c1
- napari-interactive-segm: 0.1.dev3+g23d71b8.d20210712
- napari-simple-crop: 0.1.dev3+g1852e97
- scikit-image: 0.4.10
- svg: 0.1.5
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 15 (15 by maintainers)
oh you know what, I think this is also related to https://github.com/napari/napari/issues/2925 the main point there is that when the console is open, our “_ipython_has_eventloop” logic gets confused, and it no longer blocks on the event loop. Can you confirm this for me? first try
pip uninstall napari-console
(you can reinstall it afterwards) and tell me if that fixes it? Then, reinstallnapari-console
, make certain that you haven’t left the console open in the napari window, and then try again?