# How to Install Triton


Triton is OpenAI's open-source compiler for writing GPU kernels in Python. Most users encounter it as a transitive dependency of [PyTorch](https://pydevtools.com/handbook/how-to/how-to-install-pytorch-with-uv.md), but it can also be installed standalone for custom kernel development. Triton only ships [wheels](https://pydevtools.com/handbook/reference/wheel.md) for Linux (x86_64 and aarch64). There are no macOS or Windows builds.

## Requirements

- Linux (x86_64 or aarch64). Triton has no wheels for macOS or Windows.
- Python 3.10 or later (up to 3.14).
- glibc 2.27 or later (Ubuntu 18.04+, Debian 10+, RHEL 8+).
- An NVIDIA or AMD GPU with appropriate drivers for running compiled kernels. Triton itself installs without a GPU, but kernels cannot execute without one.

## Install as a PyTorch dependency (automatic)

PyTorch declares Triton as a dependency on Linux x86_64. Installing PyTorch pulls in the matching Triton version automatically:

```sh
uv add torch
```

Or with [pip](https://pydevtools.com/handbook/reference/pip.md):

```sh
pip install torch
```

Each PyTorch release pins a specific Triton version:

| PyTorch | Triton |
|---------|--------|
| 2.11.x  | 3.6.0  |
| 2.9.x   | 3.5.1  |
| 2.8.x   | 3.4.0  |
| 2.7.x   | 3.3.1  |
| 2.6.x   | 3.2.0  |

No extra configuration is needed. The version constraint in PyTorch's metadata ensures the correct Triton version gets installed.

> [!NOTE]
> PyTorch 2.11+ declares the Triton dependency on all Linux architectures. Earlier versions (2.9 and below) only declared it on Linux x86_64. On those older versions, install Triton separately on aarch64 if needed.

## Install standalone

Triton is published to [PyPI](https://pydevtools.com/handbook/explanation/what-is-pypi.md) under the package name `triton`:

```sh
uv add triton
```

Or with pip:

```sh
pip install triton
```

The standalone `triton` package on PyPI is the same package that PyTorch depends on. There is no separate "pytorch-triton" package to worry about (the `pytorch-triton` package on PyPI is an empty placeholder).

## Install a specific version

Pin the version to match a PyTorch release or to get a specific feature:

```sh
uv add "triton==3.5.1"
```

When Triton is installed alongside PyTorch, the versions must be compatible. Installing a Triton version that conflicts with PyTorch's pinned requirement will cause a resolution error. If that happens, either remove the explicit Triton pin or upgrade PyTorch to match.

## Install with conda-forge or pixi

Triton is available on [conda-forge](https://pydevtools.com/handbook/reference/conda-forge.md) for Linux (x86_64 and aarch64):

```sh
conda install -c conda-forge triton
```

Or with [pixi](https://pydevtools.com/handbook/reference/pixi.md):

```sh
pixi add triton
```

conda-forge tracks Triton releases closely and packages versions 3.1.0 through 3.6.0. This can be a good option when managing CUDA dependencies through conda, since conda resolves the CUDA toolkit as part of the same dependency graph (see [choosing between uv and conda for scientific Python](https://pydevtools.com/handbook/explanation/uv-vs-pixi-vs-conda-for-scientific-python.md)).

## Verify the installation

Confirm Triton is installed and can compile a kernel:

```sh
python -c "import triton; print(triton.__version__)"
```

To verify that GPU compilation works, run a minimal kernel on a machine with a GPU:

```python
import torch
import triton
import triton.language as tl

@triton.jit
def add_kernel(x_ptr, y_ptr, out_ptr, n, BLOCK: tl.constexpr):
    idx = tl.program_id(0) * BLOCK + tl.arange(0, BLOCK)
    mask = idx < n
    x = tl.load(x_ptr + idx, mask=mask)
    y = tl.load(y_ptr + idx, mask=mask)
    tl.store(out_ptr + idx, x + y, mask=mask)

x = torch.randn(1024, device="cuda")
y = torch.randn(1024, device="cuda")
out = torch.empty_like(x)
add_kernel[(1,)](x, y, out, 1024, BLOCK=1024)
assert torch.allclose(out, x + y)
print("Triton kernel executed successfully")
```

## Troubleshooting

`triton` version conflicts with PyTorch. PyTorch pins an exact Triton version (e.g., `triton==3.5.1`). If a project also pins a different version, the resolver will fail. Remove the explicit Triton pin, or upgrade PyTorch to a release that matches the desired Triton version.

No wheels found (macOS or Windows). Triton only publishes Linux wheels. On macOS and Windows, `pip install triton` will fail with a "no matching distribution" error. Triton cannot be used on these platforms. For development workflows that need cross-platform support, guard the dependency with an environment marker:

```toml
[project]
dependencies = [
    "triton>=3.5.0; sys_platform == 'linux'",
]
```

GLIBC version too old. Triton wheels require glibc 2.27+. On older Linux distributions, the install will fail with an error about an incompatible platform tag. Upgrade the OS or use a container with a newer glibc.

Kernel compilation fails at runtime. Triton compiles kernels to PTX/AMDGPU IR at runtime, which requires a working GPU driver. If the CUDA or ROCm driver is missing or misconfigured, compilation will fail even though the package installed correctly. Verify driver installation with `nvidia-smi` (NVIDIA) or `rocm-smi` (AMD).

## Related

- [How to Install PyTorch with uv](https://pydevtools.com/handbook/how-to/how-to-install-pytorch-with-uv.md)
- [Why Installing GPU Python Packages Is So Complicated](https://pydevtools.com/handbook/explanation/installing-cuda-python-packages.md)
- [uv vs. pixi vs. conda for Scientific Python](https://pydevtools.com/handbook/explanation/uv-vs-pixi-vs-conda-for-scientific-python.md)
