GPU-Computing-With-Python-3-And-CUDA-

August 12, 2025 ยท View on GitHub

GPU Computing with Python 3 and CUDA, Published by Packt

Environment Setup

This guide will help you set up the necessary environment to run the example notebooks provided in our book: GPU-Computing-With-Python-3-And-CUDA. The setup relies on Pixi to install all the required packages such as Nvidia profiler, CUDA library, Numba, and JAX.

System Requirements

To execute the examples presented in this book, please ensure your machine has at least one Nvidia GPU with CUDA support.

Manage Dependencies

Pixi simplifies the environment setup and ensures reproducibility.

Step 1: Install Pixi

First, install Pixi on your system. Open a terminal and run the appropriate command for your operating system:

On Linux and macOS:

curl -fsSL https://pixi.sh/install.sh | sh

On Windows (PowerShell):

powershell -ExecutionPolicy ByPass -c "irm -useb https://pixi.sh/install.ps1 | iex"

For more details or troubleshooting, refer to the official Pixi documentation.

Step 2: Install dependencies

Once Pixi is installed, clone this repository and navigate to the root directory using the following commands:

git clone https://github.com/PacktPublishing/GPU-Computing-With-Python-3-And-CUDA-.git
cd GPU-Computing-With-Python-3-And-CUDA-

This creates a folder named GPU-Computing-With-Python-3-And-CUDA- in your current directory and takes you into the newly cloned folder, so you can work with the project files.

Then run

pixi install

This command will read the pyproject.toml and pixi.lock files and install all required packages.

Step 3: Activate the Pixi Environment

After installation completes, you activate the environment by running:

pixi shell

You are now in a fully configured environment where all required dependencies for this book are available.

Run Jupyter Notebooks

To run the code notebooks run this command:

pixi run jupyter-lab 

This will start Jupyterlab browser-based interface.

Or, you can alternatively add this environment as a new Jupyter kernel:

python -m ipykernel install --user --name=python_cuda --display-name "python_cuda"

This will make the environment available as a selectable kernel named "python_cuda" in your Jupyter interface.