napari: slow imports
🐛 Bug
@cgohlke has identified some causes of the slowness of our vispy and other imports - see here https://github.com/vispy/vispy/issues/1779 and also this comment from @larsoner https://github.com/vispy/vispy/issues/1779#issuecomment-561305146 related to the use of pkg_resources
and asking if we can maybe
nest the triangle, docutils, and sphinx imports
We should definitely look into doing what we can on our end to improve things too. We can collect ideas here.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 15 (14 by maintainers)
if xarray is heavy, we should probably use a different check for whether something is an xarray here:
https://github.com/napari/napari/blob/68822f8f2ef618cc727442bc5c1a35e70198aa64/napari/utils/misc.py#L419-L425
that will get run all the time
The slow vispy import has been fixed. The numpydoc/sphinx bottleneck is being addressed at https://github.com/numpy/numpydoc/pull/248. On this Windows workstation,
import napari
decreased from ~5.8 s to 2.4 s after fixing vispy, triangle, and docutils.Some other significant imports: