# セッションを開始

> セッションを開始 - Run and manage a DataRobot codespace session.

This Markdown file sits beside the HTML page at the same path (with a `.md` suffix). It summarizes the topic and lists links for tools and LLM context.

Companion generated at `2026-10-09T14:18:51.469667+00:00` (UTC).

## Primary page

- [セッションを開始](https://docs.datarobot.com/ja/docs/workbench/notebook/codespaces/session-cs.html.md): Full documentation for this topic (Markdown sidecar).

## Sections on this page

- [Codespaceを追加](https://docs.datarobot.com/ja/docs/workbench/notebook/codespaces/session-cs.html.md#add-a-codespace): In-page section heading.
- [Codespaceセッションの開始](https://docs.datarobot.com/ja/docs/workbench/notebook/codespaces/session-cs.html.md#start-a-codespace-session): In-page section heading.
- [Codespaceの環境変数](https://docs.datarobot.com/ja/docs/workbench/notebook/codespaces/session-cs.html.md#codespace-environment-variables): In-page section heading.
- [Work with files](https://docs.datarobot.com/ja/docs/workbench/notebook/codespaces/session-cs.html.md#work-with-files): In-page section heading.
- [Codespaceでのノートブックの操作](https://docs.datarobot.com/ja/docs/workbench/notebook/codespaces/session-cs.html.md#work-with-notebooks-in-a-codespace): In-page section heading.
- [ノートブック以外のファイルの操作](https://docs.datarobot.com/ja/docs/workbench/notebook/codespaces/session-cs.html.md#work-with-non-notebook-files): In-page section heading.
- [永続的な依存関係のインストール](https://docs.datarobot.com/ja/docs/workbench/notebook/codespaces/session-cs.html.md#persistent-dependency-installations): In-page section heading.
- [永続的な依存関係のインストールを無効化](https://docs.datarobot.com/ja/docs/workbench/notebook/codespaces/session-cs.html.md#disable-persistent-dependency-installations): In-page section heading.
- [依存関係のインストールに関する注意事項](https://docs.datarobot.com/ja/docs/workbench/notebook/codespaces/session-cs.html.md#dependency-installation-considerations): In-page section heading.
- [DataRobotパッケージ](https://docs.datarobot.com/ja/docs/workbench/notebook/codespaces/session-cs.html.md#datarobot-packages): In-page section heading.
- [依存関係の更新](https://docs.datarobot.com/ja/docs/workbench/notebook/codespaces/session-cs.html.md#updating-dependencies): In-page section heading.
- [インポート元の確認](https://docs.datarobot.com/ja/docs/workbench/notebook/codespaces/session-cs.html.md#check-import-locations): In-page section heading.
- [次のステップ](https://docs.datarobot.com/ja/docs/workbench/notebook/codespaces/session-cs.html.md#next-steps): In-page section heading.

## Documentation content

Codespaceはユースケースのアセットです。 They store notebooks and associated files. このページでは、codespaceセッションの開始方法、codespaceへのファイルのアップロード方法、codespaceの内容の管理方法について説明します。 You can view and manage codespaces from the Notebooks tile of the Use Case home page.

> [!NOTE] 共有
> 個々のcodespaceを他のユーザーと直接共有することはできませんが、ワークベンチでは、codespaceを含むユースケースを共有できます。 したがって、codespaceを他のユーザーと共有するには、 [ユースケース全体を共有](https://docs.datarobot.com/ja/docs/workbench/build-workbench/usecases/build-usecase.html.md#share) して、すべての関連アセットにアクセスできるようにする必要があります。

Review the capabilities overview and limits in the tabs below.

**機能の概要:**
CodespaceとDataRobotのノートブックの機能的な違いを理解するために、以下の表を確認してください。

機能性
DataRobot Notebook
Codespace
メタデータ（タグ/説明）
はい（ノートブックレベルで）
はい（Codespaceレベルで）
Git連携
いいえ
はい
永続的なファイルシステム
いいえ
はい
ファイルエディター
いいえ
はい
ターミナル
はい
はい
バージョン管理
はい（組み込みのリビジョン履歴）
はい（外部Gitリポジトリを介して制御）
環境変数
はい（ノートブックレベルで）
はい（Codespaceレベルで）
セッション
はい（ノートブックごとに1つのコンテナセッション）
はい（Codespaceごとに1つのコンテナセッション）
Local IDE over SSH
いいえ
はい
ノートブックのスケジューリング
はい
はい

**制限:**
Codespaceには、以下の制限があります。

制限
値
ファイルシステム制限
ノートブック以外の個々のファイルの最大アップロードサイズ
1GB
各codespaceファイルシステムの最大サイズ
20GB
セッション制限
組織あたりのcodespaceの最大数（デフォルト）
50
.ipynbファイルで使用される、アクティブなCodespaceノートブックカーネルの最大数
5
セッション内の制限
個々のノートブック (.ipynb) ファイルの最大サイズ
25MB
（タブファイルエディター内で）同時に開くノートブックファイルの最大数
5


## Codespaceを追加

To get started creating a codespace:

1. Navigate to the Use Case in which you want the codespace included and expand theAdddropdown. Hover on **Codespace and click:

**Codespaceを追加:**
Using the Add options create a new codespace. After selecting, click Start session. Codespace initialization begins.

[https://docs.datarobot.com/ja/docs/images/codespace-2.png](https://docs.datarobot.com/ja/docs/images/codespace-2.png)

**Codespaceをアップロード:**
You can upload a local folder with a collection of files or use a Git URL to create the codespace on DataRobot.アップロード をクリックすると、新しいcodespaceが作成され、codespaceセッションが起動し、選択したファイルがcodespaceファイルシステムにアップロードされます。

[https://docs.datarobot.com/ja/docs/images/upload-codespace.png](https://docs.datarobot.com/ja/docs/images/upload-codespace.png)

既存のパブリックGitリポジトリから新しいcodespaceを作成することもできます。 アップロードモーダルで、クローンを作成するリポジトリのGitリポジトリURLを指定します。 アップロード をクリックすると、新しいcodespaceが作成され、codespaceセッションが起動し、Gitリポジトリのクローンがcodespaceファイルシステムに作成されます。 プライベートリポジトリのクローンをcodespaceに作成する場合は、まず新しい空のcodespaceを作成し、 [ターミナルからGit CLIを使用して、リポジトリのクローンを作成する](https://docs.datarobot.com/ja/docs/workbench/notebook/codespaces/git-provider-cs.html.md) 必要があります。 Integrating the Git provider with DataRobot allows DataRobot access to your repositories using the OAuth 2.0 standard.


## Codespaceセッションの開始

Codespaceのファイルシステムの内容を管理したり、そのファイルを編集して実行したりするには、まずcodespaceの環境を起動する必要があります。 Click the Session environment tile to configure the [environment](https://docs.datarobot.com/ja/docs/workbench/notebook/code-nb/env-nb.html.md#manage-the-notebook-environment). 環境イメージは、ノートブック内で使用されるコーディング言語、依存関係、およびオープンソースライブラリを決定します。 The default image for a codespace is a pre-built Python image but you can also use a [custom environment](https://docs.datarobot.com/ja/docs/workbench/notebook/code-nb/env-nb.html.md#manage-the-notebook-environment) for the codespace session.

Once the environment is selected, you can choose a version ior use the default `Latest`. Then, start the container by toggling it on in the toolbar. 環境が初期化されるまでしばらく待ち、「開始済み」ステータスが表示されたら、codespaceの操作を開始できます。

> [!NOTE] 備考
> The Python 3.11 version will be deprecated in a future relase.

### Codespaceの環境変数

Codespaceのエンティティの場合、環境変数は、個々のノートブックファイルレベルではなく、codespaceレベルで定義されます。 Codespaceセッションが開始されると、DataRobotは、 環境変数 タブで定義されたすべての環境変数を設定します。 これらの環境変数は、codespaceファイルシステム内のどのノートブックからでも、コードを介して取得できる。

To access environment variables, click the Environment variables tile in the sidebar. 次に、 新しいエントリーを作成 をクリックします。 ダイアログボックスで、1つのエントリーのキーと値を入力します。必要に応じて説明を入力します。

To add multiple variables, select Bulk import from the entry dropdown. エントリーウィンドウで、変数を1行に1つずつ以下の形式で入力します。

`KEY=VALUE # DESCRIPTION`

> [!NOTE] 備考
> 同じキーを持つ既存の環境変数の値は、指定した新しい値によって上書きされます。

環境変数の追加が完了したら、 保存 をクリックします。

## Work with files

Each codespace consists of its own persistent file system, which is mounted to the path `/home/notebooks/storage/` when the session begins. (You must start the codespace's environment before uploading files to it.) Click the Files tile in the left sideabar to upload and manage files and folders. ファイルブラウザーのUIから、フォルダー、ノートブックファイル、ノートブック以外のファイルを新規作成することもできます。 To work with notebooks, upload `.ipynb` files.

Use the icons to:

- Create a notebook, file, or directory.
- Manage file content (copy, cut, paste, and delete).

|  | フィールド | 説明 |
| --- | --- | --- |
| (1) | ノートブックを作成 | 実行可能な.ipynbファイルを作成します。 ノートブックファイルの名前を入力します。 |
| (2) | ファイルを作成 | Codespaceの現在のフォルダーに新規ファイルを作成します。 名前を入力し、拡張子でファイルタイプを指定します。 ファイルを作成すると、codespaceフォルダーの一部として表示されます。 |
| (3) | ディレクトリを作成 | Codespaceの現在のフォルダー内に別のフォルダーを作成します。 フォルダーの名前を入力します。 |

> [!NOTE] Managed SaaS users only
> For Managed SaaS AI Platform users, DataRobot provides backup functionality and retention policies for codespaces. DataRobot takes snapshots of the codespace volume on session shutdown and on codespace deletion and will retain the contents for 30 days if you need to restore the codespace data.

To manage or edit files from directly within a codespace, expand the Actions menu to the right of the file to view the available actions.

### Codespaceでのノートブックの操作

To edit and execute a notebook within a codespace, double click on a notebook file ( `.ipynb`) in the file browser to open it. Codespaceのインターフェイスはタブ操作に対応しているので、複数のファイルを同時に開き、表示、編集することができます。ードスペースのインターフェイスはタブ操作に対応しているので、 Jupyterと同様に、ノートブックファイルを開くと、そのノートブックのカーネルプロセスが開始されます。 開かれたノートブックは、それぞれ独自のカーネルで実行されます。

DataRobotでは、アクティブなカーネルで実行されているノートブックを、ファイルブラウザーに紫色のノートブックアイコンで示します。 非アクティブなノートブックには白いアイコンが表示されます。

カーネルをシャットダウンするには、ノートブックファイルの アクションメニュー を開き、 カーネルをシャットダウン を選択します。

### ノートブック以外のファイルの操作

Codespaceでは、ノートブックの編集と実行に加えて、他の種類のファイルを表示および編集するためのテキストエディターも用意されています。 たとえば、以下に示すように、イメージファイルの表示やPythonユーティリティスクリプトの編集ができます。

## 永続的な依存関係のインストール

アクティブなセッション中にランタイムのカスタム依存関係をcodespaceにインストールすると、Pythonとpipの依存関係および [Hugging Faceのアーティファクト](https://huggingface.co/docs/hub/en/models-the-hub) は、ユーザーの仮想環境にインストールされている場合、セッションをまたいで持続することができます。 この永続的な依存関係のインストール機能は、Pythonベースのイメージがcodespaceセッションに使用されている場合にのみサポートされます。

Codespaceには、2つの仮想環境があります。

- ユーザー仮想環境(/home/notebooks/storage/.venv)：ランタイムにインストールされたカスタム依存関係をすべてのcodespaceセッションで持続させる新しいユーザー仮想環境。 この仮想環境はcodespaceに関連付けられます（codespaceのファイルシステムで永続化されるため）。したがって、codespaceにアクセスできるすべてのユーザーは、codespaceのセッションを開始すると、同じ永続化されたpipのインストールセットにアクセスできます。
- カーネル仮想環境(/etc/system/kernel/.venv)：選択されたノートブック環境イメージの一部としてDataRobotが提供するすべての依存関係を保持する、ビルトインイメージの仮想環境。 この仮想環境では、インストールしたカスタム依存関係は持続しませんが、セッション中は維持されます。

UIからユーザー仮想環境に直接アクセスすることはできませんが（codespaceのファイルシステムパネルには表示されません）、 [ターミナル経由](https://docs.datarobot.com/ja/docs/workbench/notebook/code-nb/terminal-nb.html.md) でアクセスできます。 ここで `!pip install <PACKAGE_NAME>` を実行して、セッションをまたいで持続するカスタム依存関係をインストールできます。

デフォルトでは、 `!pip install` によってインストールした新しい依存関係はすべて、ユーザー仮想環境に入ります。 ノートブックのビルトインイメージの一部としてDataRobotが提供するライブラリの別バージョンをインストールする場合は、ユーザー仮想環境が優先されます。

### 永続的な依存関係のインストールを無効化

指定したcodespaceで永続的な依存関係のインストールを無効にしたい場合、最初に新しい環境変数 `NOTEBOOKS_NO_PERSISTENT_DEPENDENCIES=1` をcodespaceに追加します。 次に、codespaceのターミナルから `rm -rf /home/notebooks/storage/.venv` を実行して、既存のユーザー仮想環境を削除します。 その後、codespaceセッションを再起動します。 ランタイムにインストールされたPythonの依存関係は、セッション間で維持されなくなります。

### 依存関係のインストールに関する注意事項

#### DataRobotパッケージ

依存関係のインストール機能を使用して `datarobotx` パッケージまたは新しいバージョンの `datarobot` パッケージ（ビルトインイメージにプリインストールされているものよりも新しいバージョン）をインストールすると、DataRobotパッケージ（ `datarobot-mlops-connected-client` など）にインストールするプリインストール済みDataRobotパッケージが壊れる可能性があります。 これは、アクティブなCodespaceセッションで新しいパッケージまたは既存のパッケージの新しいバージョンをインストールすると、カーネル仮想環境よりも優先されるユーザーの仮想環境にインストールされるためです。 `datarobotx` パッケージをインストールすると、ユーザーの仮想環境に `datarobot` パッケージが作成され、カーネル環境に正しくインストールできなくなります。 これにより、 `datarobot-mlops-connected-client` のようなパッケージを正常にインストールできません。ただし、pip（または任意のパッケージマネージャー）は、引き続きパッケージをインストール済みとして登録します。

このエラーを解決するには、 `datarobot` パッケージ（ `datarobot-mlops-connected-client` など）を拡張するすべてのシャドウライブラリに対して `--force-reinstall` を付けて `pip install` を実行します。 例 `pip install datarobot-mlops-connected-client --force-reinstall` 。

#### 依存関係の更新

依存関係をインポートした後、時間の経過とともにアップグレードすることができます。 Because DataRobot does not automatically recognize these dependency changes, you must restart the kernel in order for DataRobot to recognize the changes. そうするには、ツールバーにある再起動アイコン（円形の矢印）をクリックします。

#### インポート元の確認

依存関係のインポート元を確認するには、ノートブックセルまたはターミナルで次のコマンドを実行します。

```
pip list -v 
```

```
Package                          Version      Location                                             Installer
-------------------------------- ------------ ---------------------------------------------------- ---------
...
datarobot                        3.3.0        /etc/system/kernel/.venv/lib/python3.9/site-packages pip
... 
```

ユーザー仮想環境のサイズを確認するには、ターミナルで次のコマンドを実行します。

```
(.venv) [notebooks@kernel ~/storage]$ du -h . -d 1
14M     ./.venv
14M     . 
```

ユーザー仮想環境が壊れていると思われ、再作成する場合は、ターミナルで次のコマンドを実行します。

```
rm -rf /home/notebooks/storage/.venv
python -m venv /home/notebooks/storage/.venv 
```

## 次のステップ

With a codespace session running, automate notebook runs on a schedule or use the integrated terminal to manage your environment further.

- Connect a local IDE to a codespace : Open the codespace from Visual Studio Code over SSH.
- Codespace scheduling : Automate code-based workflows by scheduling notebooks in a codespace to run in non-interactive mode.
- Notebook terminals : Use the integrated terminal to run shell commands, install packages, and execute scripts in a codespace session.
- Manage the notebook environment : Configure the resource type, environment image, and inactivity timeout for a codespace session.
