pydata / xarray

N-D labeled arrays and datasets in Python
https://xarray.dev
Apache License 2.0
3.65k stars 1.09k forks source link

'module' object has no attribute 'AxisError' #2483

Closed am-thyst closed 6 years ago

am-thyst commented 6 years ago

Just upgraded all of my packages through conda update --all and then got this error when importing xarray:

Traceback (most recent call last):
  File "/var/spool/torque/mom_priv/jobs/63530.rdf-xcat.SC", line 11, in <module>
    import xarray as xr
  File "/nerc/n02/n02/amethyst/.conda/envs/my_root/lib/python3.4/site-packages/xarray/__init__.py", line 10, in <module>
    from .core.alignment import align, broadcast, broadcast_arrays
  File "/nerc/n02/n02/amethyst/.conda/envs/my_root/lib/python3.4/site-packages/xarray/core/alignment.py", line 11, in <module>
    from .indexing import get_indexer_nd
  File "/nerc/n02/n02/amethyst/.conda/envs/my_root/lib/python3.4/site-packages/xarray/core/indexing.py", line 11, in <module>
    from . import duck_array_ops, nputils, utils
  File "/nerc/n02/n02/amethyst/.conda/envs/my_root/lib/python3.4/site-packages/xarray/core/duck_array_ops.py", line 22, in <module>
    from . import dask_array_compat
  File "/nerc/n02/n02/amethyst/.conda/envs/my_root/lib/python3.4/site-packages/xarray/core/dask_array_compat.py", line 47, in <module>
    AxisError = np.AxisError
AttributeError: 'module' object has no attribute 'AxisError'

May be relevant, when I do conda list, I get two versions of xarray:

xarray                    0.10.9                    <pip>
xarray                    0.8.2                    py34_0
max-sixty commented 6 years ago

Thanks for the issue @am-thyst

Could you uninstall both, and then reinstall?

If that doesn't work, please could you follow the steps on the issue template around listing dependencies?

jhamman commented 6 years ago

It also looks like you are running a pretty old version of python (3.4). We recently dropped support for this version of Python.

These sorts of things are often easiest to debug with the output of xr.show_versions().

am-thyst commented 6 years ago

@max-sixty @jhamman thanks for your replies, I uninstalled both versions of xarray that I had, tried (unsuccessfully # All requested packages already installed.) to update Python, then reinstalled xarray via conda install -c anaconda xarray, to which the import worked but gave:

/nerc/n02/n02/amethyst/.conda/envs/my_root/lib/python3.4/importlib/_bootstrap.py:321: FutureWarning: The pandas.tslib module is deprecated and will be removed in a future version.
  return f(*args, **kwds)

The version of xarray installed is 0.8.2, which just won't seem to update to a newer version. Could be something to do with the fact I'm using Miniconda? Anyway, as long as it works for now. Is this likely to cause problems for me along the line?

fmaussion commented 6 years ago

@am-thyst you are using a relatively old version of python (3.4), and the conda packages are probably not being updated anymore.

Using miniconda is fine, especially if you use conda forge (conda config --add channels conda-forge).

If you want to stay up to date in the future, define a new environment with a newer version of python (3.7 is the latest) and install your packages from there:

conda config --add channels conda-forge
conda create -n myenv python=3.7
source activate myenv (linux/mac) or activate myenv (windows)
conda install xarray

Doc: https://conda.io/docs/user-guide/tasks/manage-environments.html

am-thyst commented 6 years ago

@fmaussion Thank you, I'm trying this now. I actually just came back to this thread to edit my original reply - xarray 0.8 won't cut it for me because I need to use features from 0.10

That conda update --all really took me a few steps backwards! Hopefully the new environment will work better.

Edit: Solved, thank you