xarray itself is a pure Python package, but its dependencies are not. The
easiest way to get everything installed is to use conda. To install xarray
with its recommended dependencies using the conda command line tool:

$ conda install xarray dask netCDF4 bottleneck

We recommend using the community maintained conda-forge channel if you need difficult-to-build dependencies such as cartopy, pynio or PseudoNetCDF:

$ conda install -c conda-forge xarray cartopy pynio pseudonetcdf

New releases may also appear in conda-forge before being updated in the default
channel.

If you don’t use conda, be sure you have the required dependencies (numpy and
pandas) installed first. Then, install xarray with pip:

Xarray plans to drop support for python 2.7 at the end of 2018. This
means that new releases of xarray published after this date will only be
installable on python 3+ environments, but older versions of xarray will
always be available to python 2.7 users. For more information see the
following references: