Install Unsloth via pip and uv

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

Unsloth can be used in two ways: through Unsloth Studio, the web UI, or through Unsloth Core, the code-based version.

Unsloth Studio

MacOS, Linux, WSL:

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

Use the same command to update or use unsloth studio update.

Windows PowerShell:

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

Use the same command to update or use unsloth studio update.

Launch:

unsloth studio -H 0.0.0.0 -p 8888

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

Install from Main Repo

macOS, Linux, WSL developer installs:

git clone https://github.com/unslothai/unsloth
cd unsloth
./install.sh --local
unsloth studio -H 0.0.0.0 -p 8888

Windows PowerShell developer installs:

Nightly Install

Nightly - MacOS, Linux, WSL:

Then to launch every time:

Nightly - Windows:

Run in Windows Powershell:

Then to launch every time:

Uninstall

The recommended way to fully remove Unsloth Studio is the uninstall script for your OS. It stops any running servers, removes the app, CLI command, launcher data, shortcuts, and platform-specific entries (macOS .app bundle + Launch Services; Windows Start Menu + registry + PATH):

macOS, WSL, Linux:

Windows (PowerShell):

Manual uninstall

If you prefer to remove only specific parts:

1. Remove app only (keeps history, chats, checkpoints, and exports intact):

  • macOS, WSL, Linux: rm -rf ~/.unsloth/studio/unsloth_studio

  • Windows (PowerShell): Remove-Item -Recurse -Force "$HOME\.unsloth\studio\unsloth_studio"

2. Remove Studio entirely (keeps other Unsloth tools intact):

  • macOS, WSL, Linux: rm -rf ~/.unsloth/studio

  • Windows (PowerShell): Remove-Item -Recurse -Force "$HOME\.unsloth\studio"

3. Remove everything Unsloth-related:

  • macOS, WSL, Linux: rm -rf ~/.unsloth

  • Windows (PowerShell): Remove-Item -Recurse -Force "$HOME\.unsloth"

4. Remove shortcuts and symlinks:

macOS:

Linux:

WSL / Windows (PowerShell):

5. Remove the CLI command:

  • macOS, Linux, WSL: rm -f ~/.local/bin/unsloth

  • Windows (PowerShell): The installer added the venv's Scripts directory to your User PATH. To remove it, open Settings → System → About → Advanced system settings → Environment Variables, find Path under User variables, and remove the entry pointing to .unsloth\studio\...\Scripts.

Note: Steps 1-5 dont touch your downloaded HF model files. See Deleting cached HF model files below if you want to reclaim that space.

Deleting cached HF model files

You can delete old model files either from the bin icon in model search or by removing the relevant cached model folder from the default Hugging Face cache directory. By default, Hugging Face uses ~/.cache/huggingface/hub/ on macOS/Linux/WSL and C:\Users\<username>\.cache\huggingface\hub\ on Windows.

  • MacOS, Linux, WSL: ~/.cache/huggingface/hub/

  • Windows: %USERPROFILE%\.cache\huggingface\hub\

If HF_HUB_CACHE or HF_HOME is set, use that location instead. On Linux and WSL, XDG_CACHE_HOME can also change the default cache root.

Unsloth Core

Install uv with the following command:

macOS, WSL, Linux:

Windows (PowerShell):

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

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

Python 3.13 is now supported!

Uninstall Unsloth Core

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

Advanced Pip Installation

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?