Supercharge Your Machine Learning with GPU: A Complete RAPIDS (cuML/cuDF) Setup Guide for Python
Dall-E
Use GPUs for Machine Learning: RAPIDS (cuML, cuDF) Setup Guide

Dall-E
Table of contents
· Introduction · Prerequisite · Step-by-Step Installation ∘ Step 1: Install Windows WSL2 ∘ Step 2: Install Nvidia driver ∘ Step 3: Log in to WSL2 ∘ Step 4: Install conda in the wsl2 ∘ Step 5: Install RAPIDS via conda ∘ Step 6: Check installation · Setting Up RAPIDS in VSCode ∘ Install VSCode for WSL2 · Example: Using cuDF and cuML ∘ cuDF Example: DataFrame Manipulation ∘ cuML Example: Linear Regression · Conclusion
Introduction
Imagine speeding up data processing and machine learning model training from hours to just minutes. This is the power of GPU acceleration.
In this guide, you’ll learn how to set up a GPU-accelerated Python environment using RAPIDS on Windows with WSL2. RAPIDS, which includes cuDF for data manipulation and cuML for machine learning, will enable you to fully leverage your GPU’s computational power and significantly boost performance.
We’ll walk you through every step, including how to directly use this environment in VSCode, allowing you to seamlessly work with your GPU-accelerated setup for machine learning and data analysis. By the end of this tutorial, you’ll be equipped to accelerate your workflows and harness the full power of your GPU with ease.
Prerequisite
- GPU compute capability > 7.0 (Check your GPU here)
- OS: Linux or Windows 10/11 using WSL2 (We’ll cover the full installation for Windows 10 with WSL2. Although the official guide recommends Windows 11, it also works on Windows 10 based on our testing.)
- CUDA: CUDA installation details can be found in Part 4.1 of my previous Medium article. For this example, we use CUDA 11.2.
For more details, refer to the official RAPIDS Installation Guide.
Step-by-Step Installation
Step 1: Install Windows WSL2
WSL2 enables running a Linux environment on Windows. Of course, you can Follow the official Microsoft guide, or you can directly follow the steps below:
- Open the Command Prompt and run:
wsl --install
-
After installation, reboot your computer when prompted.
-
If WSL2 isn’t set as the default version, set it with:
wsl --set-default-version
Note: If you leave the WSL2 environment for any reason and later return, you can simply open the command prompt again and type wsl to access it. After you access WSL, you may also encounter a path like /mnt/c/Users/zackary; to switch to your Linux home directory, run:
cd ~
Step 2: Install Nvidia driver
- Visit the NVIDIA Driver Download Page, then select your GPU model and operating system. Download and install the latest drivers. For example, in our setup, we use the NVIDIA T400 with Windows 10, and the system suggests installing driver version 553.50 (check the pictures below).



- After downloading, follow the installation instructions provided on the page.
Step 3: Log in to WSL2
- First time you need to create account by entering username and password

- You should see the Linux terminal after logging in successfully.

Step 4: Install conda in the wsl2
- Install Miniconda3 (a minimal installer for Conda):
mkdir -p ~/miniconda3
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda3/miniconda.sh
bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3
rm ~/miniconda3/miniconda.sh
- Initialize Conda:
source ~/miniconda3/bin/activate
conda init --all
- Set Conda’s channel priority to flexible:
conda config --show channel_priority # must be "flexible"
conda config --set channel_priority flexible # if not "flexible", set to "flexiable"
Step 5: Install RAPIDS via conda
- Create a Conda environment with RAPIDS:
conda create -n rapids-24.12 -c rapidsai -c conda-forge -c nvidia \
rapids=24.12 python=3.12 'cuda-version>=12.0,<=12.5'
- After installing, you can find your Conda environment in your WSL2 directory.
\\wsl.localhost\Ubuntu\home\zackary\miniconda3\envs\rapids-24.12
Step 6: Check installation
- Start Python in WSL2:
python
- Test cuDF (data manipulation):
import cudf
print(cudf.Series([1, 2, 3]))
You should see the following output:
0 1
1 2
2 3
dtype: int64
Setting Up RAPIDS in VSCode
Install VSCode for WSL2
- Install the Remote — WSL extension in VSCode:
- Open VSCode and press
Ctrl+Shift+P. - Type Remote-WSL and install the extension.

- Configure Conda in VSCode’s terminal:
- Open the terminal in VSCode (Ctrl+ `) and run:
conda init bash
source ~/.bashrc
conda activate rapids-24.12
- Test GPU availability with CuPy:
import cupy as cp
print("Is GPU available in CuPy:", cp.cuda.is_available())
Your expected result should look like this:

Example: Using cuDF and cuML
Once you’ve set up the environment, you can start using RAPIDS libraries like cuDF for data manipulation and cuML for machine learning.
cuDF Example: DataFrame Manipulation
import cudf
# Create a cuDF DataFrame
data = cudf.DataFrame({'a': [1, 2, 3], 'b': [4, 5, 6]})
print("cuDF DataFrame:")
print(data)
# Perform operations
data['c'] = data['a'] + data['b']
print("After adding columns:")
print(data)
cuML Example: Linear Regression
import numpy as np
import cudf
from cuml.linear_model import LinearRegression
# Generate sample data
X = np.random.rand(100, 3).astype('float32')
y = np.dot(X, np.array([1.5, -2.0, 1.0])) + 0.5
# Convert data to GPU arrays
X_gpu = cudf.DataFrame.from_records(X)
y_gpu = cudf.Series(y)
# Train a linear regression model
model = LinearRegression()
model.fit(X_gpu, y_gpu)
# Display model coefficients
print("Model coefficients:")
print(model.coef_)
print("Intercept:", model.intercept_)
Conclusion
Congratulations! You’ve successfully set up a GPU-accelerated Python environment using RAPIDS on WSL2. Now, you can use cuDF for fast data manipulation and cuML for GPU-accelerated machine learning, significantly speeding up your workflows.
Keep exploring RAPIDS to unlock the full power of your GPU and elevate your data science and machine learning projects.
메타데이터
- post_id
- 68dc6c077477
- slug
- supercharge-your-machine-learning-with-gpu-a-complete-rapids-cuml-cudf-setup-guide-for-python-68dc6c077477
- url
- https://medium.com/zackary-yen/supercharge-your-machine-learning-with-gpu-a-complete-rapids-cuml-cudf-setup-guide-for-python-68dc6c077477
- canonical_url
- https://medium.com/zackary-yen/supercharge-your-machine-learning-with-gpu-a-complete-rapids-cuml-cudf-setup-guide-for-python-68dc6c077477
- author_url
- https://medium.com/@zackary_yen
- status
- ok
- fetched_at
- 2026-07-21 08:10:39