Practical overview
When it fits
Use TorchOpt when a PyTorch project needs optimization steps that can participate in differentiation, or when developing functional, bilevel, or meta-learning optimization methods.
Who it is for
- PyTorch developers implementing differentiable optimization methods.
- Researchers and practitioners prototyping bilevel optimization or meta-learning algorithms.
Documented uses
- Build functional optimizers for PyTorch models.
- Differentiate through optimization using explicit, implicit, or zero-order methods.
- Prototype bilevel optimization and meta-learning workflows.
Requirements & limits
The project is open source under the Apache-2.0 license. Installation instructions use PyPI or a source checkout.
- PyTorch is a prerequisite and should be installed before TorchOpt.
- CPU and CUDA use require attention to the matching PyTorch build; a CUDA-specific package index may be needed.
- Graphviz is optional and applies to computation-graph visualization.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Install TorchOpt from PyPI
Install TorchOpt in a Python environment with PyTorch already installed.
Before you start
- A Python environment
- PyTorch installed in that environment, following the PyTorch installation instructions
Steps
Install PyTorch in the Python environment first.
Run the command below.
pip3 install torchoptIf you need a specific PyTorch CPU or CUDA build, use the appropriate PyTorch extra index URL; the README shows the command below as an example.
pip3 install torchopt --extra-index-url https://download.pytorch.org/whl/cu121
Expected outcome
TorchOpt is installed from PyPI in the Python environment.
Guide limitations
- The README warns that pip may install or upgrade PyTorch if the minimum version is not satisfied.
- Choose a PyTorch build appropriate for your CPU or CUDA setup; the CUDA 12.1 index URL is only an example.
- Graphviz is optional and is listed for visualizing computation graphs.
Install TorchOpt from a source checkout
Clone the TorchOpt repository and install the package from its source tree.
Before you start
- Git
- PyTorch installed in the Python environment
Steps
Clone the repository with the command below.
git clone https://github.com/metaopt/torchopt.gitChange into the checkout with
cd torchopt.Run the command below.
pip3 install .
Expected outcome
TorchOpt is installed from the checked-out source tree.
Guide limitations
- The README does not describe running or deploying TorchOpt after installation.
- For source builds, the README separately describes a conda environment recipe for build tools such as
cmake,g++, andnvcc; the listed steps do not create that environment.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 8 November 2026
- Original website title
- metaopt/torchopt · Official homepage title · retained in its source language

