-
Notifications
You must be signed in to change notification settings - Fork 31
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
ImportError: sys.meta_path is None, Python is likely shutting down #50
Comments
xr.show_versions() INSTALLED VERSIONScommit: None xarray: 0.11.0 |
Could you share a fully reproducible example, including a copy of the netcdf file or code to create it? |
I would also suggest trying out xarray 0.11.2, which includes some fixes related to this functionality. |
Is this still active? I do get the same error:
Using lay_dat = xr.open_mfdataset(files.values(), engine='h5netcdf', concat_dim=Dim.it, combine='nested') A within a function always raises the error, using I have to my knowledge the most recent versions installed: INSTALLED VERSIONS
------------------
commit: None
python: 3.7.3 (default, Mar 27 2019, 22:11:17)
[GCC 7.3.0]
python-bits: 64
OS: Linux
OS-release: 3.16.0-10-amd64
machine: x86_64
processor:
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8
libhdf5: 1.10.4
libnetcdf: None
xarray: 0.14.1
pandas: 0.25.0
numpy: 1.16.4
scipy: 1.3.0
netCDF4: None
pydap: None
h5netcdf: 0.7.4
h5py: 2.10.0
Nio: None
zarr: None
cftime: None
nc_time_axis: None
PseudoNetCDF: None
rasterio: None
cfgrib: None
iris: None
bottleneck: None
dask: 2.3.0
distributed: 2.3.0
matplotlib: 3.0.3
cartopy: None
seaborn: None
numbagg: None
setuptools: 41.0.1
pip: 19.1.1
conda: 4.7.11
pytest: 5.0.1
IPython: 7.5.0
sphinx: 2.2.1 |
I now think this is a probably a bug on the xarray side. We should be automatically cleaning-up unclosed files using atexit rather than only relying on If you could share a script that reproduces the bug that would be very helpful for testing. Please file an issue in the xarray tracker and ping me. Thanks! |
Thanks for the info, I will try to come up with a minimal script this weekend and open a pull request. I see. Using I used a wrapper around the file object, having the following method: def _autoclean_load(self, *args, **kwds):
data = np.load(*args, **kwds)
finalize(self, data.close)
return data If the wrapper object is collected or the script ends in a way, such that |
It sounds like you may have looked into this in more detail than I have! Take a look here for the logic in xarray. Pull requests to improve this would be very welcome! |
Hey, I'm still running into this issue using xarray. My versions are xarray 0.15.0 and h5netcdf 0.7.4. It seems that adding @shoyer did this issue ever make it to the xarray issue tracker? I couldn't find it by searching. If it has could you reference that issue here so others who stumble upon it here can follow along there? This is the first issue that comes up when I google that |
I don't think has made it onto the xarray issue tracker yet. It would still be helpful to have a full script that reproduces the behavior for debugging potential fixes. |
@shoyer Will this be resolved with |
@floriankrb I can't reproduce this with |
I don't have the original file anymore and I cannot reproduce either. Thank you for closing this issue. |
This works :
But this does not :
The following exception message is witten on stderr when the script ends.
As far as I kow, this may be related to #21 and to the garbage collector.
Note that adding "ds.close()" removes the message.
Works as expected.
The text was updated successfully, but these errors were encountered: