Skip to content

Commit 93e79e6

Browse files
committed
Tutorials/Accelerated Python: Install cuDF and cuML in the main environment.
cuDF and cuML no longer have a compatibility issue with numba-cuda, so they can be installed directly in the main Python environment instead of an isolated RAPIDS venv. This removes the separate venv, its Jupyter kernel registration, and the duplicate ipykernel/pytest installs, reducing container size. Notebooks that used the RAPIDS kernel now use the standard python3 kernel, and the format checker no longer accepts or mentions the RAPIDS kernelspec.
1 parent b0e5e03 commit 93e79e6

File tree

10 files changed

+27
-70
lines changed

10 files changed

+27
-70
lines changed

brev/test-notebook-format.py

Lines changed: 5 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@
1717
the required ``name`` field).
1818
- nbformat 4, nbformat_minor 5.
1919
20-
The cuDF kernelspec is accepted as an alternative to the default ipykernel.
21-
If a notebook has any other kernelspec (or none), --fix replaces it with the
22-
default.
20+
If a notebook has any non-standard kernelspec (or none), --fix replaces it
21+
with the default.
2322
2423
Usage:
2524
./brev/test-notebook-format.py # check all tutorials
@@ -77,12 +76,6 @@
7776
STANDARD_NBFORMAT = 4
7877
STANDARD_NBFORMAT_MINOR = 5
7978

80-
CUDF_KERNELSPEC = {
81-
"display_name": "Python 3 (RAPIDS 25.10)",
82-
"language": "python",
83-
"name": "cudf-cu13-25.10",
84-
}
85-
8679
# ANSI colors
8780
RED = "\033[0;31m"
8881
GREEN = "\033[0;32m"
@@ -94,23 +87,6 @@
9487
# ---------------------------------------------------------------------------
9588

9689

97-
def has_cudf_kernelspec(metadata) -> bool:
98-
"""Check if a notebook's metadata contains the cuDF kernelspec."""
99-
ks = metadata.get("kernelspec", {})
100-
return (
101-
ks.get("display_name") == CUDF_KERNELSPEC["display_name"]
102-
and ks.get("language") == CUDF_KERNELSPEC["language"]
103-
and ks.get("name") == CUDF_KERNELSPEC["name"]
104-
)
105-
106-
107-
def get_expected_metadata(metadata) -> dict:
108-
expected = dict(STANDARD_METADATA)
109-
if has_cudf_kernelspec(metadata):
110-
expected["kernelspec"] = dict(CUDF_KERNELSPEC)
111-
return expected
112-
113-
11490
def is_solution_notebook(notebook_path: Path) -> bool:
11591
return "SOLUTION" in notebook_path.name
11692

@@ -171,7 +147,7 @@ def canonicalize_notebook(notebook_path: Path) -> tuple[str, list[str]]:
171147

172148
# -- Detect original metadata problems before nbformat.read() -----------
173149
actual_metadata = raw.get("metadata", {})
174-
expected_metadata = get_expected_metadata(actual_metadata)
150+
expected_metadata = dict(STANDARD_METADATA)
175151
metadata_diffs = diff_metadata(actual_metadata, expected_metadata, "metadata")
176152
if metadata_diffs:
177153
problems.extend(metadata_diffs)
@@ -300,14 +276,12 @@ def check_notebook(notebook_path: Path, fix: bool) -> bool:
300276
with open(notebook_path, "r", encoding="utf-8") as f:
301277
original_text = f.read()
302278

303-
tag = "cudf" if has_cudf_kernelspec(json.loads(original_text).get("metadata", {})) else "standard"
304-
305279
if original_text == canonical_text:
306-
print(f"{GREEN}{NC} {notebook_path} ({tag})")
280+
print(f"{GREEN}{NC} {notebook_path}")
307281
return True
308282

309283
# There are problems
310-
print(f"{RED}{NC} {notebook_path} ({tag})")
284+
print(f"{RED}{NC} {notebook_path}")
311285
for p in problems:
312286
print(p)
313287

tutorials/accelerated-python/brev/dockerfile

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ ENV ACH_TUTORIAL=accelerated-python \
66
NSIGHT_SYSTEMS_DEB_FILE=2026_1/NsightSystems-linux-cli-public-2026.1.1.204-3717666.deb \
77
NSIGHT_COMPUTE_VERSION=2025.4.1 \
88
NSIGHT_COMPUTE_DEB_FILE=debian12/x86_64/nsight-compute-2025.4.1_2025.4.1.2-1_amd64.deb \
9-
ACH_RAPIDS_VENV=/opt/venvs/rapids \
109
OMPI_ALLOW_RUN_AS_ROOT=1 \
1110
OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 \
1211
PIP_ROOT_USER_ACTION=ignore \
@@ -104,20 +103,6 @@ RUN curl -L -O https://developer.nvidia.com/downloads/assets/tools/secure/nsight
104103
RUN python -m jupyter labextension disable "@jupyterlab/apputils-extension:announcements" \
105104
&& python -m jupyter labextension disable "@jupyterlab/console-extension:tracker"
106105

107-
# Create an isolated Python env with cuDF and cuML, and register it as a Jupyter kernel.
108-
RUN python -m venv ${ACH_RAPIDS_VENV} \
109-
&& ${ACH_RAPIDS_VENV}/bin/pip install --no-cache-dir \
110-
--extra-index-url=https://pypi.nvidia.com \
111-
"cudf-cu13==25.10.*" \
112-
"cuml-cu13==25.10.*" \
113-
"scikit-learn>=1.5,<1.6" \
114-
ipykernel \
115-
pytest \
116-
&& ${ACH_RAPIDS_VENV}/bin/python -m ipykernel install \
117-
--name=cudf-cu13-25.10 \
118-
--display-name="Python 3 (RAPIDS 25.10)" \
119-
--prefix=/usr/local
120-
121106
COPY . /accelerated-computing-hub
122107

123108
# Ensure accelerated-computing-hub directory is writable by any user

tutorials/accelerated-python/brev/requirements.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,16 @@ jupyterlab-execute-time == 3.3.0
1515

1616
# CUDA
1717
cuda-python == 13.1.1
18-
numba-cuda[cu13] == 0.28.2
18+
numba == 0.61.2
19+
numba-cuda[cu13] == 0.22.2
1920
nvmath-python[cu13] == 0.8.0
2021
cupy-cuda13x == 13.6.0
2122
cuda-cccl[test-cu13] == 0.4.5
2223

24+
# RAPIDS
25+
cudf-cu13 == 26.2.1
26+
cuml-cu13 == 26.2.0
27+
2328
# NVIDIA developer tools
2429
nvtx == 0.2.14
2530
nsightful[notebook] @ git+https://github.com/brycelelbach/nsightful.git@454dfa5124ebea193f64302058b327f2034ccd8e

tutorials/accelerated-python/brev/test.bash

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
#
33
# Run tests for the accelerated-python tutorial.
44
#
5-
# When called with no arguments, runs all three test suites (packages, RAPIDS,
6-
# notebooks). When called with arguments:
5+
# When called with no arguments, runs both test suites (packages, notebooks).
6+
# When called with arguments:
77
# - Bare words (e.g. "03") are treated as a pytest -k filter for notebook tests.
88
# - Paths or flags (e.g. "test/test_packages.py", "-k foo") are forwarded to
99
# pytest directly.
@@ -31,25 +31,19 @@ if [ $# -gt 0 ]; then
3131
fi
3232
EXIT_CODE=$?
3333
else
34-
# Run regular package tests.
35-
echo "Running regular package tests..."
36-
pytest "${TUTORIAL_ROOT}/test/test_packages.py"
34+
# Run package tests.
35+
echo "Running package tests..."
36+
pytest "${TUTORIAL_ROOT}/test/test_packages.py" "${TUTORIAL_ROOT}/test/test_rapids.py"
3737
EXIT_CODE_PACKAGES=$?
3838

39-
# Run RAPIDS tests.
40-
echo ""
41-
echo "Running RAPIDS package tests in virtual environment..."
42-
/opt/venvs/rapids/bin/pytest "${TUTORIAL_ROOT}/test/test_rapids.py"
43-
EXIT_CODE_RAPIDS=$?
44-
4539
# Test solution notebooks.
4640
echo ""
4741
echo "Running solution notebook tests..."
4842
pytest "${TUTORIAL_ROOT}/test/test_notebooks.py"
4943
EXIT_CODE_NOTEBOOKS=$?
5044

5145
# Overall exit code is non-zero if any test suite failed.
52-
EXIT_CODE=$((EXIT_CODE_PACKAGES || EXIT_CODE_RAPIDS || EXIT_CODE_NOTEBOOKS))
46+
EXIT_CODE=$((EXIT_CODE_PACKAGES || EXIT_CODE_NOTEBOOKS))
5347
fi
5448

5549
END_TIME=$(date +%s.%N)

tutorials/accelerated-python/notebooks/libraries/20__cudf__nyc_parking_violations.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -692,9 +692,9 @@
692692
"toc_visible": true
693693
},
694694
"kernelspec": {
695-
"display_name": "Python 3 (RAPIDS 25.10)",
695+
"display_name": "Python 3 (ipykernel)",
696696
"language": "python",
697-
"name": "cudf-cu13-25.10"
697+
"name": "python3"
698698
},
699699
"language_info": {
700700
"codemirror_mode": {

tutorials/accelerated-python/notebooks/libraries/21__cudf_pandas__nyc_parking_violations.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,9 +268,9 @@
268268
"toc_visible": true
269269
},
270270
"kernelspec": {
271-
"display_name": "Python 3 (RAPIDS 25.10)",
271+
"display_name": "Python 3 (ipykernel)",
272272
"language": "python",
273-
"name": "cudf-cu13-25.10"
273+
"name": "python3"
274274
},
275275
"language_info": {
276276
"codemirror_mode": {

tutorials/accelerated-python/notebooks/libraries/22__cuml.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,9 @@
182182
"toc_visible": true
183183
},
184184
"kernelspec": {
185-
"display_name": "Python 3 (RAPIDS 25.10)",
185+
"display_name": "Python 3 (ipykernel)",
186186
"language": "python",
187-
"name": "cudf-cu13-25.10"
187+
"name": "python3"
188188
},
189189
"language_info": {
190190
"codemirror_mode": {

tutorials/accelerated-python/notebooks/libraries/solutions/20__cudf__nyc_parking_violations__SOLUTION.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -706,9 +706,9 @@
706706
"toc_visible": true
707707
},
708708
"kernelspec": {
709-
"display_name": "Python 3 (RAPIDS 25.10)",
709+
"display_name": "Python 3 (ipykernel)",
710710
"language": "python",
711-
"name": "cudf-cu13-25.10"
711+
"name": "python3"
712712
},
713713
"language_info": {
714714
"codemirror_mode": {

tutorials/accelerated-python/notebooks/libraries/solutions/21__cudf_pandas__nyc_parking_violations__SOLUTION.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@
6767
"toc_visible": true
6868
},
6969
"kernelspec": {
70-
"display_name": "Python 3 (RAPIDS 25.10)",
70+
"display_name": "Python 3 (ipykernel)",
7171
"language": "python",
72-
"name": "cudf-cu13-25.10"
72+
"name": "python3"
7373
},
7474
"language_info": {
7575
"codemirror_mode": {

tutorials/accelerated-python/test/test_rapids.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"""
22
RAPIDS tests for accelerated-python tutorial.
33
These tests validate that cuDF and cuML are installed and functional.
4-
These tests should be run in the RAPIDS venv.
54
"""
65

76
import pytest

0 commit comments

Comments
 (0)