pwprnt
pwprnt

Reputation: 561

how do I update xarray?

How can I update xarray? I tried:

>>> import xarray
>>> xarray.show_versions
<function show_versions at 0x7fcfaf2aa820>

But I cannot find any documentation how to read this, or how to update to a new version of xarray.
I was not the person to install it on the computer, so I do not know if it was through anaconda or something else. Is there a way to find this out?

Upvotes: 0

Views: 4465

Answers (2)

Ranjan Kumar Sahu
Ranjan Kumar Sahu

Reputation: 73

This is for those who want to do through GUI and who use software like pycharm, spyder, or other similar softwares. SO, try finding 'python interpreter' in the settings. Most softwares shows the existing packages, current version,latest version(for example see the image of pycharm)There is option to select the version that you want. for example there are times, when a module is in its beta phase and is not stable in usage. so, you can specify the latest stable version too.

There is option to select the version that you want. for example there are times, when a module is in its beta phase and is not stable in usage. so, you can specify the latest stable version too. It is applicable for any module and not limited to xarray.

Upvotes: -1

Val
Val

Reputation: 7033

xarray.show_versions is a function, which prints the versions of xarray and its dependencies.

To get just the version of xarray, you can check the __version__ property of the module.

Updating xarray is best done with pip or conda, depending on how you installed it in the first place.

import xarray as xr

print(xr.__version__)
# '0.18.2'

xr.show_versions()
INSTALLED VERSIONS
------------------
commit: None
python: 3.8.8 (default, Feb 19 2021, 18:07:06) 
[GCC 8.3.0]
python-bits: 64
OS: Linux
OS-release: 5.11.0-27-generic
machine: x86_64
processor: 
byteorder: little
LC_ALL: C.UTF-8
LANG: C.UTF-8
LOCALE: ('en_US', 'UTF-8')
libhdf5: 1.12.0
libnetcdf: 4.7.4

xarray: 0.18.2
pandas: 1.2.4
numpy: 1.20.3
scipy: 1.6.3
netCDF4: 1.5.6
pydap: None
h5netcdf: None
h5py: None
Nio: None
zarr: 2.8.3
cftime: 1.5.0
nc_time_axis: None
PseudoNetCDF: None
rasterio: 1.2.3
cfgrib: None
iris: None
bottleneck: 1.3.2
dask: 2021.05.0
distributed: 2021.05.0
matplotlib: 3.4.2
cartopy: None
seaborn: None
numbagg: None
pint: None
setuptools: 53.0.0
pip: 21.1.1
conda: None
pytest: None
IPython: 7.23.1
sphinx: None

To update xarray:

pip install --upgrade xarray

or

conda update xarray

To see if it was installed using conda or pip, run conda list xarray. If it was installed using pip, it should state pypi in the Channel column.

Upvotes: 3

Related Questions