Installing TorchDynamo

This section describes how to install TorchDynamo. TorchDynamo is included in the nightly binaries of PyTorch. For more information, see Getting Started.


You must have the following prerequisites to use TorchDynamo:

  • A Linux or macOS environment

  • Python 3.8 (recommended). Python 3.7 through 3.10 are supported and tested. Make sure to have a development version of Python installed locally as well.

GPU/CUDA Requirements

To use GPU back ends, and in particular Triton, make sure that the CUDA that you have installed locally matches the PyTorch version you are running.

The following command installs GPU PyTorch + TorchDynamo along with GPU TorchDynamo dependencies (for CUDA 11.7):

pip3 install numpy --pre torch --force-reinstall --extra-index-url

CPU requirements

There are no additional requirements for CPU TorchDynamo. CPU TorchDynamo is included in the nightly versions of PyTorch. To install, run the following command:

pip3 install --pre torch --extra-index-url

Verify Installation

If you built PyTorch from source, then you can run the following commands (from the PyTorch repo root directory) to check that TorchDynamo is installed correctly:

cd tools/dynamo

If you do not have the PyTorch source locally, you can alternatively copy the script (tools/dynamo/ from the PyTorch repository and run it locally.

Docker Installation

We also provide all the required dependencies in the PyTorch nightly binaries which you can download with the following command:

docker pull

And for ad hoc experiments just make sure that your container has access to all your GPUs:

docker run --gpus all -it /bin/bash


Access comprehensive developer documentation for PyTorch

View Docs


Get in-depth tutorials for beginners and advanced developers

View Tutorials


Find development resources and get your questions answered

View Resources