Installation
Dependency Management
We recommend using modern Python packaging tools such as uv
for managing python dependencies.
uv (Recommended)
# Install uv
curl -LsSf https://astral.sh/uv/install.sh | sh
# Create a virtual environment and install Outlines
uv venv
source .venv/bin/activate
uv pip install outlines
or with pip:
Optional Dependencies
To use Outlines models, you need to install the Python libraries for the associated inference engines/clients. Such libraries are not part of the general installation as you should only install the libraries needed for the specific models you want to use.
Outlines models with the installation of their associated additional depencies:
- Anthropic:
pip install anthropic
- Dottxt:
pip install dottxt
- Gemini:
pip install google-generativeai
- Llamacpp:
pip install llama-cpp-python
- Mlx-lm:
pip install mlx mlx-lm
- Ollama:
pip install ollama
(after having downloaded Ollama in your system) - OpenAI:
pip install openai
- SGLang:
pip install openai
- TGI:
pip install huggingface_hub
- Transformers:
pip install transformers
- TransformersMultiModal:
pip install transformers
- vLLM (online server):
pip install openai
- vLLM (offline):
pip install vllm
If you encounter any problems using Outlines with these libraries, take a look at their installation instructions. The installation of openai
and transformers
should be straightforward, but other libraries have specific hardware requirements.
Hardware Requirements
If you are using a local model, your model may require specific hardware. Please check the documentation for these libraries.
Some libraries like vllm
and llama-cpp-python
require specific hardware, such as a compatible GPU. mlx-lm
on its side is designed for Apple Silicon, so it may not be appropriate for your use case if you are on a different platform.
Bleeding Edge
You can install the latest version of Outlines from the repository's main
branch:
This can be useful, for instance, when a fix has been merged but not yet released.
Installing for Development
See the contributing documentation for instructions on how to install Outlines for development, including an example using the dot-install
method for one of the backends.