-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Installing xarray-leaflet causes jupyter server to be really slow to start #79
Comments
Panel and Xarray-Leaflet are heavy enough imports that without .pyc files, they sometimes together take as much as 15s to import?! This causes jupyterhub to fail startup in some cases. The longer term fix is in panel and xarray-leaflet ( see holoviz/panel#4271, xarray-contrib/xarray_leaflet#79). In the meantime, leaving the .pyc files in place doesn't increase the image size by much, but makes startup definitely much faster! Ref 2i2c-org/infrastructure#2047
I opened jupyter-server/jupyter_server#1171 to make this information available more easily. |
Thanks for reporting the issue @yuvipanda. |
@davidbrochart yep that would seem to be the solution |
Actually xarray-leaflet doesn't import rioxarray. It depends on it and it uses properties of xarray's DataArray that exist because the array was opened with rioxarray, but that's external to xarray-leaflet. |
sorry i misspoke, i meant https://github.com/xarray-contrib/xarray_leaflet/blob/main/xarray_leaflet/xarray_leaflet.py#L16 and rasterio as one of the culprits, not rioxarray. I think IPython is the other big culprit - moving those to be imported just before use might help? |
Actually there is not need to import |
@davidbrochart right, I'm not sure if a breaking change is desired - I don't know how far along the xarray-leaflet project is. Another option is to split the serverextension into its own module perhaps? It could ship by default with xarray-leaflet, maybe even as part of the same package, but just be a different module? |
Thanks, that's what I did in #80, and I released v0.2.2 with these changes. |
Thank you so much for your quick work on this, @davidbrochart! |
Brings in xarray-contrib/xarray_leaflet#79, which speeds up container startup quite a bit!
Brings in xarray-contrib/xarray_leaflet#79, which speeds up container startup quite a bit!
On a fresh install (no .pyc files), just importing xarray_leaflet takes about 9s:
As this is imported each time jupyter server is started, the user can not see their notebook until this initialization is complete. When coupled with other slow loading extensions (such as panel holoviz/panel#4271), this can cause server starts to time out in JupyterHubs. There is no way to disable this (jupyter server will still import your package even if it is disabled), so the only way to get a faster startup is to uninstall xarray-leaflet completely.
I think a majority of the import time comes from
rioxarray
The text was updated successfully, but these errors were encountered: