Skip to content

Commit

Permalink
Let user decide which cupy version to use (#67)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
3 people authored Nov 27, 2024
1 parent 2031022 commit 3f84de0
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://docs.cupy.dev/en/stable/install.html>.
From anaconda:

```console
Expand Down
12 changes: 11 additions & 1 deletion cupy_xarray/accessors.py
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
2 changes: 2 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://docs.cupy.dev/en/stable/install.html>.
CuPy-Xarray can be installed using `pip` or `conda`:

From Conda Forge:
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ classifiers = [
]
dynamic = ["version"]
dependencies = [
"cupy",
"xarray>=2024.02.0",
]

Expand Down

0 comments on commit 3f84de0

Please sign in to comment.