timothydmorton / isochrones

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

problem with pandas? #149

Open rlopezsastre opened 3 years ago

rlopezsastre commented 3 years ago

Hi all, I'm trying with a fresh new conda environment following the instructions in the documentation: conda create -n isochrones numpy numba nose pytables pandas conda activate isochrones pip install isochrones

All goes smoothly, and then I run the following example:

from isochrones import get_ichrone mist = get_ichrone('mist') mist.initialize()

The following error appears:

Holoviews not imported. Some visualizations will not be available. Backend TkAgg is interactive backend. Turning interactive mode on. /home/rober/local/miniconda2/envs/isochrones/lib/python3.8/site-packages/pandas/core/series.py:679: RuntimeWarning: divide by zero encountered in log10 result = getattr(ufunc, method)(*inputs, **kwargs) /home/rober/local/miniconda2/envs/isochrones/lib/python3.8/site-packages/pandas/core/indexing.py:965: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy self.obj[item] = s Traceback (most recent call last): File "/home/rober/local/miniconda2/envs/isochrones/lib/python3.8/site-packages/pandas/core/indexes/base.py", line 2646, in get_loc return self._engine.get_loc(key) File "pandas/_libs/index.pyx", line 111, in pandas._libs.index.IndexEngine.get_loc File "pandas/_libs/index.pyx", line 138, in pandas._libs.index.IndexEngine.get_loc File "pandas/_libs/hashtable_class_helper.pxi", line 1618, in pandas._libs.hashtable.PyObjectHashTable.get_item File "pandas/_libs/hashtable_class_helper.pxi", line 1626, in pandas._libs.hashtable.PyObjectHashTable.get_item KeyError: 0.0

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/rober/local/miniconda2/envs/isochrones/lib/python3.8/site-packages/isochrones/models.py", line 419, in interp_mag self.model_grid.interp.grid, File "/home/rober/local/miniconda2/envs/isochrones/lib/python3.8/site-packages/isochrones/grid.py", line 136, in interp self._interp = DFInterpolator(self.df, filename=filename, is_full=self.is_full) File "/home/rober/local/miniconda2/envs/isochrones/lib/python3.8/site-packages/isochrones/models.py", line 159, in df self._df["dm_deep"] = self.get_dm_deep() File "/home/rober/local/miniconda2/envs/isochrones/lib/python3.8/site-packages/isochrones/models.py", line 146, in get_dm_deep subdf = df.loc[f, a] File "/home/rober/local/miniconda2/envs/isochrones/lib/python3.8/site-packages/pandas/core/indexing.py", line 1761, in getitem return self._getitem_tuple(key) File "/home/rober/local/miniconda2/envs/isochrones/lib/python3.8/site-packages/pandas/core/indexing.py", line 1271, in _getitem_tuple return self._getitem_lowerdim(tup) File "/home/rober/local/miniconda2/envs/isochrones/lib/python3.8/site-packages/pandas/core/indexing.py", line 1420, in _getitem_lowerdim return getattr(section, self.name)[new_key] File "/home/rober/local/miniconda2/envs/isochrones/lib/python3.8/site-packages/pandas/core/indexing.py", line 1761, in getitem return self._getitem_tuple(key) File "/home/rober/local/miniconda2/envs/isochrones/lib/python3.8/site-packages/pandas/core/indexing.py", line 1271, in _getitem_tuple return self._getitem_lowerdim(tup) File "/home/rober/local/miniconda2/envs/isochrones/lib/python3.8/site-packages/pandas/core/indexing.py", line 1372, in _getitem_lowerdim return self._getitem_nested_tuple(tup) File "/home/rober/local/miniconda2/envs/isochrones/lib/python3.8/site-packages/pandas/core/indexing.py", line 1452, in _getitem_nested_tuple obj = getattr(obj, self.name)._getitem_axis(key, axis=axis) File "/home/rober/local/miniconda2/envs/isochrones/lib/python3.8/site-packages/pandas/core/indexing.py", line 1964, in _getitem_axis return self._get_label(key, axis=axis) File "/home/rober/local/miniconda2/envs/isochrones/lib/python3.8/site-packages/pandas/core/indexing.py", line 624, in _get_label return self.obj._xs(label, axis=axis) File "/home/rober/local/miniconda2/envs/isochrones/lib/python3.8/site-packages/pandas/core/generic.py", line 3529, in xs return self[key] File "/home/rober/local/miniconda2/envs/isochrones/lib/python3.8/site-packages/pandas/core/frame.py", line 2800, in getitem indexer = self.columns.get_loc(key) File "/home/rober/local/miniconda2/envs/isochrones/lib/python3.8/site-packages/pandas/core/indexes/base.py", line 2648, in get_loc return self._engine.get_loc(self._maybe_cast_indexer(key)) File "pandas/_libs/index.pyx", line 111, in pandas._libs.index.IndexEngine.get_loc File "pandas/_libs/index.pyx", line 138, in pandas._libs.index.IndexEngine.get_loc File "pandas/_libs/hashtable_class_helper.pxi", line 1618, in pandas._libs.hashtable.PyObjectHashTable.get_item File "pandas/_libs/hashtable_class_helper.pxi", line 1626, in pandas._libs.hashtable.PyObjectHashTable.get_item KeyError: 0

Details of my environment: OS -> Ubuntu 18.04 conda list for the isochrones env -> Name Version Build Channel _libgcc_mutex 0.1 main
asciitree 0.3.3 pypi_0 pypi astropy 4.2 pypi_0 pypi astroquery 0.4.1 pypi_0 pypi attrs 20.3.0 pyhd3deb0d_0 conda-forge beautifulsoup4 4.9.3 pypi_0 pypi blosc 1.20.1 he1b5a44_0 conda-forge brotlipy 0.7.0 py38h8df0ef7_1001 conda-forge bzip2 1.0.8 h516909a_3 conda-forge c-ares 1.17.1 h36c2ea0_0 conda-forge ca-certificates 2020.12.5 ha878542_0 conda-forge certifi 2020.12.5 py38h578d9bd_0 conda-forge cffi 1.14.4 py38ha312104_0 conda-forge chardet 3.0.4 py38h924ce5b_1008 conda-forge codecov 2.1.10 pyh9f0ad1d_0 conda-forge configobj 5.0.6 pypi_0 pypi corner 2.1.0 pypi_0 pypi coverage 5.3 py38h1e0a361_1 conda-forge cryptography 3.1.1 py38h1ba5d50_0
cycler 0.10.0 py_2 conda-forge cython 0.29.21 py38h348cfbe_1 conda-forge emcee 3.0rc2 pypi_0 pypi flaky 3.7.0 pypi_0 pypi freetype 2.10.4 h7ca028e_0 conda-forge h5py 3.1.0 pypi_0 pypi hdf5 1.10.6 nompi_h7c3c948_1111 conda-forge html5lib 1.1 pypi_0 pypi idna 2.10 pyh9f0ad1d_0 conda-forge iniconfig 1.1.1 pyh9f0ad1d_0 conda-forge isochrones 2.1 pypi_0 pypi jeepney 0.6.0 pypi_0 pypi jpeg 9d h36c2ea0_0 conda-forge keyring 21.5.0 pypi_0 pypi kiwisolver 1.3.1 py38h82cb98a_0 conda-forge krb5 1.17.2 h926e7f8_0 conda-forge lcms2 2.11 hcbb858e_1 conda-forge libblas 3.9.0 3_openblas conda-forge libcblas 3.9.0 3_openblas conda-forge libcurl 7.71.1 hcdd3856_8 conda-forge libedit 3.1.20191231 h14c3975_1
libev 4.33 h516909a_1 conda-forge libffi 3.2.1 hf484d3e_1007
libgcc-ng 9.1.0 hdf63c60_0
libgfortran-ng 7.5.0 hae1eefd_17 conda-forge libgfortran4 7.5.0 hae1eefd_17 conda-forge liblapack 3.9.0 3_openblas conda-forge libllvm10 10.0.1 he513fc3_3 conda-forge libnghttp2 1.41.0 h8cfc5f6_2 conda-forge libopenblas 0.3.12 pthreads_hb3c22a3_1 conda-forge libpng 1.6.37 h21135ba_2 conda-forge libssh2 1.9.0 hab1572f_5 conda-forge libstdcxx-ng 9.1.0 hdf63c60_0
libtiff 4.1.0 h4f3a223_6 conda-forge libwebp-base 1.1.0 h36c2ea0_3 conda-forge llvmlite 0.34.0 py38h269e1b5_4
lz4-c 1.9.2 he1b5a44_3 conda-forge lzo 2.10 h516909a_1000 conda-forge matplotlib-base 3.3.3 py38h5c7f4ab_0 conda-forge mock 4.0.3 py38h578d9bd_0 conda-forge more-itertools 8.6.0 pyhd8ed1ab_0 conda-forge mpi 1.0 mpich conda-forge mpich 3.3.2 h846660c_5 conda-forge multinest 3.10 h9fb99a1_8 conda-forge ncurses 6.2 he6710b0_1
numba 0.51.2 py38hc5bc63f_0 conda-forge numexpr 2.7.1 py38hc5bc63f_3 conda-forge numpy 1.19.4 py38hf0fd68c_1 conda-forge olefile 0.46 pyh9f0ad1d_1 conda-forge openssl 1.1.1h h516909a_0 conda-forge packaging 20.7 pyhd3deb0d_0 conda-forge pandas 1.0.1 py38hb3f55d8_0 conda-forge pillow 8.0.1 py38h70fbd49_0 conda-forge pip 20.3.1 py38h06a4308_0
pluggy 0.13.1 py38h924ce5b_3 conda-forge py 1.9.0 pyh9f0ad1d_0 conda-forge pycparser 2.20 pyh9f0ad1d_2 conda-forge pyerfa 1.7.1.1 pypi_0 pypi pymultinest 2.10 py38h32f6830_1 conda-forge pyopenssl 19.1.0 py38_0 conda-forge pyparsing 2.4.7 pyh9f0ad1d_0 conda-forge pysocks 1.7.1 py38h924ce5b_2 conda-forge pytables 3.6.1 py38hf9f05d5_3 conda-forge pytest 6.1.2 py38h578d9bd_0 conda-forge python 3.8.0 h0371630_2
python-dateutil 2.8.1 py_0 conda-forge python_abi 3.8 1_cp38 conda-forge pytz 2020.4 pyhd8ed1ab_0 conda-forge readline 7.0 h7b6447c_5
requests 2.25.0 pyhd3deb0d_0 conda-forge scipy 1.5.3 py38h828c644_0 conda-forge secretstorage 3.3.0 pypi_0 pypi setuptools 51.0.0 py38h06a4308_2
setuptools-scm 4.1.2 pypi_0 pypi six 1.15.0 pyh9f0ad1d_0 conda-forge soupsieve 2.1 pypi_0 pypi sqlite 3.33.0 h62c20be_0
tk 8.6.10 hbc83047_0
toml 0.10.2 pyhd8ed1ab_0 conda-forge tornado 6.1 py38h25fe258_0 conda-forge tqdm 4.54.1 pypi_0 pypi urllib3 1.25.11 py_0 conda-forge webencodings 0.5.1 pypi_0 pypi wheel 0.36.1 pyhd3eb1b0_0
xz 5.2.5 h7b6447c_0
zlib 1.2.11 h7b6447c_3
zstd 1.4.5 h6597ccf_2 conda-forge

I've also tried to follow the instructions suggested in #138

Clone master isochrones from github, make a new environment locally like this:

conda create -n isochrones python
conda activate isochrones
conda install -c conda-forge numpy numba cython pytables pandas
conda install -c conda-forge multinest pymultinest
conda install -c conda-forge pytest codecov
pip install flaky

Then install isochrones with

pip install -e .  # or python setup.py install 

Then run

mist-intialize.py
pytest -v  # from within the isochrones directory

But I obtained the same error.

Any help would be very much appreciated.

KeyiDing commented 3 years ago

Hi! By any chance have you figured out how to solve this issue? I met the same issue when I tried to install isochrones and I still can not fix it. Thanks!

rlopezsastre commented 3 years ago

We could solve it by following the installation steps in Ubuntu 20.04. Previous intent was in Ubuntu 18.04, and it seems that some versions of the packages/libraries do not properly work.

KeyiDing commented 3 years ago

Thank you!