> For the complete documentation index, see [llms.txt](https://unsloth.ai/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://unsloth.ai/docs/jp/meru/install/pip-install.md).

# pip と uv を使って Unsloth をインストールする

Unsloth Studioを手動でインストールするか、pip、uv、または仮想環境を使ってUnsloth Coreをインストールします。

**Unsloth Desktop**, **Unsloth Studio**、および **Unsloth Core** はインストール方法が異なります。このページでは、Studio の手動インストールとコードベースの Core パッケージについて説明します。

### Unsloth Desktop

ネイティブのデスクトップアプリの場合は、以下のコマンドではなく OS 用のダウンロードを使用してください:

* <i class="fa-apple">:apple:</i> [macOS 用をダウンロード](https://unsloth.ai/download/mac)
* <i class="fa-windows">:windows:</i> [Windows 用をダウンロード](https://unsloth.ai/download/windows)
* <i class="fa-linux">:linux:</i> [Linux 用をダウンロード](https://unsloth.ai/download/linux)

## **Unsloth Studio**

**Unsloth Studio** は私たちの Web UI です。ネイティブインストールは以下に従ってください:

{% tabs %}
{% tab title="macOS、Linux、WSL" %}
**Unsloth をインストール:**

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

更新にも同じコマンドを使用します。
{% endtab %}

{% tab title="Windows" %}
**Unsloth をインストール:**

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

更新にも同じコマンドを使用します。
{% endtab %}

{% tab title="Docker" %}
この [Unsloth の Docker イメージ](https://hub.docker.com/r/unsloth/unsloth) `unsloth/unsloth` は Docker で利用できます。 [ガイドを読む。](https://unsloth.ai/docs/get-started/install/docker)
{% endtab %}

{% tab title="Homebrew" %}
**Unsloth をインストール:**

```bash
brew install --cask unsloth
```

Unsloth を更新:

```bash
brew upgrade --cask unsloth
```

{% endtab %}

{% tab title="WinGet" %}
**Unsloth をインストール:**

```powershell
winget install --id UnslothAI.Unsloth -e
```

Unsloth を更新:

```powershell
winget upgrade --id UnslothAI.Unsloth -e
```

{% endtab %}
{% endtabs %}

#### 起動:

{% columns %}
{% column %}
通常のローカル起動:

```bash
unsloth studio
```

インストールとアンインストールの詳細については、 [Unsloth Studio のインストール](/docs/jp/shii/studio/install.md) セクションをご覧ください。
{% endcolumn %}

{% column %}
Unsloth を HTTPS 経由で安全に起動:

```bash
unsloth studio --secure
```

次を使用してください: [無料の Cloudflare](/docs/jp/ji-chu/cloudflaretounslothniyorunarimtoakusesuderkarullmwodokokarademosuru.md) トンネルを Windows、Mac、Linux で。
{% endcolumn %}
{% endcolumns %}

### **メインリポジトリからインストール**

#### **macOS、Linux、WSL の開発者向けインストール:**

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

#### **Windows PowerShell での開発者向けインストール:**

```powershell
winget install -e --id Python.Python.3.13 --source winget
winget install --id=astral-sh.uv  -e --source winget
winget install --id Git.Git -e --source winget
git clone https://github.com/unslothai/unsloth
cd unsloth
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
.\install.ps1 --local
unsloth studio -H 0.0.0.0 -p 8888
```

### **ナイトリービルドのインストール**

#### **Nightly - macOS、Linux、WSL:**

```bash
git clone https://github.com/unslothai/unsloth
cd unsloth
git checkout nightly
./install.sh --local
```

その後、毎回起動するには:

```bash
unsloth studio -H 0.0.0.0 -p 8888
```

#### **Nightly - Windows:**

Windows PowerShell で実行:

```bash
winget install -e --id Python.Python.3.13 --source winget
winget install --id=astral-sh.uv  -e --source winget
winget install --id Git.Git -e --source winget
git clone https://github.com/unslothai/unsloth
cd unsloth
git checkout nightly
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
.\install.ps1 --local
```

その後、毎回起動するには:

<pre class="language-bash"><code class="lang-bash"><strong>unsloth studio -H 0.0.0.0 -p 8888
</strong></code></pre>

### **古いバージョンを使用する**

#### **Unsloth Desktop**

古いバージョンの Unsloth Desktop を使うのはとても簡単です。 [GitHub のリリース](https://github.com/unslothai/unsloth/releases) を見て、'Assets' 領域でインストールしたい特定のリリースを選択するだけです。

#### **Unsloth Studio**

古いバージョンの Unsloth Studio を使用するには、以下のように希望するバージョンと名前を指定してください:

**macOS、Linux、WSL:**

```shellscript
uv pip install \
  --python "$HOME/.unsloth/studio/unsloth_studio/bin/python" \
  --reinstall --no-deps "unsloth==VERSION"

"$HOME/.unsloth/studio/unsloth_studio/bin/unsloth" studio -p 8888
```

**Windows:**&#x20;

```shellscript
uv pip install `
  --python "$env:USERPROFILE\.unsloth\studio\unsloth_studio\Scripts\python.exe" `
  --reinstall --no-deps "unsloth==VERSION"

& "$env:USERPROFILE\.unsloth\studio\unsloth_studio\Scripts\unsloth.exe" studio -p 8888
```

### アンインストール

Unsloth Studio を完全に削除する推奨方法は、お使いの OS 用のアンインストールスクリプトです。実行中のサーバーを停止し、アプリ、CLI コマンド、ランチャーデータ、ショートカット、および OS 固有の項目（macOS `.app` バンドル + Launch Services; Windows のスタートメニュー + レジストリ + PATH）:

**macOS、WSL、Linux:**

```shellscript
curl -fsSL https://raw.githubusercontent.com/unslothai/unsloth/main/scripts/uninstall.sh | sh
```

**Windows（PowerShell）:**

```ps1
irm https://raw.githubusercontent.com/unslothai/unsloth/main/scripts/uninstall.ps1 | iex 
```

#### 手動アンインストール

特定の部分だけを削除したい場合は:

**1. アプリのみを削除** (履歴、チャット、チェックポイント、エクスポートは保持されます):

* **macOS、WSL、Linux:** `rm -rf ~/.unsloth/studio/unsloth_studio`
* **Windows（PowerShell）:** `Remove-Item -Recurse -Force "$HOME\.unsloth\studio\unsloth_studio"`

**2. Unsloth を完全に削除** (他の Unsloth ツールはそのまま残ります):

* **macOS、WSL、Linux:** `rm -rf ~/.unsloth/studio`
* **Windows（PowerShell）:** `Remove-Item -Recurse -Force "$HOME\.unsloth\studio"`

**3. Unsloth 関連のすべてを削除:**

* **macOS、WSL、Linux:** `rm -rf ~/.unsloth`
* **Windows（PowerShell）:** `Remove-Item -Recurse -Force "$HOME\.unsloth"`

{% hint style="warning" %}
注意: ステップ 3 は履歴、チャット、モデルのチェックポイント、エクスポートをすべて削除します。これは元に戻せません。
{% endhint %}

**4. ショートカットとシンボリックリンクを削除:**

**macOS:**

```shellscript
rm -rf ~/Applications/Unsloth\ Studio.app ~/Desktop/Unsloth\ Studio
```

**Linux:**&#x20;

```shellscript
rm -f ~/.local/share/applications/unsloth-studio.desktop ~/Desktop/unsloth-studio.desktop
```

**WSL / Windows（PowerShell）:**

```shellscript
Remove-Item -Force "$HOME\Desktop\Unsloth Studio.lnk"
Remove-Item -Force "$env:APPDATA\Microsoft\Windows\Start Menu\Programs\Unsloth Studio.lnk"
```

**5. CLI コマンドを削除:**

* **macOS、Linux、WSL:** `rm -f ~/.local/bin/unsloth`
* **Windows（PowerShell）:** インストーラーは venv の `Scripts` ディレクトリをユーザーの PATH に追加しました。削除するには、設定 → システム → バージョン情報 → 詳細システム設定 → 環境変数 を開き、 `Path` ユーザー変数の下にある `.unsloth\studio\...\Scripts`.

{% hint style="info" %}
注意: ステップ 1〜5 では、ダウンロード済みの HF モデルファイルには触れません。その容量を解放したい場合は、以下の「キャッシュされた HF モデルファイルの削除」を参照してください。
{% endhint %}

### **キャッシュされた HF モデルファイルの削除**

古いモデルファイルは、モデル検索のゴミ箱アイコンから削除するか、既定の Hugging Face キャッシュディレクトリから該当するキャッシュ済みモデルフォルダを削除することで消去できます。既定では、Hugging Face は `~/.cache/huggingface/hub/` macOS/Linux/WSL では `C:\Users\<username>\.cache\huggingface\hub\` Windows では

* **macOS、Linux、WSL:** `~/.cache/huggingface/hub/`
* **Windows:** `%USERPROFILE%\.cache\huggingface\hub\`

もし `HF_HUB_CACHE` または `HF_HOME` が設定されている場合は、代わりにその場所を使用してください。Linux と WSL では、 `XDG_CACHE_HOME` でも既定のキャッシュルートを変更できます。

## **Unsloth Core**

**以下のコマンドで uv をインストールします:**

**macOS、WSL、Linux:**

```shellscript
curl -LsSf https://astral.sh/uv/install.sh | sh
```

**Windows（PowerShell）:**

```powershell
irm https://astral.sh/uv/install.ps1 | iex
```

**最新の pip リリースでは、uv pip で unsloth core をインストールします（推奨）:**

```bash
uv venv unsloth_env --python 3.13
source unsloth_env/bin/activate
uv pip install unsloth --torch-backend=auto
```

あるいは、単に pip を使います:

```bash
pip install unsloth
```

インストールするには **vLLM と Unsloth** をまとめて、次のようにします:

```bash
uv pip install unsloth vllm --torch-backend=auto
```

以下をインストールするには **最新の main ブランチ** の Unsloth を、次のようにします:

{% code overflow="wrap" %}

```bash
uv pip install unsloth --torch-backend=auto
pip uninstall unsloth unsloth_zoo -y && pip install --no-deps git+https://github.com/unslothai/unsloth_zoo.git && pip install --no-deps git+https://github.com/unslothai/unsloth.git
```

{% endcode %}

以下の場合 **venv および仮想環境へのインストール** システムパッケージを壊さないようにインストールを分離し、システムへの修復不能な損害を減らすために、venv を使用してください:

{% code overflow="wrap" %}

```bash
apt install python3.10-venv python3.11-venv python3.12-venv python3.13-venv -y
python -m venv unsloth_env
source unsloth_env/bin/activate
pip install --upgrade pip && pip install uv
uv pip install unsloth --torch-backend=auto
```

{% endcode %}

Jupyter、Colab、その他のノートブックで Unsloth をインストールする場合は、コマンドの前に必ず `!`を付けてください。端末を使用する場合は必要ありません

{% hint style="info" %}
Python 3.13 がサポートされました!
{% endhint %}

### Unsloth Core をアンインストール

それでも Unsloth で依存関係の問題が発生する場合、多くのユーザーは Unsloth を強制アンインストールして再インストールすることで解決しています:

{% code overflow="wrap" %}

```bash
pip install --upgrade --force-reinstall --no-cache-dir --no-deps unsloth
pip install --upgrade --force-reinstall --no-cache-dir --no-deps unsloth_zoo
```

{% endcode %}

### 高度な Pip インストール

{% hint style="warning" %}
使わ **ないで** ください。次の場合は使用しないでください: [Conda](/docs/jp/meru/install/conda-install.md).
{% endhint %}

Pip は依存関係の問題があるため、少し複雑です。pip コマンドは以下で異なります: `torch 2.2,2.3,2.4,2.5` および CUDA のバージョン。

その他の torch バージョンについては、次をサポートしています: `torch211`, `torch212`, `torch220`, `torch230`, `torch240` また、CUDA バージョンについては次をサポートしています: `cu118` および `cu121` および `cu124`。Ampere デバイス（A100、H100、RTX3090）以上では、次を使用してください: `cu118-ampere` または `cu121-ampere` または `cu124-ampere`.

たとえば、次をお持ちの場合: `torch 2.4` および `CUDA 12.1`、次を使用します:

```bash
pip install --upgrade pip
pip install "unsloth[cu121-torch240] @ git+https://github.com/unslothai/unsloth.git"
```

別の例として、次をお持ちの場合: `torch 2.5` および `CUDA 12.4`、次を使用します:

```bash
pip install --upgrade pip
pip install "unsloth[cu124-torch250] @ git+https://github.com/unslothai/unsloth.git"
```

その他の例:

```bash
pip install "unsloth[cu121-ampere-torch240] @ git+https://github.com/unslothai/unsloth.git"
pip install "unsloth[cu118-ampere-torch240] @ git+https://github.com/unslothai/unsloth.git"
pip install "unsloth[cu121-torch240] @ git+https://github.com/unslothai/unsloth.git"
pip install "unsloth[cu118-torch240] @ git+https://github.com/unslothai/unsloth.git"

pip install "unsloth[cu121-torch230] @ git+https://github.com/unslothai/unsloth.git"
pip install "unsloth[cu121-ampere-torch230] @ git+https://github.com/unslothai/unsloth.git"

pip install "unsloth[cu121-torch250] @ git+https://github.com/unslothai/unsloth.git"
pip install "unsloth[cu124-ampere-torch250] @ git+https://github.com/unslothai/unsloth.git"
```

または、以下を端末で実行して **最適な** pip インストールコマンドを取得します:

```bash
wget -qO- https://raw.githubusercontent.com/unslothai/unsloth/main/unsloth/_auto_install.py | python -
```

または、以下を Python REPL で手動実行します:

{% code overflow="wrap" %}

```python
# Apache License, Version 2.0（「License」）の下でライセンスされています
try: import torch
except: raise ImportError('torch を `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} はサポートされていません!")
if   v <= V('2.1.0'): raise RuntimeError(f"Torch = {v} は古すぎます!")
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} は新しすぎます!")
if v > V('2.6.9') and cuda not in ("11.8", "12.6", "12.8", "13.0"): raise RuntimeError(f"CUDA = {cuda} はサポートされていません!")
x = x.format(cuda.replace(".", ""), "-ampere" if False else "") # is_ampere は 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')
```

{% endcode %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://unsloth.ai/docs/jp/meru/install/pip-install.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
