diff --git a/.binder/environment.yml b/.binder/environment.yml
index 13b6b99e6fc..b49b81efbc9 100644
--- a/.binder/environment.yml
+++ b/.binder/environment.yml
@@ -31,6 +31,7 @@ dependencies:
- rasterio
- scipy
- seaborn
+ - setuptools
- sparse
- toolz
- xarray
diff --git a/ci/requirements/doc.yml b/ci/requirements/doc.yml
index a8b72dc0956..d8fb10fed10 100644
--- a/ci/requirements/doc.yml
+++ b/ci/requirements/doc.yml
@@ -20,6 +20,7 @@ dependencies:
- pandas
- rasterio
- seaborn
+ - setuptools
- sphinx
- sphinx_rtd_theme
- zarr
diff --git a/ci/requirements/py36-bare-minimum.yml b/ci/requirements/py36-bare-minimum.yml
index ca491ad4897..00fef672855 100644
--- a/ci/requirements/py36-bare-minimum.yml
+++ b/ci/requirements/py36-bare-minimum.yml
@@ -10,3 +10,4 @@ dependencies:
- pytest-env
- numpy=1.15
- pandas=0.25
+ - setuptools=41.2
diff --git a/ci/requirements/py36-min-all-deps.yml b/ci/requirements/py36-min-all-deps.yml
index d6e1f3082bb..2781e551f23 100644
--- a/ci/requirements/py36-min-all-deps.yml
+++ b/ci/requirements/py36-min-all-deps.yml
@@ -43,6 +43,7 @@ dependencies:
- rasterio=1.0
- scipy=1.3
- seaborn=0.9
+ - setuptools=41.2
# - sparse # See py36-min-nep18.yml
- toolz=0.10
- zarr=2.3
diff --git a/ci/requirements/py36-min-nep18.yml b/ci/requirements/py36-min-nep18.yml
index 3dac1d624dc..286b11c0de1 100644
--- a/ci/requirements/py36-min-nep18.yml
+++ b/ci/requirements/py36-min-nep18.yml
@@ -16,4 +16,5 @@ dependencies:
- pytest-cov
- pytest-env
- scipy=1.2
+ - setuptools=41.2
- sparse=0.8
diff --git a/ci/requirements/py36.yml b/ci/requirements/py36.yml
index 929a36295a0..b8f885c864a 100644
--- a/ci/requirements/py36.yml
+++ b/ci/requirements/py36.yml
@@ -39,6 +39,7 @@ dependencies:
- rasterio
- scipy
- seaborn
+ - setuptools
- sparse
- toolz
- zarr
diff --git a/ci/requirements/py37-windows.yml b/ci/requirements/py37-windows.yml
index 8755ea2cef6..7990c9a5899 100644
--- a/ci/requirements/py37-windows.yml
+++ b/ci/requirements/py37-windows.yml
@@ -39,6 +39,7 @@ dependencies:
- rasterio
- scipy
- seaborn
+ - setuptools
- sparse
- toolz
- zarr
diff --git a/ci/requirements/py37.yml b/ci/requirements/py37.yml
index dd3267abe4c..dba3926596e 100644
--- a/ci/requirements/py37.yml
+++ b/ci/requirements/py37.yml
@@ -39,6 +39,7 @@ dependencies:
- rasterio
- scipy
- seaborn
+ - setuptools
- sparse
- toolz
- zarr
diff --git a/ci/requirements/py38.yml b/ci/requirements/py38.yml
index 9698e3efecf..d73d2397ce9 100644
--- a/ci/requirements/py38.yml
+++ b/ci/requirements/py38.yml
@@ -3,6 +3,7 @@ channels:
- conda-forge
dependencies:
- python=3.8
+ - setuptools
- pip
- pip:
- coveralls
diff --git a/doc/installing.rst b/doc/installing.rst
index 5c39f9a3c49..1635c06d5db 100644
--- a/doc/installing.rst
+++ b/doc/installing.rst
@@ -7,6 +7,7 @@ Required dependencies
---------------------
- Python (3.6 or later)
+- setuptools
- `numpy `__ (1.15 or later)
- `pandas `__ (0.25 or later)
diff --git a/doc/whats-new.rst b/doc/whats-new.rst
index f8ac959f0ad..003c60d8ef8 100644
--- a/doc/whats-new.rst
+++ b/doc/whats-new.rst
@@ -129,6 +129,8 @@ Bug fixes
- Allow plotting of binned coordinates on the y axis in :py:meth:`plot.line`
and :py:meth:`plot.step` plots (:issue:`3571`,
:pull:`3685`) by `Julien Seguinot `_.
+- setuptools is now marked as a dependency of xarray
+ (:pull:`3628`) by `Richard Höchenberger `_.
Documentation
~~~~~~~~~~~~~
diff --git a/requirements.txt b/requirements.txt
index 17de1e6f26a..f73887ff5cc 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -4,3 +4,4 @@
numpy >= 1.15
pandas >= 0.25
+setuptools >= 41.2
diff --git a/setup.cfg b/setup.cfg
index e336f46e68c..3ccb431786b 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -81,7 +81,10 @@ python_requires = >=3.6
install_requires =
numpy >= 1.15
pandas >= 0.25
-setup_requires = setuptools_scm
+ setuptools >= 41.2 # For pkg_resources
+setup_requires =
+ setuptools >= 41.2
+ setuptools_scm
[options.package_data]
xarray =
diff --git a/xarray/__init__.py b/xarray/__init__.py
index 44dc66411c4..331d8ecb09a 100644
--- a/xarray/__init__.py
+++ b/xarray/__init__.py
@@ -1,3 +1,5 @@
+import pkg_resources
+
from . import testing, tutorial, ufuncs
from .backends.api import (
load_dataarray,
@@ -27,11 +29,9 @@
from .util.print_versions import show_versions
try:
- import pkg_resources
-
__version__ = pkg_resources.get_distribution("xarray").version
except Exception:
- # Local copy, not installed with setuptools, or setuptools is not available.
+ # Local copy or not installed with setuptools.
# Disable minimum version checks on downstream libraries.
__version__ = "999"