desktop-arrow-downInstall Unsloth via pip and uv

To install Unsloth locally via Pip, follow the steps below:

Unsloth Studio

MacOS, Linux, WSL:

curl -fsSL https://unsloth.ai/install.sh | sh

Windows PowerShell:

irm https://unsloth.ai/install.ps1 | iex

Launch Unsloth

MacOS, Linux, WSL:

source unsloth_studio/bin/activate
unsloth studio -H 0.0.0.0 -p 8888

Windows:

& .\unsloth_studio\Scripts\unsloth.exe studio -H 0.0.0.0 -p 8888

For detailed Unsloth Studio install instructions and requirements, view our guide.

Unsloth Core

Install with uv pip (recommended) for the latest pip release:

curl -LsSf https://astral.sh/uv/install.sh | sh
uv venv unsloth_env --python 3.13
source unsloth_env/bin/activate
uv pip install unsloth --torch-backend=auto

Or just pip:

To install vLLM and Unsloth together, do:

To install the latest main branch of Unsloth, do:

For venv and virtual environments installs to isolate your installation to not break system packages, and to reduce irreparable damage to your system, use venv:

If you're installing Unsloth in Jupyter, Colab, or other notebooks, be sure to prefix the command with !. This isn't necessary when using a terminal

circle-info

Python 3.13 is now supported!

Uninstall or Reinstall

If you're still encountering dependency issues with Unsloth, many users have resolved them by forcing uninstalling and reinstalling Unsloth:


Advanced Pip Installation

circle-exclamation

Pip is a bit more complex since there are dependency issues. The pip command is different for torch 2.2,2.3,2.4,2.5 and CUDA versions.

For other torch versions, we support torch211, torch212, torch220, torch230, torch240 and for CUDA versions, we support cu118 and cu121 and cu124. For Ampere devices (A100, H100, RTX3090) and above, use cu118-ampere or cu121-ampere or cu124-ampere.

For example, if you have torch 2.4 and CUDA 12.1, use:

Another example, if you have torch 2.5 and CUDA 12.4, use:

And other examples:

Or, run the below in a terminal to get the optimal pip installation command:

Or, run the below manually in a Python REPL:

Last updated

Was this helpful?