From 60dfe8b9b2986adffa6aa674935bd55b2243359b Mon Sep 17 00:00:00 2001 From: Keewis Date: Sat, 15 May 2021 00:06:30 +0200 Subject: [PATCH 1/3] improve the error message when pooch is not installed --- xarray/tutorial.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/xarray/tutorial.py b/xarray/tutorial.py index 62762d29216..28c43f51118 100644 --- a/xarray/tutorial.py +++ b/xarray/tutorial.py @@ -77,8 +77,11 @@ def open_dataset( """ try: import pooch - except ImportError: - raise ImportError("using the tutorial data requires pooch") + except ImportError as e: + raise ImportError( + "tutorial.open_dataset depends on pooch to download and manage datasets." + " To proceed please install it from PyPI or conda / conda-forge." + ) from e logger = pooch.get_logger() logger.setLevel("WARNING") @@ -146,8 +149,11 @@ def open_rasterio( """ try: import pooch - except ImportError: - raise ImportError("using the tutorial data requires pooch") + except ImportError as e: + raise ImportError( + "tutorial.open_rasterio depends on pooch to download and manage datasets." + " To proceed please install it from PyPI or conda / conda-forge." + ) from e logger = pooch.get_logger() logger.setLevel("WARNING") From 20e136549eb3cb2f8975b11aee47321e1e8168ee Mon Sep 17 00:00:00 2001 From: Keewis Date: Sat, 15 May 2021 00:10:13 +0200 Subject: [PATCH 2/3] add pooch to "pip install xarray[io]" [skip-ci] --- setup.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.cfg b/setup.cfg index aea5cd11ffd..b425d1f66e0 100644 --- a/setup.cfg +++ b/setup.cfg @@ -90,6 +90,7 @@ io = cftime rasterio cfgrib + pooch ## Scitools packages & dependencies (e.g: cartopy, cf-units) can be hard to install # scitools-iris From d39d8603b272813a9a862ef2980d89807c424cf2 Mon Sep 17 00:00:00 2001 From: Keewis Date: Sat, 15 May 2021 00:41:38 +0200 Subject: [PATCH 3/3] don't mention of pypi and conda [skip-ci] --- xarray/tutorial.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xarray/tutorial.py b/xarray/tutorial.py index 28c43f51118..f74155120ab 100644 --- a/xarray/tutorial.py +++ b/xarray/tutorial.py @@ -80,7 +80,7 @@ def open_dataset( except ImportError as e: raise ImportError( "tutorial.open_dataset depends on pooch to download and manage datasets." - " To proceed please install it from PyPI or conda / conda-forge." + " To proceed please install pooch." ) from e logger = pooch.get_logger() @@ -152,7 +152,7 @@ def open_rasterio( except ImportError as e: raise ImportError( "tutorial.open_rasterio depends on pooch to download and manage datasets." - " To proceed please install it from PyPI or conda / conda-forge." + " To proceed please install pooch." ) from e logger = pooch.get_logger()