Skip to content

Commit 3f84de0

Browse files
relativityhdpre-commit-ci[bot]weiji14
authored
Let user decide which cupy version to use (#67)
* Let user decide which cupy version to use Remove cupy from dependencies and add three extras where each requires a different cupy version: cupy (building from source), and the two prebuild cupy-cuda12x and cupy-cuda11x * Fix ruff B028 and E501 * Remove cupy install option via extras --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Wei Ji <[email protected]>
1 parent 2031022 commit 3f84de0

File tree

4 files changed

+15
-2
lines changed

4 files changed

+15
-2
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ Interface for using cupy in xarray, providing convenience accessors.
1616

1717
## Installation
1818

19+
> `cupy-xarray` will use an existing cupy installation, hence cupy needs to be installed manually! Please follow cupy's install instructions at <https://docs.cupy.dev/en/stable/install.html>.
20+
1921
From anaconda:
2022

2123
```console

cupy_xarray/accessors.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
1+
import warnings
12
from typing import TYPE_CHECKING, Any
23

3-
import cupy as cp
4+
try:
5+
import cupy as cp
6+
except ImportError as e:
7+
warnings.warn(
8+
"Cupy is not installed. cupy-xarray expects cupy to be manually installed. Please install "
9+
"cupy by following the instructions at https://docs.cupy.dev/en/stable/install.html.",
10+
ImportWarning,
11+
stacklevel=2,
12+
)
13+
raise e
414
from xarray import (
515
DataArray,
616
Dataset,

docs/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ CuPy-Xarray is a Python library that leverages [CuPy](https://cupy.dev/), a GPU
1616

1717
## Installation
1818

19+
> `cupy-xarray` will use an existing cupy installation, hence cupy needs to be installed manually! Please follow cupy's install instructions at <https://docs.cupy.dev/en/stable/install.html>.
20+
1921
CuPy-Xarray can be installed using `pip` or `conda`:
2022

2123
From Conda Forge:

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ classifiers = [
1515
]
1616
dynamic = ["version"]
1717
dependencies = [
18-
"cupy",
1918
"xarray>=2024.02.0",
2019
]
2120

0 commit comments

Comments
 (0)