> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nixl/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/nixl/_mcp/server.

# Python Bindings

> Build and install NIXL Python bindings from source.

## Prerequisites

- **uv** (required):

```bash
curl -LsSf https://astral.sh/uv/install.sh | sh
export PATH="$HOME/.local/bin:${PATH}"
```

- **tomlkit**: installed below via uv or pip
- **PyTorch**: [pytorch.org](https://pytorch.org/get-started/locally/)

## Virtual Environment Setup

```bash
uv venv .venv --python 3.12
source .venv/bin/activate
uv pip install meson ninja tomlkit
```

Then install PyTorch from the [PyTorch website](https://pytorch.org/get-started/locally/).

## Build and Install

**For CUDA 12:**

```bash
meson setup build
ninja -C build install
pip install build/src/bindings/python/nixl-meta/nixl-*-py3-none-any.whl
```

**For CUDA 13:**

```bash
./contrib/tomlutil.py --wheel-name nixl-cu13 pyproject.toml
meson setup build
ninja -C build install
pip install build/src/bindings/python/nixl-meta/nixl-*-py3-none-any.whl
```

## Verify Installation

```bash
python3 -c "import nixl; agent = nixl.nixl_agent('agent1')"
```

Expected output:

```text
NIXL INFO    _api.py:363 Backend UCX was instantiated
NIXL INFO    _api.py:253 Initialized NIXL agent: agent1
```

<Note>
For backend-specific build instructions, see [NIXL Backends](/nixl/user-guide/backend-selection).
</Note>