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-fsSLhttps://unsloth.ai/install.sh|sh
Use the same command to update.
Windows PowerShell:
irmhttps://unsloth.ai/install.ps1|iex
Use the same command to update.
Launch Unsloth Studio:
unslothstudio-H0.0.0.0-p8888
For detailed Unsloth Studio install instructions and requirements, view our guide.
Uninstall Unsloth Studio
You can uninstall Unsloth Studio by deleting its install folder usually located under $HOME/.unsloth/studio on Mac/Linux/WSL and %USERPROFILE%\.unsloth\studio on Windows. Or run:
MacOS, WSL, Linux:rm -rf ~/.unsloth/studio
Windows (PowerShell):Remove-Item -Recurse -Force "$HOME\.unsloth\studio"
Optional: remove $HOME\.unsloth on Windows or ~/.unsloth on MacOS/Linux/WSL if you want to delete all Unsloth files
Note: Using the rm -rf commands will delete everything, including your history, cache, chats etc.
Deleting 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.
Troubleshooting
If you're still encountering dependency issues with Unsloth, many users have resolved them by forcing uninstalling and reinstalling Unsloth:
Unsloth Core
Install 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:
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:
# Licensed under the Apache License, Version 2.0 (the "License")
try: import torch
except: raise ImportError('Install torch via `pip install torch`')
from packaging.version import Version as V
import re
v = V(re.match(r"[0-9\.]{3,}", torch.__version__).group(0))
cuda = str(torch.version.cuda)
is_ampere = torch.cuda.get_device_capability()[0] >= 8
USE_ABI = torch._C._GLIBCXX_USE_CXX11_ABI
if cuda not in ("11.8", "12.1", "12.4", "12.6", "12.8", "13.0"): raise RuntimeError(f"CUDA = {cuda} not supported!")
if v <= V('2.1.0'): raise RuntimeError(f"Torch = {v} too old!")
elif v <= V('2.1.1'): x = 'cu{}{}-torch211'
elif v <= V('2.1.2'): x = 'cu{}{}-torch212'
elif v < V('2.3.0'): x = 'cu{}{}-torch220'
elif v < V('2.4.0'): x = 'cu{}{}-torch230'
elif v < V('2.5.0'): x = 'cu{}{}-torch240'
elif v < V('2.5.1'): x = 'cu{}{}-torch250'
elif v <= V('2.5.1'): x = 'cu{}{}-torch251'
elif v < V('2.7.0'): x = 'cu{}{}-torch260'
elif v < V('2.7.9'): x = 'cu{}{}-torch270'
elif v < V('2.8.0'): x = 'cu{}{}-torch271'
elif v < V('2.8.9'): x = 'cu{}{}-torch280'
elif v < V('2.9.1'): x = 'cu{}{}-torch290'
elif v < V('2.9.2'): x = 'cu{}{}-torch291'
else: raise RuntimeError(f"Torch = {v} too new!")
if v > V('2.6.9') and cuda not in ("11.8", "12.6", "12.8", "13.0"): raise RuntimeError(f"CUDA = {cuda} not supported!")
x = x.format(cuda.replace(".", ""), "-ampere" if False else "") # is_ampere is broken due to flash-attn
print(f'pip install --upgrade pip && pip install --no-deps git+https://github.com/unslothai/unsloth-zoo.git && pip install "unsloth[{x}] @ git+https://github.com/unslothai/unsloth.git" --no-build-isolation')