timothydmorton / isochrones

Pythonic stellar model grid access; easy MCMC fitting of stellar properties
http://isochrones.readthedocs.org
MIT License
117 stars 63 forks source link

Nosetests/Quick guide issues - Unable to open/create file '.h5' files #150

Open gmedinat opened 3 years ago

gmedinat commented 3 years ago

Dear all,

as a sort of continuation of the issue #81started by the user elisabethadams (https://github.com/timothydmorton/isochrones/issues/81), I added a reply since I have been having similar problems (here). I decided to start a new issue to give it more visibility, so I hope thats not a problem.

Has anybody found a solution for Isochrones not finding ".h5" files?

As I mentioned already, I had similar problems as those presented by elisabethadams, and they occur when I do the nosetests isochrones test, and when following the instructions of the Quick Start guide. The problem seems to appear when I use tracks.generate, and this is an extract of the shell output:

Traceback (most recent call last):
  File "quickstart_ISOCHRONES.py", line 58, in <module>
    df = tracks.generate(masses, age, feh, distance=distance, AV=AV)
  File "/home/User/anaconda3/envs/isochrones/lib/python3.8/site-packages/isochrones/models.py", line 604, in generate
    eeps = self.get_eep(mass, age, feh, **kwargs)
  File "/home/User/anaconda3/envs/isochrones/lib/python3.8/site-packages/isochrones/models.py", line 535, in get_eep
    grid.masses,
  File "/home/User/anaconda3/envs/isochrones/lib/python3.8/site-packages/isochrones/mist/models.py", line 189, in masses
    self._masses = np.array(self.df.index.levels[1])
  File "/home/User/anaconda3/envs/isochrones/lib/python3.8/site-packages/isochrones/mist/models.py", line 398, in df
    self._df = self.read_hdf()
  File "/home/User/anaconda3/envs/isochrones/lib/python3.8/site-packages/isochrones/grid.py", line 109, in read_hdf
    df = self.write_hdf(orig=orig)
  File "/home/User/anaconda3/envs/isochrones/lib/python3.8/site-packages/isochrones/grid.py", line 113, in write_hdf
    df = self.get_df(orig=orig)
  File "/home/User/anaconda3/envs/isochrones/lib/python3.8/site-packages/isochrones/models.py", line 114, in get_df
    df = self.df_all()
  File "/home/User/anaconda3/envs/isochrones/lib/python3.8/site-packages/isochrones/mist/models.py", line 392, in df_all
    df = pd.concat([self.df_all_feh_interpolated(feh) for feh in self.fehs])
  File "/home/User/anaconda3/envs/isochrones/lib/python3.8/site-packages/isochrones/mist/models.py", line 392, in <listcomp>
    df = pd.concat([self.df_all_feh_interpolated(feh) for feh in self.fehs])
  File "/home/User/anaconda3/envs/isochrones/lib/python3.8/site-packages/isochrones/mist/models.py", line 323, in df_all_feh_interpolated
    df_interp = pd.read_hdf(hdf_filename, "df")
  File "/home/User/anaconda3/envs/isochrones/lib/python3.8/site-packages/pandas/io/pytables.py", line 397, in read_hdf
    store = HDFStore(path_or_buf, mode=mode, errors=errors, **kwargs)
  File "/home/User/anaconda3/envs/isochrones/lib/python3.8/site-packages/pandas/io/pytables.py", line 537, in __init__
    self.open(mode=mode, **kwargs)
  File "/home/User/anaconda3/envs/isochrones/lib/python3.8/site-packages/pandas/io/pytables.py", line 687, in open
    raise IOError(str(err))
OSError: HDF5 error back trace

  File "H5F.c", line 509, in H5Fopen
    unable to open file
  File "H5Fint.c", line 1400, in H5F__open
    unable to open file
  File "H5Fint.c", line 1709, in H5F_open
    unable to read root group
  File "H5Groot.c", line 239, in H5G_mkroot
    can't check if symbol table message exists
  File "H5Omessage.c", line 883, in H5O_msg_exists
    unable to protect object header
  File "H5Oint.c", line 1100, in H5O_protect
    unable to load object header
  File "H5AC.c", line 1625, in H5AC_protect
    H5C_protect() failed
  File "H5C.c", line 2362, in H5C_protect
    can't load entry
  File "H5C.c", line 6712, in H5C_load_entry
    incorrect metadatda checksum after all read attempts
  File "H5Ocache.c", line 219, in H5O__cache_get_final_load_size
    can't deserialize object header prefix
  File "H5Ocache.c", line 1231, in H5O__prefix_deserialize
    bad object header version number

End of HDF5 error back trace

Unable to open/create file '/home/User/.isochrones/mist/tracks/MIST_v1.2_feh_m0.25_afe_p0.0_vvcrit0.4_EEPS/all_masses_interpolated.h5'

I installed Isochrones via:

conda create -n isochrones numpy numba nose pytables pandas
conda activate isochrones
pip install isochrones

and tried installing older versions of numpy, numba, and pandas to solve the problem (1.18.5, 0.50.1 and 1.0.5, respectively), but that didn't work either. The python version installed in the Isochrones conda environment is 3.8.5.

tylerry commented 3 years ago

I had the same issue.

In an attempt to fix it, I accidentally crashed python and was forced to reinstall astroconda. After doing that, I followed the same steps as how you installed isochrones and it worked for me. I was able to also download and run the stardate program after this as well.

Sorry that's not more specific!

seawander commented 3 years ago

I had same issue today (installed via pip, not Conda), and fixed by downloading the data at https://zenodo.org/record/4056544 to ~/.isochrone, the data structure is now ~/.isochrone/mist/tracks/xxxx/xxxx.

I think the problem is that official MIST release at http://waps.cfa.harvard.edu/MIST/model_grids.html, as of today (Feb 19, 2021), does not contain .h5 files. Or there might be a recent change which the isochrone package is out of sync.