-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
ds = xr.tutorial.load_dataset("air_temperature") with 0.18 needs engine argument #5291
Comments
I think there's something wrong with your environment: I can't reproduce in a environment created by
Edit: you could also try clearing |
we could definitely improve the error message, though. Something like "unknown engine {engine}, please choose one of the installed engines: {engines}", maybe? |
Thanks @keewis I should have been more clear about the environment. I was recently going over the tutorial with someone and started with:
I do think these error messages are not obvious to fix for new xarray users trying out the tutorial (especially # 3 above)
Yes. Perhaps with a link to docs with a list of engines? for the tutorial case specifically could also update the ImportError message to read |
This is indeed unfortunate, thanks for the report! I believe But if you don't have either scipy or netCDF4 installed, you get the very unhelpful error message At the very least, we should report which engines are installed -- and ideally make a specific recommendation like installing scipy or netCDF4. |
Yes and is this a problem with passing an engine? Could doing what it says ("passing one explicitly") make it work? |
Good point -- in this case specifying an engine explicitly cannot help, because the required engine is not installed. |
I would suggest three levels of fixes:
If we do a nice job of (2) than maybe (3) will not be necessary. I'll open a new issue to discuss my proposed solution for (2). |
I've added a temporary work-around to provide better errors for the tutorial datasets into #5300, i.e., solution (3) from my previouso comment. This is challenging to unit-test, so I'll just share my IPython session(s) from a new environment to show how it works:
This isn't quite perfect -- the user needs to restart their session to actually load the data -- but hopefully this is much more obvious and roughly within user expectations. |
Thanks a lot @shoyer . Is there a way of having It's a pretty light dependency, and it's unfortunate to add any sand into the gears of getting someone to the tutorial. (though an order of magnitude better since the change above) |
It is pretty light but pulls in a few additional dependencies. For normal python package managers (i.e. pip / poetry / etc.) we can probably take advantage of the We could also change the current message ("using the tutorial data requires pooch") to something like
|
Line 82 in 9e84d09
|
My question is whether we can make xarray by default pull the equivalent of |
I don't think this is possible currently with I think it can be done with |
On conda it's usually only done to avoid problematic/heavy weight dependencies (i.e. avoiding pyqt dependency with |
Thanks. Agree it's not worth that lift. |
From xarray-contrib/xarray-tutorial#43 by @scottyhq:
Many notebooks out there start with the line
ds = xr.tutorial.load_dataset("air_temperature")
. That now gives an error traceback with xarray>=0.18:It's an easy fix though, just add
ds = xr.tutorial.load_dataset("air_temperature", engine="netcdf4")
, new users might be thrown by that though. Also a note that unless thenetcdf4
library is explicitly put into the software environment, even adding the engine=netcdf4 can result in an error: "ValueError: unrecognized engine netcdf4 must be one of: ['store', 'zarr']", so I think a minimal environment definition to run would be:The text was updated successfully, but these errors were encountered: