windowsInstalling Unsloth on Windows

See how to install Unsloth on Windows. How to install PyTorch on Windows.

For Windows, pip install unsloth now works, however you must have Pytorch previously installed.

Method #1 - Windows via Conda:

1

Install Miniconda (or Anaconda)

See https://www.anaconda.com/downloadarrow-up-right to download Anaconda. Our suggestion is to use https://www.anaconda.com/docs/getting-started/miniconda/install#quickstart-install-instructionsarrow-up-right Miniconda. To use it, first enter Powershell - search "Windows Powershell" in Start:

Then it'll open up Powershell:

Then copy paste the below: CTRL+C, and paste it in Powershell CTRL+V:

Invoke-WebRequest -Uri "https://repo.anaconda.com/miniconda/Miniconda3-latest-Windows-x86_64.exe" -OutFile ".\miniconda.exe"
Start-Process -FilePath ".\miniconda.exe" -ArgumentList "/S" -Wait
del .\miniconda.exe

Accept the warning and press "Paste anyway" and wait.

It's downloading the installer like below:

After installing, open up open Anaconda Powershell Prompt to use Miniconda via Start -> Search for it:

Then you'll see:

2

Make conda environment

conda create --name unsloth_env python==3.12 -y
conda activate unsloth_env

You will see:

3

Check nvidia-smi to confirm you have a GPU, and look for the CUDA version

After typing nvidia-smi in Powershell, you should see something like below. If you don't have nvidia-smi or the below fails to pop up, you need to reinstall NVIDIA drivers - https://www.nvidia.com/en-us/drivers/arrow-up-right

4

Install PyTorch

When running nvidia-smi you will see at the top right corner: "CUDA Version: 13.0". Install PyTorch in PowerShell via. Change 130 to your CUDA version - ensure the version exists at https://pytorch.org/arrow-up-right and matches your CUDA driver version.

pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu130

You will see:

Try running this in Python via python after PyTorch is installed:

import torch
print(torch.cuda.is_available())
A = torch.ones((10, 10), device = "cuda")
B = torch.ones((10, 10), device = "cuda")
A @ B

You should see a matrix of 10s. Also verify True for the first.

5

Install Unsloth (only if PyTorch works!)

triangle-exclamation

In Powershell (after exiting Python via exit() , do and wait:

pip install unsloth
6

Verify Unsloth works

Now use any script in Unsloth Notebooks (save to .py file), or use the below basic script:

You should see:

🦥 Unsloth: Will patch your computer to enable 2x faster free finetuning.
🦥 Unsloth Zoo will now patch everything to make training faster!
==((====))==  Unsloth 2026.1.4: Fast Gemma3 patching. Transformers: 4.57.6.
   \\   /|    NVIDIA GeForce RTX 3060. Num GPUs = 1. Max memory: 12.0 GB. Platform: Windows.
O^O/ \_/ \    Torch: 2.10.0+cu130. CUDA: 8.6. CUDA Toolkit: 13.0. Triton: 3.6.0
\        /    Bfloat16 = TRUE. FA [Xformers = 0.0.34. FA2 = False]
 "-____-"     Free license: http://github.com/unslothai/unsloth
Unsloth: Fast downloading is enabled - ignore downloading bars which are red colored!
Unsloth: Gemma3 does not support SDPA - switching to fast eager.
Unsloth: Making `model.base_model.model.model` require gradients
Unsloth: Tokenizing ["text"] (num_proc=1):   0%|                 | 0/210289 [00:00<?, ? examples/s]�  Unsloth: Will patch your computer to enable 2x faster free finetuning.
🦥 Unsloth: Will patch your computer to enable 2x faster free finetuning.

And training:

Method #2 - Docker:

Docker might be the easiest way for Windows users to get started with Unsloth as there is no setup needed or dependency issues. unsloth/unslotharrow-up-right is Unsloth's only Docker image. For Blackwell and 50-series GPUs, use this same image - no separate image needed.

For installation instructions, please follow our Docker guide, otherwise here is a quickstart guide:

1

Install Docker and NVIDIA Container Toolkit.

Install Docker via Linuxarrow-up-right or Desktoparrow-up-right (other). Then install NVIDIA Container Toolkitarrow-up-right:

export NVIDIA_CONTAINER_TOOLKIT_VERSION=1.17.8-1
sudo apt-get update && sudo apt-get install -y \
  nvidia-container-toolkit=${NVIDIA_CONTAINER_TOOLKIT_VERSION} \
  nvidia-container-toolkit-base=${NVIDIA_CONTAINER_TOOLKIT_VERSION} \
  libnvidia-container-tools=${NVIDIA_CONTAINER_TOOLKIT_VERSION} \
  libnvidia-container1=${NVIDIA_CONTAINER_TOOLKIT_VERSION}
2

Run the container.

unsloth/unslotharrow-up-right is Unsloth's only Docker image.

docker run -d -e JUPYTER_PASSWORD="mypassword" \
  -p 8888:8888 -p 2222:22 \
  -v $(pwd)/work:/workspace/work \
  --gpus all \
  unsloth/unsloth
3

Access Jupyter Lab

Go to http://localhost:8888arrow-up-right and open Unsloth. Access the unsloth-notebooks tabs to see Unsloth notebooks.

4

Start training with Unsloth

If you're new, follow our step-by-step Fine-tuning Guide, RL Guide or just save/copy any of our premade notebooks.

5

Docker issues - GPU not discovered?

Try doing WSL via Windows

Method #3 - WSL:

1

Install WSL

Open up Command Prompt, the Terminal, and install Ubuntu. Set the password if asked.

wsl.exe --install Ubuntu-24.04
wsl.exe -d Ubuntu-24.04
2

If you did NOT do (1), so you already installed WSL, enter WSL by typing wsl and ENTER in the command prompt

wsl
3

Install Python

sudo apt update
sudo apt install python3 python3-full python3-pip python3-venv -y
4

Install PyTorch

pip install torch torchvision --force-reinstall --index-url https://download.pytorch.org/whl/cu130

If you encounter permission issues, use –break-system-packages so pip install torch torchvision --force-reinstall --index-url https://download.pytorch.org/whl/cu130 –break-system-packages

5

Install Unsloth and Jupyter Notebook

pip install unsloth jupyter

If you encounter permission issues, use –break-system-packages so pip install unsloth jupyter –break-system-packages

6

Launch Unsloth via Jupyter Notebook

jupyter notebook

Then open up our notebooks within Unsloth Notebooksand load them up! You can also go to Colab notebooks and download > download .ipynb and load them.

circle-exclamation

Advanced/Troubleshooting

For advanced installation instructions or if you see weird errors during installations:

  1. Install torch and triton. Go to https://pytorch.org to install it. For example pip install torch torchvision torchaudio triton

  2. Confirm if CUDA is installated correctly. Try nvcc. If that fails, you need to install cudatoolkit or CUDA drivers.

  3. Install xformers manually. You can try installing vllm and seeing if vllm succeeds. Check if xformers succeeded with python -m xformers.info Go to https://github.com/facebookresearch/xformers. Another option is to install flash-attn for Ampere GPUs.

  4. Double check that your versions of Python, CUDA, CUDNN, torch, triton, and xformers are compatible with one another. The PyTorch Compatibility Matrixarrow-up-right may be useful.

  5. Finally, install bitsandbytes and check it with python -m bitsandbytes

Last updated

Was this helpful?