diff --git a/README.md b/README.md index e51cfe5..d62ade6 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,8 @@ Interface for using cupy in xarray, providing convenience accessors. ## Installation +> `cupy-xarray` will use an existing cupy installation, hence cupy needs to be installed manually! Please follow cupy's install instructions at . + From anaconda: ```console diff --git a/cupy_xarray/accessors.py b/cupy_xarray/accessors.py index 3f828bb..b26ee58 100644 --- a/cupy_xarray/accessors.py +++ b/cupy_xarray/accessors.py @@ -1,6 +1,16 @@ +import warnings from typing import TYPE_CHECKING, Any -import cupy as cp +try: + import cupy as cp +except ImportError as e: + warnings.warn( + "Cupy is not installed. cupy-xarray expects cupy to be manually installed. Please install " + "cupy by following the instructions at https://docs.cupy.dev/en/stable/install.html.", + ImportWarning, + stacklevel=2, + ) + raise e from xarray import ( DataArray, Dataset, diff --git a/docs/index.md b/docs/index.md index fdea96c..56f1995 100644 --- a/docs/index.md +++ b/docs/index.md @@ -16,6 +16,8 @@ CuPy-Xarray is a Python library that leverages [CuPy](https://cupy.dev/), a GPU ## Installation +> `cupy-xarray` will use an existing cupy installation, hence cupy needs to be installed manually! Please follow cupy's install instructions at . + CuPy-Xarray can be installed using `pip` or `conda`: From Conda Forge: diff --git a/pyproject.toml b/pyproject.toml index be870da..d98b3fe 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,7 +15,6 @@ classifiers = [ ] dynamic = ["version"] dependencies = [ - "cupy", "xarray>=2024.02.0", ]