diff --git a/README.md b/README.md index 0fc1f95..4eeabe3 100644 --- a/README.md +++ b/README.md @@ -1,32 +1,38 @@ # Jupyter Lab +次の2種類を用意しています。 +- CPU 版 +- GPU 版 (CUDA 13.0.0 cuDNN) + +GPU 対応バージョンを変更する場合は、 +jupyter_gpu/Docker ファイルの FROM を適宜修正ください。 + +# CPU 版 +``` # イメージ作成 - -* GPU対応の場合 -``` -cp jupyter/Dockerfile.gpu jupyter/Dockerfile -docker compose build -``` - - -* CPU の場合 -``` -cp jupyter/Dockerfile.cpu jupyter/Dockerfile -docker compose build -``` - +docker compose --profile jupyter build # 起動 -docker compose up -d +docker compose --profile jupyter up -d +``` +# GPU 版 (CUDA 13.0.0 cuDNN) +``` +# イメージ作成 +docker compose --profile jupyter_gpu build -# 終了 -docker compose down - +# 起動 +docker compose --profile jupyter_gpu up -d +``` # Jupyter Lab へのアクセス http://localhost:8000/lab?token=jupyter notebook 配下にファイルが保存されます。 +パッケージの追加等は、uv にて可能です。 +``` +!uv add <パッケージ> +``` + diff --git a/README.md b/README.md index 0fc1f95..4eeabe3 100644 --- a/README.md +++ b/README.md @@ -1,32 +1,38 @@ # Jupyter Lab +次の2種類を用意しています。 +- CPU 版 +- GPU 版 (CUDA 13.0.0 cuDNN) + +GPU 対応バージョンを変更する場合は、 +jupyter_gpu/Docker ファイルの FROM を適宜修正ください。 + +# CPU 版 +``` # イメージ作成 - -* GPU対応の場合 -``` -cp jupyter/Dockerfile.gpu jupyter/Dockerfile -docker compose build -``` - - -* CPU の場合 -``` -cp jupyter/Dockerfile.cpu jupyter/Dockerfile -docker compose build -``` - +docker compose --profile jupyter build # 起動 -docker compose up -d +docker compose --profile jupyter up -d +``` +# GPU 版 (CUDA 13.0.0 cuDNN) +``` +# イメージ作成 +docker compose --profile jupyter_gpu build -# 終了 -docker compose down - +# 起動 +docker compose --profile jupyter_gpu up -d +``` # Jupyter Lab へのアクセス http://localhost:8000/lab?token=jupyter notebook 配下にファイルが保存されます。 +パッケージの追加等は、uv にて可能です。 +``` +!uv add <パッケージ> +``` + diff --git a/docker-compose.yaml b/docker-compose.yaml index ad65041..d415735 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,4 +1,25 @@ services: + jupyter_gpu: + build: + context: ./jupyter_gpu + dockerfile: Dockerfile + image: jupyter_gpu:cuda-12.6-cudnn-runtime + ports: + - 0.0.0.0:8000:8000 + volumes: + - ./notebook:/opt/jupyter/jupyterlab/notebook + tty: true + #environment: + # - NVIDIA_DISABLE_REQUIRE: true + deploy: + resources: + reservations: + devices: + - driver: nvidia + count: 1 + capabilities: [gpu] + profiles: + - jupyter_gpu jupyter: build: context: ./jupyter @@ -7,15 +28,8 @@ ports: - 0.0.0.0:8000:8000 volumes: - - ./notebook:/opt/jupyter/jupyterlab + - ./notebook:/opt/jupyter/jupyterlab/notebook tty: true - deploy: - resources: - reservations: - devices: - - driver: nvidia - count: 1 - capabilities: [gpu] - - + profiles: + - jupyter diff --git a/README.md b/README.md index 0fc1f95..4eeabe3 100644 --- a/README.md +++ b/README.md @@ -1,32 +1,38 @@ # Jupyter Lab +次の2種類を用意しています。 +- CPU 版 +- GPU 版 (CUDA 13.0.0 cuDNN) + +GPU 対応バージョンを変更する場合は、 +jupyter_gpu/Docker ファイルの FROM を適宜修正ください。 + +# CPU 版 +``` # イメージ作成 - -* GPU対応の場合 -``` -cp jupyter/Dockerfile.gpu jupyter/Dockerfile -docker compose build -``` - - -* CPU の場合 -``` -cp jupyter/Dockerfile.cpu jupyter/Dockerfile -docker compose build -``` - +docker compose --profile jupyter build # 起動 -docker compose up -d +docker compose --profile jupyter up -d +``` +# GPU 版 (CUDA 13.0.0 cuDNN) +``` +# イメージ作成 +docker compose --profile jupyter_gpu build -# 終了 -docker compose down - +# 起動 +docker compose --profile jupyter_gpu up -d +``` # Jupyter Lab へのアクセス http://localhost:8000/lab?token=jupyter notebook 配下にファイルが保存されます。 +パッケージの追加等は、uv にて可能です。 +``` +!uv add <パッケージ> +``` + diff --git a/docker-compose.yaml b/docker-compose.yaml index ad65041..d415735 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,4 +1,25 @@ services: + jupyter_gpu: + build: + context: ./jupyter_gpu + dockerfile: Dockerfile + image: jupyter_gpu:cuda-12.6-cudnn-runtime + ports: + - 0.0.0.0:8000:8000 + volumes: + - ./notebook:/opt/jupyter/jupyterlab/notebook + tty: true + #environment: + # - NVIDIA_DISABLE_REQUIRE: true + deploy: + resources: + reservations: + devices: + - driver: nvidia + count: 1 + capabilities: [gpu] + profiles: + - jupyter_gpu jupyter: build: context: ./jupyter @@ -7,15 +28,8 @@ ports: - 0.0.0.0:8000:8000 volumes: - - ./notebook:/opt/jupyter/jupyterlab + - ./notebook:/opt/jupyter/jupyterlab/notebook tty: true - deploy: - resources: - reservations: - devices: - - driver: nvidia - count: 1 - capabilities: [gpu] - - + profiles: + - jupyter diff --git a/jupyter/Dockerfile b/jupyter/Dockerfile index c98acf4..db5bfab 100644 --- a/jupyter/Dockerfile +++ b/jupyter/Dockerfile @@ -1,8 +1,9 @@ -FROM python:3.10.17-bookworm +FROM python:3.10.18-bookworm ENV DEBIAN_FRONTEND=noninteractive # ENV http_proxy=http://127.0.0.1:3128/ # ENV https_proxy=http://127.0.0.1:3128/ +# ENV no_proxy=localhost,127.0.0.1 # 必要パッケージインストール RUN \ @@ -13,9 +14,6 @@ wget \ git \ curl \ - python3 \ - python3-dev \ - python3-pip \ ffmpeg \ postgresql-client \ && \ @@ -31,7 +29,7 @@ WORKDIR /opt/jupyter # ollama インストール -# RUN curl -fsSL https://ollama.com/install.sh | sh +RUN curl -fsSL https://ollama.com/install.sh | sh # uv インストール RUN curl -LsSf https://astral.sh/uv/install.sh | sh @@ -41,19 +39,20 @@ # python インストール RUN uv python install -COPY ./pyproject.toml /opt/jupyter/ + +# Jupyter Lab 実行時の作業ディレクトリ +WORKDIR /opt/jupyter/jupyterlab +COPY --chown=jupyter:jupyter ./pyproject.toml /opt/jupyter/jupyterlab RUN uv sync -RUN uv run --with jupyter jupyter lab --generate-config && \ +RUN uv run jupyter lab --generate-config && \ sed -i \ -e "s/^# c.ServerApp.ip.*$/c.ServerApp.ip = '0.0.0.0'/" \ -e "s/^# c.ServerApp.port.*$/c.ServerApp.port = 8000/" \ -e "s/^# c.ServerApp.password_required.*$/c.ServerApp.password_required = False/" \ -e "s/^# c.ServerApp.token.*$/c.ServerApp.token = 'jupyter'/" \ + -e "s/^# c.ServerApp.notebook_dir.*$/c.ServerApp.notebook_dir = '\/opt\/jupyter\/jupyterlab\/notebook'/" \ ~/.jupyter/jupyter_lab_config.py -# Jupyter Lab 実行時の作業ディレクトリ -WORKDIR /opt/jupyter/jupyterlab - -CMD ["uv", "run", "--with", "jupyter", "jupyter", "lab"] +CMD ["uv", "run", "jupyter", "lab"] diff --git a/README.md b/README.md index 0fc1f95..4eeabe3 100644 --- a/README.md +++ b/README.md @@ -1,32 +1,38 @@ # Jupyter Lab +次の2種類を用意しています。 +- CPU 版 +- GPU 版 (CUDA 13.0.0 cuDNN) + +GPU 対応バージョンを変更する場合は、 +jupyter_gpu/Docker ファイルの FROM を適宜修正ください。 + +# CPU 版 +``` # イメージ作成 - -* GPU対応の場合 -``` -cp jupyter/Dockerfile.gpu jupyter/Dockerfile -docker compose build -``` - - -* CPU の場合 -``` -cp jupyter/Dockerfile.cpu jupyter/Dockerfile -docker compose build -``` - +docker compose --profile jupyter build # 起動 -docker compose up -d +docker compose --profile jupyter up -d +``` +# GPU 版 (CUDA 13.0.0 cuDNN) +``` +# イメージ作成 +docker compose --profile jupyter_gpu build -# 終了 -docker compose down - +# 起動 +docker compose --profile jupyter_gpu up -d +``` # Jupyter Lab へのアクセス http://localhost:8000/lab?token=jupyter notebook 配下にファイルが保存されます。 +パッケージの追加等は、uv にて可能です。 +``` +!uv add <パッケージ> +``` + diff --git a/docker-compose.yaml b/docker-compose.yaml index ad65041..d415735 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,4 +1,25 @@ services: + jupyter_gpu: + build: + context: ./jupyter_gpu + dockerfile: Dockerfile + image: jupyter_gpu:cuda-12.6-cudnn-runtime + ports: + - 0.0.0.0:8000:8000 + volumes: + - ./notebook:/opt/jupyter/jupyterlab/notebook + tty: true + #environment: + # - NVIDIA_DISABLE_REQUIRE: true + deploy: + resources: + reservations: + devices: + - driver: nvidia + count: 1 + capabilities: [gpu] + profiles: + - jupyter_gpu jupyter: build: context: ./jupyter @@ -7,15 +28,8 @@ ports: - 0.0.0.0:8000:8000 volumes: - - ./notebook:/opt/jupyter/jupyterlab + - ./notebook:/opt/jupyter/jupyterlab/notebook tty: true - deploy: - resources: - reservations: - devices: - - driver: nvidia - count: 1 - capabilities: [gpu] - - + profiles: + - jupyter diff --git a/jupyter/Dockerfile b/jupyter/Dockerfile index c98acf4..db5bfab 100644 --- a/jupyter/Dockerfile +++ b/jupyter/Dockerfile @@ -1,8 +1,9 @@ -FROM python:3.10.17-bookworm +FROM python:3.10.18-bookworm ENV DEBIAN_FRONTEND=noninteractive # ENV http_proxy=http://127.0.0.1:3128/ # ENV https_proxy=http://127.0.0.1:3128/ +# ENV no_proxy=localhost,127.0.0.1 # 必要パッケージインストール RUN \ @@ -13,9 +14,6 @@ wget \ git \ curl \ - python3 \ - python3-dev \ - python3-pip \ ffmpeg \ postgresql-client \ && \ @@ -31,7 +29,7 @@ WORKDIR /opt/jupyter # ollama インストール -# RUN curl -fsSL https://ollama.com/install.sh | sh +RUN curl -fsSL https://ollama.com/install.sh | sh # uv インストール RUN curl -LsSf https://astral.sh/uv/install.sh | sh @@ -41,19 +39,20 @@ # python インストール RUN uv python install -COPY ./pyproject.toml /opt/jupyter/ + +# Jupyter Lab 実行時の作業ディレクトリ +WORKDIR /opt/jupyter/jupyterlab +COPY --chown=jupyter:jupyter ./pyproject.toml /opt/jupyter/jupyterlab RUN uv sync -RUN uv run --with jupyter jupyter lab --generate-config && \ +RUN uv run jupyter lab --generate-config && \ sed -i \ -e "s/^# c.ServerApp.ip.*$/c.ServerApp.ip = '0.0.0.0'/" \ -e "s/^# c.ServerApp.port.*$/c.ServerApp.port = 8000/" \ -e "s/^# c.ServerApp.password_required.*$/c.ServerApp.password_required = False/" \ -e "s/^# c.ServerApp.token.*$/c.ServerApp.token = 'jupyter'/" \ + -e "s/^# c.ServerApp.notebook_dir.*$/c.ServerApp.notebook_dir = '\/opt\/jupyter\/jupyterlab\/notebook'/" \ ~/.jupyter/jupyter_lab_config.py -# Jupyter Lab 実行時の作業ディレクトリ -WORKDIR /opt/jupyter/jupyterlab - -CMD ["uv", "run", "--with", "jupyter", "jupyter", "lab"] +CMD ["uv", "run", "jupyter", "lab"] diff --git a/jupyter/Dockerfile.cpu b/jupyter/Dockerfile.cpu deleted file mode 100644 index c98acf4..0000000 --- a/jupyter/Dockerfile.cpu +++ /dev/null @@ -1,59 +0,0 @@ -FROM python:3.10.17-bookworm - -ENV DEBIAN_FRONTEND=noninteractive -# ENV http_proxy=http://127.0.0.1:3128/ -# ENV https_proxy=http://127.0.0.1:3128/ - -# 必要パッケージインストール -RUN \ - apt-get update && \ - apt-get -y upgrade && \ - apt-get install -y \ - sudo \ - wget \ - git \ - curl \ - python3 \ - python3-dev \ - python3-pip \ - ffmpeg \ - postgresql-client \ - && \ - rm -rf /var/lib/apt/lists/* - - -# ユーザー追加 -RUN useradd -m jupyter --home-dir /opt/jupyter && \ - echo "jupyter ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/jupyter - -# jupyter ユーザーで実行 -USER jupyter -WORKDIR /opt/jupyter - -# ollama インストール -# RUN curl -fsSL https://ollama.com/install.sh | sh - -# uv インストール -RUN curl -LsSf https://astral.sh/uv/install.sh | sh - -# uv 環境変数設定 -ENV PATH /opt/jupyter/.local/bin:$PATH - -# python インストール -RUN uv python install -COPY ./pyproject.toml /opt/jupyter/ - -RUN uv sync -RUN uv run --with jupyter jupyter lab --generate-config && \ - sed -i \ - -e "s/^# c.ServerApp.ip.*$/c.ServerApp.ip = '0.0.0.0'/" \ - -e "s/^# c.ServerApp.port.*$/c.ServerApp.port = 8000/" \ - -e "s/^# c.ServerApp.password_required.*$/c.ServerApp.password_required = False/" \ - -e "s/^# c.ServerApp.token.*$/c.ServerApp.token = 'jupyter'/" \ - ~/.jupyter/jupyter_lab_config.py - -# Jupyter Lab 実行時の作業ディレクトリ -WORKDIR /opt/jupyter/jupyterlab - -CMD ["uv", "run", "--with", "jupyter", "jupyter", "lab"] - diff --git a/README.md b/README.md index 0fc1f95..4eeabe3 100644 --- a/README.md +++ b/README.md @@ -1,32 +1,38 @@ # Jupyter Lab +次の2種類を用意しています。 +- CPU 版 +- GPU 版 (CUDA 13.0.0 cuDNN) + +GPU 対応バージョンを変更する場合は、 +jupyter_gpu/Docker ファイルの FROM を適宜修正ください。 + +# CPU 版 +``` # イメージ作成 - -* GPU対応の場合 -``` -cp jupyter/Dockerfile.gpu jupyter/Dockerfile -docker compose build -``` - - -* CPU の場合 -``` -cp jupyter/Dockerfile.cpu jupyter/Dockerfile -docker compose build -``` - +docker compose --profile jupyter build # 起動 -docker compose up -d +docker compose --profile jupyter up -d +``` +# GPU 版 (CUDA 13.0.0 cuDNN) +``` +# イメージ作成 +docker compose --profile jupyter_gpu build -# 終了 -docker compose down - +# 起動 +docker compose --profile jupyter_gpu up -d +``` # Jupyter Lab へのアクセス http://localhost:8000/lab?token=jupyter notebook 配下にファイルが保存されます。 +パッケージの追加等は、uv にて可能です。 +``` +!uv add <パッケージ> +``` + diff --git a/docker-compose.yaml b/docker-compose.yaml index ad65041..d415735 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,4 +1,25 @@ services: + jupyter_gpu: + build: + context: ./jupyter_gpu + dockerfile: Dockerfile + image: jupyter_gpu:cuda-12.6-cudnn-runtime + ports: + - 0.0.0.0:8000:8000 + volumes: + - ./notebook:/opt/jupyter/jupyterlab/notebook + tty: true + #environment: + # - NVIDIA_DISABLE_REQUIRE: true + deploy: + resources: + reservations: + devices: + - driver: nvidia + count: 1 + capabilities: [gpu] + profiles: + - jupyter_gpu jupyter: build: context: ./jupyter @@ -7,15 +28,8 @@ ports: - 0.0.0.0:8000:8000 volumes: - - ./notebook:/opt/jupyter/jupyterlab + - ./notebook:/opt/jupyter/jupyterlab/notebook tty: true - deploy: - resources: - reservations: - devices: - - driver: nvidia - count: 1 - capabilities: [gpu] - - + profiles: + - jupyter diff --git a/jupyter/Dockerfile b/jupyter/Dockerfile index c98acf4..db5bfab 100644 --- a/jupyter/Dockerfile +++ b/jupyter/Dockerfile @@ -1,8 +1,9 @@ -FROM python:3.10.17-bookworm +FROM python:3.10.18-bookworm ENV DEBIAN_FRONTEND=noninteractive # ENV http_proxy=http://127.0.0.1:3128/ # ENV https_proxy=http://127.0.0.1:3128/ +# ENV no_proxy=localhost,127.0.0.1 # 必要パッケージインストール RUN \ @@ -13,9 +14,6 @@ wget \ git \ curl \ - python3 \ - python3-dev \ - python3-pip \ ffmpeg \ postgresql-client \ && \ @@ -31,7 +29,7 @@ WORKDIR /opt/jupyter # ollama インストール -# RUN curl -fsSL https://ollama.com/install.sh | sh +RUN curl -fsSL https://ollama.com/install.sh | sh # uv インストール RUN curl -LsSf https://astral.sh/uv/install.sh | sh @@ -41,19 +39,20 @@ # python インストール RUN uv python install -COPY ./pyproject.toml /opt/jupyter/ + +# Jupyter Lab 実行時の作業ディレクトリ +WORKDIR /opt/jupyter/jupyterlab +COPY --chown=jupyter:jupyter ./pyproject.toml /opt/jupyter/jupyterlab RUN uv sync -RUN uv run --with jupyter jupyter lab --generate-config && \ +RUN uv run jupyter lab --generate-config && \ sed -i \ -e "s/^# c.ServerApp.ip.*$/c.ServerApp.ip = '0.0.0.0'/" \ -e "s/^# c.ServerApp.port.*$/c.ServerApp.port = 8000/" \ -e "s/^# c.ServerApp.password_required.*$/c.ServerApp.password_required = False/" \ -e "s/^# c.ServerApp.token.*$/c.ServerApp.token = 'jupyter'/" \ + -e "s/^# c.ServerApp.notebook_dir.*$/c.ServerApp.notebook_dir = '\/opt\/jupyter\/jupyterlab\/notebook'/" \ ~/.jupyter/jupyter_lab_config.py -# Jupyter Lab 実行時の作業ディレクトリ -WORKDIR /opt/jupyter/jupyterlab - -CMD ["uv", "run", "--with", "jupyter", "jupyter", "lab"] +CMD ["uv", "run", "jupyter", "lab"] diff --git a/jupyter/Dockerfile.cpu b/jupyter/Dockerfile.cpu deleted file mode 100644 index c98acf4..0000000 --- a/jupyter/Dockerfile.cpu +++ /dev/null @@ -1,59 +0,0 @@ -FROM python:3.10.17-bookworm - -ENV DEBIAN_FRONTEND=noninteractive -# ENV http_proxy=http://127.0.0.1:3128/ -# ENV https_proxy=http://127.0.0.1:3128/ - -# 必要パッケージインストール -RUN \ - apt-get update && \ - apt-get -y upgrade && \ - apt-get install -y \ - sudo \ - wget \ - git \ - curl \ - python3 \ - python3-dev \ - python3-pip \ - ffmpeg \ - postgresql-client \ - && \ - rm -rf /var/lib/apt/lists/* - - -# ユーザー追加 -RUN useradd -m jupyter --home-dir /opt/jupyter && \ - echo "jupyter ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/jupyter - -# jupyter ユーザーで実行 -USER jupyter -WORKDIR /opt/jupyter - -# ollama インストール -# RUN curl -fsSL https://ollama.com/install.sh | sh - -# uv インストール -RUN curl -LsSf https://astral.sh/uv/install.sh | sh - -# uv 環境変数設定 -ENV PATH /opt/jupyter/.local/bin:$PATH - -# python インストール -RUN uv python install -COPY ./pyproject.toml /opt/jupyter/ - -RUN uv sync -RUN uv run --with jupyter jupyter lab --generate-config && \ - sed -i \ - -e "s/^# c.ServerApp.ip.*$/c.ServerApp.ip = '0.0.0.0'/" \ - -e "s/^# c.ServerApp.port.*$/c.ServerApp.port = 8000/" \ - -e "s/^# c.ServerApp.password_required.*$/c.ServerApp.password_required = False/" \ - -e "s/^# c.ServerApp.token.*$/c.ServerApp.token = 'jupyter'/" \ - ~/.jupyter/jupyter_lab_config.py - -# Jupyter Lab 実行時の作業ディレクトリ -WORKDIR /opt/jupyter/jupyterlab - -CMD ["uv", "run", "--with", "jupyter", "jupyter", "lab"] - diff --git a/jupyter/Dockerfile.gpu b/jupyter/Dockerfile.gpu deleted file mode 100644 index 3ec58d8..0000000 --- a/jupyter/Dockerfile.gpu +++ /dev/null @@ -1,63 +0,0 @@ -FROM nvidia/cuda:12.6.3-cudnn-runtime-ubuntu24.04 - -ENV DEBIAN_FRONTEND=noninteractive -# ENV http_proxy=http://127.0.0.1:3128/ -# ENV https_proxy=http://127.0.0.1:3128/ - -# 必要パッケージインストール -RUN \ - apt-get update && \ - apt-get -y upgrade && \ - apt-get install -y \ - sudo \ - wget \ - git \ - curl \ - python3 \ - python3-dev \ - python3-pip \ - ffmpeg \ - build-essential libbz2-dev libdb-dev \ - libreadline-dev libffi-dev libgdbm-dev liblzma-dev \ - libncursesw5-dev libsqlite3-dev libssl-dev \ - zlib1g-dev uuid-dev tk-dev \ - postgresql-client \ - && \ - rm -rf /var/lib/apt/lists/* - - -# ユーザー追加 -RUN useradd -m jupyter --home-dir /opt/jupyter && \ - echo "jupyter ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/jupyter - -# jupyter ユーザーで実行 -USER jupyter -WORKDIR /opt/jupyter - -# ollama インストール -RUN curl -fsSL https://ollama.com/install.sh | sh - -# uv インストール -RUN curl -LsSf https://astral.sh/uv/install.sh | sh - -# uv 環境変数設定 -ENV PATH /opt/jupyter/.local/bin:$PATH - -# python インストール -RUN uv python install -COPY ./pyproject.toml /opt/jupyter/ - -RUN uv sync -RUN uv run --with jupyter jupyter lab --generate-config && \ - sed -i \ - -e "s/^# c.ServerApp.ip.*$/c.ServerApp.ip = '0.0.0.0'/" \ - -e "s/^# c.ServerApp.port.*$/c.ServerApp.port = 8000/" \ - -e "s/^# c.ServerApp.password_required.*$/c.ServerApp.password_required = False/" \ - -e "s/^# c.ServerApp.token.*$/c.ServerApp.token = 'jupyter'/" \ - ~/.jupyter/jupyter_lab_config.py - -# Jupyter Lab 実行時の作業ディレクトリ -WORKDIR /opt/jupyter/jupyterlab - -CMD ["uv", "run", "--with", "jupyter", "jupyter", "lab"] - diff --git a/README.md b/README.md index 0fc1f95..4eeabe3 100644 --- a/README.md +++ b/README.md @@ -1,32 +1,38 @@ # Jupyter Lab +次の2種類を用意しています。 +- CPU 版 +- GPU 版 (CUDA 13.0.0 cuDNN) + +GPU 対応バージョンを変更する場合は、 +jupyter_gpu/Docker ファイルの FROM を適宜修正ください。 + +# CPU 版 +``` # イメージ作成 - -* GPU対応の場合 -``` -cp jupyter/Dockerfile.gpu jupyter/Dockerfile -docker compose build -``` - - -* CPU の場合 -``` -cp jupyter/Dockerfile.cpu jupyter/Dockerfile -docker compose build -``` - +docker compose --profile jupyter build # 起動 -docker compose up -d +docker compose --profile jupyter up -d +``` +# GPU 版 (CUDA 13.0.0 cuDNN) +``` +# イメージ作成 +docker compose --profile jupyter_gpu build -# 終了 -docker compose down - +# 起動 +docker compose --profile jupyter_gpu up -d +``` # Jupyter Lab へのアクセス http://localhost:8000/lab?token=jupyter notebook 配下にファイルが保存されます。 +パッケージの追加等は、uv にて可能です。 +``` +!uv add <パッケージ> +``` + diff --git a/docker-compose.yaml b/docker-compose.yaml index ad65041..d415735 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,4 +1,25 @@ services: + jupyter_gpu: + build: + context: ./jupyter_gpu + dockerfile: Dockerfile + image: jupyter_gpu:cuda-12.6-cudnn-runtime + ports: + - 0.0.0.0:8000:8000 + volumes: + - ./notebook:/opt/jupyter/jupyterlab/notebook + tty: true + #environment: + # - NVIDIA_DISABLE_REQUIRE: true + deploy: + resources: + reservations: + devices: + - driver: nvidia + count: 1 + capabilities: [gpu] + profiles: + - jupyter_gpu jupyter: build: context: ./jupyter @@ -7,15 +28,8 @@ ports: - 0.0.0.0:8000:8000 volumes: - - ./notebook:/opt/jupyter/jupyterlab + - ./notebook:/opt/jupyter/jupyterlab/notebook tty: true - deploy: - resources: - reservations: - devices: - - driver: nvidia - count: 1 - capabilities: [gpu] - - + profiles: + - jupyter diff --git a/jupyter/Dockerfile b/jupyter/Dockerfile index c98acf4..db5bfab 100644 --- a/jupyter/Dockerfile +++ b/jupyter/Dockerfile @@ -1,8 +1,9 @@ -FROM python:3.10.17-bookworm +FROM python:3.10.18-bookworm ENV DEBIAN_FRONTEND=noninteractive # ENV http_proxy=http://127.0.0.1:3128/ # ENV https_proxy=http://127.0.0.1:3128/ +# ENV no_proxy=localhost,127.0.0.1 # 必要パッケージインストール RUN \ @@ -13,9 +14,6 @@ wget \ git \ curl \ - python3 \ - python3-dev \ - python3-pip \ ffmpeg \ postgresql-client \ && \ @@ -31,7 +29,7 @@ WORKDIR /opt/jupyter # ollama インストール -# RUN curl -fsSL https://ollama.com/install.sh | sh +RUN curl -fsSL https://ollama.com/install.sh | sh # uv インストール RUN curl -LsSf https://astral.sh/uv/install.sh | sh @@ -41,19 +39,20 @@ # python インストール RUN uv python install -COPY ./pyproject.toml /opt/jupyter/ + +# Jupyter Lab 実行時の作業ディレクトリ +WORKDIR /opt/jupyter/jupyterlab +COPY --chown=jupyter:jupyter ./pyproject.toml /opt/jupyter/jupyterlab RUN uv sync -RUN uv run --with jupyter jupyter lab --generate-config && \ +RUN uv run jupyter lab --generate-config && \ sed -i \ -e "s/^# c.ServerApp.ip.*$/c.ServerApp.ip = '0.0.0.0'/" \ -e "s/^# c.ServerApp.port.*$/c.ServerApp.port = 8000/" \ -e "s/^# c.ServerApp.password_required.*$/c.ServerApp.password_required = False/" \ -e "s/^# c.ServerApp.token.*$/c.ServerApp.token = 'jupyter'/" \ + -e "s/^# c.ServerApp.notebook_dir.*$/c.ServerApp.notebook_dir = '\/opt\/jupyter\/jupyterlab\/notebook'/" \ ~/.jupyter/jupyter_lab_config.py -# Jupyter Lab 実行時の作業ディレクトリ -WORKDIR /opt/jupyter/jupyterlab - -CMD ["uv", "run", "--with", "jupyter", "jupyter", "lab"] +CMD ["uv", "run", "jupyter", "lab"] diff --git a/jupyter/Dockerfile.cpu b/jupyter/Dockerfile.cpu deleted file mode 100644 index c98acf4..0000000 --- a/jupyter/Dockerfile.cpu +++ /dev/null @@ -1,59 +0,0 @@ -FROM python:3.10.17-bookworm - -ENV DEBIAN_FRONTEND=noninteractive -# ENV http_proxy=http://127.0.0.1:3128/ -# ENV https_proxy=http://127.0.0.1:3128/ - -# 必要パッケージインストール -RUN \ - apt-get update && \ - apt-get -y upgrade && \ - apt-get install -y \ - sudo \ - wget \ - git \ - curl \ - python3 \ - python3-dev \ - python3-pip \ - ffmpeg \ - postgresql-client \ - && \ - rm -rf /var/lib/apt/lists/* - - -# ユーザー追加 -RUN useradd -m jupyter --home-dir /opt/jupyter && \ - echo "jupyter ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/jupyter - -# jupyter ユーザーで実行 -USER jupyter -WORKDIR /opt/jupyter - -# ollama インストール -# RUN curl -fsSL https://ollama.com/install.sh | sh - -# uv インストール -RUN curl -LsSf https://astral.sh/uv/install.sh | sh - -# uv 環境変数設定 -ENV PATH /opt/jupyter/.local/bin:$PATH - -# python インストール -RUN uv python install -COPY ./pyproject.toml /opt/jupyter/ - -RUN uv sync -RUN uv run --with jupyter jupyter lab --generate-config && \ - sed -i \ - -e "s/^# c.ServerApp.ip.*$/c.ServerApp.ip = '0.0.0.0'/" \ - -e "s/^# c.ServerApp.port.*$/c.ServerApp.port = 8000/" \ - -e "s/^# c.ServerApp.password_required.*$/c.ServerApp.password_required = False/" \ - -e "s/^# c.ServerApp.token.*$/c.ServerApp.token = 'jupyter'/" \ - ~/.jupyter/jupyter_lab_config.py - -# Jupyter Lab 実行時の作業ディレクトリ -WORKDIR /opt/jupyter/jupyterlab - -CMD ["uv", "run", "--with", "jupyter", "jupyter", "lab"] - diff --git a/jupyter/Dockerfile.gpu b/jupyter/Dockerfile.gpu deleted file mode 100644 index 3ec58d8..0000000 --- a/jupyter/Dockerfile.gpu +++ /dev/null @@ -1,63 +0,0 @@ -FROM nvidia/cuda:12.6.3-cudnn-runtime-ubuntu24.04 - -ENV DEBIAN_FRONTEND=noninteractive -# ENV http_proxy=http://127.0.0.1:3128/ -# ENV https_proxy=http://127.0.0.1:3128/ - -# 必要パッケージインストール -RUN \ - apt-get update && \ - apt-get -y upgrade && \ - apt-get install -y \ - sudo \ - wget \ - git \ - curl \ - python3 \ - python3-dev \ - python3-pip \ - ffmpeg \ - build-essential libbz2-dev libdb-dev \ - libreadline-dev libffi-dev libgdbm-dev liblzma-dev \ - libncursesw5-dev libsqlite3-dev libssl-dev \ - zlib1g-dev uuid-dev tk-dev \ - postgresql-client \ - && \ - rm -rf /var/lib/apt/lists/* - - -# ユーザー追加 -RUN useradd -m jupyter --home-dir /opt/jupyter && \ - echo "jupyter ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/jupyter - -# jupyter ユーザーで実行 -USER jupyter -WORKDIR /opt/jupyter - -# ollama インストール -RUN curl -fsSL https://ollama.com/install.sh | sh - -# uv インストール -RUN curl -LsSf https://astral.sh/uv/install.sh | sh - -# uv 環境変数設定 -ENV PATH /opt/jupyter/.local/bin:$PATH - -# python インストール -RUN uv python install -COPY ./pyproject.toml /opt/jupyter/ - -RUN uv sync -RUN uv run --with jupyter jupyter lab --generate-config && \ - sed -i \ - -e "s/^# c.ServerApp.ip.*$/c.ServerApp.ip = '0.0.0.0'/" \ - -e "s/^# c.ServerApp.port.*$/c.ServerApp.port = 8000/" \ - -e "s/^# c.ServerApp.password_required.*$/c.ServerApp.password_required = False/" \ - -e "s/^# c.ServerApp.token.*$/c.ServerApp.token = 'jupyter'/" \ - ~/.jupyter/jupyter_lab_config.py - -# Jupyter Lab 実行時の作業ディレクトリ -WORKDIR /opt/jupyter/jupyterlab - -CMD ["uv", "run", "--with", "jupyter", "jupyter", "lab"] - diff --git a/jupyter/pyproject.toml b/jupyter/pyproject.toml index 2be6ffd..4f04dc9 100644 --- a/jupyter/pyproject.toml +++ b/jupyter/pyproject.toml @@ -1,10 +1,11 @@ [project] -name = "tmp" +name = "jupyter-docker" version = "0.1.0" description = "Add your description here" readme = "README.md" requires-python = ">=3.13" dependencies = [ + "jupyterlab>=4.4.7", "matplotlib>=3.10.6", "numpy>=2.3.2", "ollama>=0.5.3", @@ -15,3 +16,8 @@ "requests>=2.32.5", "sqlalchemy>=2.0.43", ] + +[tool.uv.workspace] +members = [ + "tmp", +] diff --git a/README.md b/README.md index 0fc1f95..4eeabe3 100644 --- a/README.md +++ b/README.md @@ -1,32 +1,38 @@ # Jupyter Lab +次の2種類を用意しています。 +- CPU 版 +- GPU 版 (CUDA 13.0.0 cuDNN) + +GPU 対応バージョンを変更する場合は、 +jupyter_gpu/Docker ファイルの FROM を適宜修正ください。 + +# CPU 版 +``` # イメージ作成 - -* GPU対応の場合 -``` -cp jupyter/Dockerfile.gpu jupyter/Dockerfile -docker compose build -``` - - -* CPU の場合 -``` -cp jupyter/Dockerfile.cpu jupyter/Dockerfile -docker compose build -``` - +docker compose --profile jupyter build # 起動 -docker compose up -d +docker compose --profile jupyter up -d +``` +# GPU 版 (CUDA 13.0.0 cuDNN) +``` +# イメージ作成 +docker compose --profile jupyter_gpu build -# 終了 -docker compose down - +# 起動 +docker compose --profile jupyter_gpu up -d +``` # Jupyter Lab へのアクセス http://localhost:8000/lab?token=jupyter notebook 配下にファイルが保存されます。 +パッケージの追加等は、uv にて可能です。 +``` +!uv add <パッケージ> +``` + diff --git a/docker-compose.yaml b/docker-compose.yaml index ad65041..d415735 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,4 +1,25 @@ services: + jupyter_gpu: + build: + context: ./jupyter_gpu + dockerfile: Dockerfile + image: jupyter_gpu:cuda-12.6-cudnn-runtime + ports: + - 0.0.0.0:8000:8000 + volumes: + - ./notebook:/opt/jupyter/jupyterlab/notebook + tty: true + #environment: + # - NVIDIA_DISABLE_REQUIRE: true + deploy: + resources: + reservations: + devices: + - driver: nvidia + count: 1 + capabilities: [gpu] + profiles: + - jupyter_gpu jupyter: build: context: ./jupyter @@ -7,15 +28,8 @@ ports: - 0.0.0.0:8000:8000 volumes: - - ./notebook:/opt/jupyter/jupyterlab + - ./notebook:/opt/jupyter/jupyterlab/notebook tty: true - deploy: - resources: - reservations: - devices: - - driver: nvidia - count: 1 - capabilities: [gpu] - - + profiles: + - jupyter diff --git a/jupyter/Dockerfile b/jupyter/Dockerfile index c98acf4..db5bfab 100644 --- a/jupyter/Dockerfile +++ b/jupyter/Dockerfile @@ -1,8 +1,9 @@ -FROM python:3.10.17-bookworm +FROM python:3.10.18-bookworm ENV DEBIAN_FRONTEND=noninteractive # ENV http_proxy=http://127.0.0.1:3128/ # ENV https_proxy=http://127.0.0.1:3128/ +# ENV no_proxy=localhost,127.0.0.1 # 必要パッケージインストール RUN \ @@ -13,9 +14,6 @@ wget \ git \ curl \ - python3 \ - python3-dev \ - python3-pip \ ffmpeg \ postgresql-client \ && \ @@ -31,7 +29,7 @@ WORKDIR /opt/jupyter # ollama インストール -# RUN curl -fsSL https://ollama.com/install.sh | sh +RUN curl -fsSL https://ollama.com/install.sh | sh # uv インストール RUN curl -LsSf https://astral.sh/uv/install.sh | sh @@ -41,19 +39,20 @@ # python インストール RUN uv python install -COPY ./pyproject.toml /opt/jupyter/ + +# Jupyter Lab 実行時の作業ディレクトリ +WORKDIR /opt/jupyter/jupyterlab +COPY --chown=jupyter:jupyter ./pyproject.toml /opt/jupyter/jupyterlab RUN uv sync -RUN uv run --with jupyter jupyter lab --generate-config && \ +RUN uv run jupyter lab --generate-config && \ sed -i \ -e "s/^# c.ServerApp.ip.*$/c.ServerApp.ip = '0.0.0.0'/" \ -e "s/^# c.ServerApp.port.*$/c.ServerApp.port = 8000/" \ -e "s/^# c.ServerApp.password_required.*$/c.ServerApp.password_required = False/" \ -e "s/^# c.ServerApp.token.*$/c.ServerApp.token = 'jupyter'/" \ + -e "s/^# c.ServerApp.notebook_dir.*$/c.ServerApp.notebook_dir = '\/opt\/jupyter\/jupyterlab\/notebook'/" \ ~/.jupyter/jupyter_lab_config.py -# Jupyter Lab 実行時の作業ディレクトリ -WORKDIR /opt/jupyter/jupyterlab - -CMD ["uv", "run", "--with", "jupyter", "jupyter", "lab"] +CMD ["uv", "run", "jupyter", "lab"] diff --git a/jupyter/Dockerfile.cpu b/jupyter/Dockerfile.cpu deleted file mode 100644 index c98acf4..0000000 --- a/jupyter/Dockerfile.cpu +++ /dev/null @@ -1,59 +0,0 @@ -FROM python:3.10.17-bookworm - -ENV DEBIAN_FRONTEND=noninteractive -# ENV http_proxy=http://127.0.0.1:3128/ -# ENV https_proxy=http://127.0.0.1:3128/ - -# 必要パッケージインストール -RUN \ - apt-get update && \ - apt-get -y upgrade && \ - apt-get install -y \ - sudo \ - wget \ - git \ - curl \ - python3 \ - python3-dev \ - python3-pip \ - ffmpeg \ - postgresql-client \ - && \ - rm -rf /var/lib/apt/lists/* - - -# ユーザー追加 -RUN useradd -m jupyter --home-dir /opt/jupyter && \ - echo "jupyter ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/jupyter - -# jupyter ユーザーで実行 -USER jupyter -WORKDIR /opt/jupyter - -# ollama インストール -# RUN curl -fsSL https://ollama.com/install.sh | sh - -# uv インストール -RUN curl -LsSf https://astral.sh/uv/install.sh | sh - -# uv 環境変数設定 -ENV PATH /opt/jupyter/.local/bin:$PATH - -# python インストール -RUN uv python install -COPY ./pyproject.toml /opt/jupyter/ - -RUN uv sync -RUN uv run --with jupyter jupyter lab --generate-config && \ - sed -i \ - -e "s/^# c.ServerApp.ip.*$/c.ServerApp.ip = '0.0.0.0'/" \ - -e "s/^# c.ServerApp.port.*$/c.ServerApp.port = 8000/" \ - -e "s/^# c.ServerApp.password_required.*$/c.ServerApp.password_required = False/" \ - -e "s/^# c.ServerApp.token.*$/c.ServerApp.token = 'jupyter'/" \ - ~/.jupyter/jupyter_lab_config.py - -# Jupyter Lab 実行時の作業ディレクトリ -WORKDIR /opt/jupyter/jupyterlab - -CMD ["uv", "run", "--with", "jupyter", "jupyter", "lab"] - diff --git a/jupyter/Dockerfile.gpu b/jupyter/Dockerfile.gpu deleted file mode 100644 index 3ec58d8..0000000 --- a/jupyter/Dockerfile.gpu +++ /dev/null @@ -1,63 +0,0 @@ -FROM nvidia/cuda:12.6.3-cudnn-runtime-ubuntu24.04 - -ENV DEBIAN_FRONTEND=noninteractive -# ENV http_proxy=http://127.0.0.1:3128/ -# ENV https_proxy=http://127.0.0.1:3128/ - -# 必要パッケージインストール -RUN \ - apt-get update && \ - apt-get -y upgrade && \ - apt-get install -y \ - sudo \ - wget \ - git \ - curl \ - python3 \ - python3-dev \ - python3-pip \ - ffmpeg \ - build-essential libbz2-dev libdb-dev \ - libreadline-dev libffi-dev libgdbm-dev liblzma-dev \ - libncursesw5-dev libsqlite3-dev libssl-dev \ - zlib1g-dev uuid-dev tk-dev \ - postgresql-client \ - && \ - rm -rf /var/lib/apt/lists/* - - -# ユーザー追加 -RUN useradd -m jupyter --home-dir /opt/jupyter && \ - echo "jupyter ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/jupyter - -# jupyter ユーザーで実行 -USER jupyter -WORKDIR /opt/jupyter - -# ollama インストール -RUN curl -fsSL https://ollama.com/install.sh | sh - -# uv インストール -RUN curl -LsSf https://astral.sh/uv/install.sh | sh - -# uv 環境変数設定 -ENV PATH /opt/jupyter/.local/bin:$PATH - -# python インストール -RUN uv python install -COPY ./pyproject.toml /opt/jupyter/ - -RUN uv sync -RUN uv run --with jupyter jupyter lab --generate-config && \ - sed -i \ - -e "s/^# c.ServerApp.ip.*$/c.ServerApp.ip = '0.0.0.0'/" \ - -e "s/^# c.ServerApp.port.*$/c.ServerApp.port = 8000/" \ - -e "s/^# c.ServerApp.password_required.*$/c.ServerApp.password_required = False/" \ - -e "s/^# c.ServerApp.token.*$/c.ServerApp.token = 'jupyter'/" \ - ~/.jupyter/jupyter_lab_config.py - -# Jupyter Lab 実行時の作業ディレクトリ -WORKDIR /opt/jupyter/jupyterlab - -CMD ["uv", "run", "--with", "jupyter", "jupyter", "lab"] - diff --git a/jupyter/pyproject.toml b/jupyter/pyproject.toml index 2be6ffd..4f04dc9 100644 --- a/jupyter/pyproject.toml +++ b/jupyter/pyproject.toml @@ -1,10 +1,11 @@ [project] -name = "tmp" +name = "jupyter-docker" version = "0.1.0" description = "Add your description here" readme = "README.md" requires-python = ">=3.13" dependencies = [ + "jupyterlab>=4.4.7", "matplotlib>=3.10.6", "numpy>=2.3.2", "ollama>=0.5.3", @@ -15,3 +16,8 @@ "requests>=2.32.5", "sqlalchemy>=2.0.43", ] + +[tool.uv.workspace] +members = [ + "tmp", +] diff --git a/jupyter_gpu/Dockerfile b/jupyter_gpu/Dockerfile new file mode 100644 index 0000000..10b009f --- /dev/null +++ b/jupyter_gpu/Dockerfile @@ -0,0 +1,59 @@ +FROM nvidia/cuda:12.6.3-cudnn-runtime-ubuntu24.04 + +ENV DEBIAN_FRONTEND=noninteractive +# ENV http_proxy=http://127.0.0.1:3128/ +# ENV https_proxy=http://127.0.0.1:3128/ +# ENV no_proxy=localhost,127.0.0.1 + +# 必要パッケージインストール +RUN \ + apt-get update && \ + apt-get -y upgrade && \ + apt-get install -y \ + sudo \ + wget \ + git \ + curl \ + ffmpeg \ + postgresql-client \ + && \ + rm -rf /var/lib/apt/lists/* + + +# ユーザー追加 +RUN useradd -m jupyter --home-dir /opt/jupyter && \ + echo "jupyter ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/jupyter + +# jupyter ユーザーで実行 +USER jupyter +WORKDIR /opt/jupyter + +# ollama インストール +RUN curl -fsSL https://ollama.com/install.sh | sh + +# uv インストール +RUN curl -LsSf https://astral.sh/uv/install.sh | sh + +# uv 環境変数設定 +ENV PATH /opt/jupyter/.local/bin:$PATH + +# python インストール +RUN uv python install + +# Jupyter Lab 実行時の作業ディレクトリ +WORKDIR /opt/jupyter/jupyterlab +COPY --chown=jupyter:jupyter ./pyproject.toml /opt/jupyter/jupyterlab + +RUN uv sync +RUN uv run jupyter lab --generate-config && \ + sed -i \ + -e "s/^# c.ServerApp.ip.*$/c.ServerApp.ip = '0.0.0.0'/" \ + -e "s/^# c.ServerApp.port.*$/c.ServerApp.port = 8000/" \ + -e "s/^# c.ServerApp.password_required.*$/c.ServerApp.password_required = False/" \ + -e "s/^# c.ServerApp.token.*$/c.ServerApp.token = 'jupyter'/" \ + -e "s/^# c.ServerApp.notebook_dir.*$/c.ServerApp.notebook_dir = '\/opt\/jupyter\/jupyterlab\/notebook'/" \ + ~/.jupyter/jupyter_lab_config.py + + +CMD ["uv", "run", "jupyter", "lab"] + diff --git a/README.md b/README.md index 0fc1f95..4eeabe3 100644 --- a/README.md +++ b/README.md @@ -1,32 +1,38 @@ # Jupyter Lab +次の2種類を用意しています。 +- CPU 版 +- GPU 版 (CUDA 13.0.0 cuDNN) + +GPU 対応バージョンを変更する場合は、 +jupyter_gpu/Docker ファイルの FROM を適宜修正ください。 + +# CPU 版 +``` # イメージ作成 - -* GPU対応の場合 -``` -cp jupyter/Dockerfile.gpu jupyter/Dockerfile -docker compose build -``` - - -* CPU の場合 -``` -cp jupyter/Dockerfile.cpu jupyter/Dockerfile -docker compose build -``` - +docker compose --profile jupyter build # 起動 -docker compose up -d +docker compose --profile jupyter up -d +``` +# GPU 版 (CUDA 13.0.0 cuDNN) +``` +# イメージ作成 +docker compose --profile jupyter_gpu build -# 終了 -docker compose down - +# 起動 +docker compose --profile jupyter_gpu up -d +``` # Jupyter Lab へのアクセス http://localhost:8000/lab?token=jupyter notebook 配下にファイルが保存されます。 +パッケージの追加等は、uv にて可能です。 +``` +!uv add <パッケージ> +``` + diff --git a/docker-compose.yaml b/docker-compose.yaml index ad65041..d415735 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,4 +1,25 @@ services: + jupyter_gpu: + build: + context: ./jupyter_gpu + dockerfile: Dockerfile + image: jupyter_gpu:cuda-12.6-cudnn-runtime + ports: + - 0.0.0.0:8000:8000 + volumes: + - ./notebook:/opt/jupyter/jupyterlab/notebook + tty: true + #environment: + # - NVIDIA_DISABLE_REQUIRE: true + deploy: + resources: + reservations: + devices: + - driver: nvidia + count: 1 + capabilities: [gpu] + profiles: + - jupyter_gpu jupyter: build: context: ./jupyter @@ -7,15 +28,8 @@ ports: - 0.0.0.0:8000:8000 volumes: - - ./notebook:/opt/jupyter/jupyterlab + - ./notebook:/opt/jupyter/jupyterlab/notebook tty: true - deploy: - resources: - reservations: - devices: - - driver: nvidia - count: 1 - capabilities: [gpu] - - + profiles: + - jupyter diff --git a/jupyter/Dockerfile b/jupyter/Dockerfile index c98acf4..db5bfab 100644 --- a/jupyter/Dockerfile +++ b/jupyter/Dockerfile @@ -1,8 +1,9 @@ -FROM python:3.10.17-bookworm +FROM python:3.10.18-bookworm ENV DEBIAN_FRONTEND=noninteractive # ENV http_proxy=http://127.0.0.1:3128/ # ENV https_proxy=http://127.0.0.1:3128/ +# ENV no_proxy=localhost,127.0.0.1 # 必要パッケージインストール RUN \ @@ -13,9 +14,6 @@ wget \ git \ curl \ - python3 \ - python3-dev \ - python3-pip \ ffmpeg \ postgresql-client \ && \ @@ -31,7 +29,7 @@ WORKDIR /opt/jupyter # ollama インストール -# RUN curl -fsSL https://ollama.com/install.sh | sh +RUN curl -fsSL https://ollama.com/install.sh | sh # uv インストール RUN curl -LsSf https://astral.sh/uv/install.sh | sh @@ -41,19 +39,20 @@ # python インストール RUN uv python install -COPY ./pyproject.toml /opt/jupyter/ + +# Jupyter Lab 実行時の作業ディレクトリ +WORKDIR /opt/jupyter/jupyterlab +COPY --chown=jupyter:jupyter ./pyproject.toml /opt/jupyter/jupyterlab RUN uv sync -RUN uv run --with jupyter jupyter lab --generate-config && \ +RUN uv run jupyter lab --generate-config && \ sed -i \ -e "s/^# c.ServerApp.ip.*$/c.ServerApp.ip = '0.0.0.0'/" \ -e "s/^# c.ServerApp.port.*$/c.ServerApp.port = 8000/" \ -e "s/^# c.ServerApp.password_required.*$/c.ServerApp.password_required = False/" \ -e "s/^# c.ServerApp.token.*$/c.ServerApp.token = 'jupyter'/" \ + -e "s/^# c.ServerApp.notebook_dir.*$/c.ServerApp.notebook_dir = '\/opt\/jupyter\/jupyterlab\/notebook'/" \ ~/.jupyter/jupyter_lab_config.py -# Jupyter Lab 実行時の作業ディレクトリ -WORKDIR /opt/jupyter/jupyterlab - -CMD ["uv", "run", "--with", "jupyter", "jupyter", "lab"] +CMD ["uv", "run", "jupyter", "lab"] diff --git a/jupyter/Dockerfile.cpu b/jupyter/Dockerfile.cpu deleted file mode 100644 index c98acf4..0000000 --- a/jupyter/Dockerfile.cpu +++ /dev/null @@ -1,59 +0,0 @@ -FROM python:3.10.17-bookworm - -ENV DEBIAN_FRONTEND=noninteractive -# ENV http_proxy=http://127.0.0.1:3128/ -# ENV https_proxy=http://127.0.0.1:3128/ - -# 必要パッケージインストール -RUN \ - apt-get update && \ - apt-get -y upgrade && \ - apt-get install -y \ - sudo \ - wget \ - git \ - curl \ - python3 \ - python3-dev \ - python3-pip \ - ffmpeg \ - postgresql-client \ - && \ - rm -rf /var/lib/apt/lists/* - - -# ユーザー追加 -RUN useradd -m jupyter --home-dir /opt/jupyter && \ - echo "jupyter ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/jupyter - -# jupyter ユーザーで実行 -USER jupyter -WORKDIR /opt/jupyter - -# ollama インストール -# RUN curl -fsSL https://ollama.com/install.sh | sh - -# uv インストール -RUN curl -LsSf https://astral.sh/uv/install.sh | sh - -# uv 環境変数設定 -ENV PATH /opt/jupyter/.local/bin:$PATH - -# python インストール -RUN uv python install -COPY ./pyproject.toml /opt/jupyter/ - -RUN uv sync -RUN uv run --with jupyter jupyter lab --generate-config && \ - sed -i \ - -e "s/^# c.ServerApp.ip.*$/c.ServerApp.ip = '0.0.0.0'/" \ - -e "s/^# c.ServerApp.port.*$/c.ServerApp.port = 8000/" \ - -e "s/^# c.ServerApp.password_required.*$/c.ServerApp.password_required = False/" \ - -e "s/^# c.ServerApp.token.*$/c.ServerApp.token = 'jupyter'/" \ - ~/.jupyter/jupyter_lab_config.py - -# Jupyter Lab 実行時の作業ディレクトリ -WORKDIR /opt/jupyter/jupyterlab - -CMD ["uv", "run", "--with", "jupyter", "jupyter", "lab"] - diff --git a/jupyter/Dockerfile.gpu b/jupyter/Dockerfile.gpu deleted file mode 100644 index 3ec58d8..0000000 --- a/jupyter/Dockerfile.gpu +++ /dev/null @@ -1,63 +0,0 @@ -FROM nvidia/cuda:12.6.3-cudnn-runtime-ubuntu24.04 - -ENV DEBIAN_FRONTEND=noninteractive -# ENV http_proxy=http://127.0.0.1:3128/ -# ENV https_proxy=http://127.0.0.1:3128/ - -# 必要パッケージインストール -RUN \ - apt-get update && \ - apt-get -y upgrade && \ - apt-get install -y \ - sudo \ - wget \ - git \ - curl \ - python3 \ - python3-dev \ - python3-pip \ - ffmpeg \ - build-essential libbz2-dev libdb-dev \ - libreadline-dev libffi-dev libgdbm-dev liblzma-dev \ - libncursesw5-dev libsqlite3-dev libssl-dev \ - zlib1g-dev uuid-dev tk-dev \ - postgresql-client \ - && \ - rm -rf /var/lib/apt/lists/* - - -# ユーザー追加 -RUN useradd -m jupyter --home-dir /opt/jupyter && \ - echo "jupyter ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/jupyter - -# jupyter ユーザーで実行 -USER jupyter -WORKDIR /opt/jupyter - -# ollama インストール -RUN curl -fsSL https://ollama.com/install.sh | sh - -# uv インストール -RUN curl -LsSf https://astral.sh/uv/install.sh | sh - -# uv 環境変数設定 -ENV PATH /opt/jupyter/.local/bin:$PATH - -# python インストール -RUN uv python install -COPY ./pyproject.toml /opt/jupyter/ - -RUN uv sync -RUN uv run --with jupyter jupyter lab --generate-config && \ - sed -i \ - -e "s/^# c.ServerApp.ip.*$/c.ServerApp.ip = '0.0.0.0'/" \ - -e "s/^# c.ServerApp.port.*$/c.ServerApp.port = 8000/" \ - -e "s/^# c.ServerApp.password_required.*$/c.ServerApp.password_required = False/" \ - -e "s/^# c.ServerApp.token.*$/c.ServerApp.token = 'jupyter'/" \ - ~/.jupyter/jupyter_lab_config.py - -# Jupyter Lab 実行時の作業ディレクトリ -WORKDIR /opt/jupyter/jupyterlab - -CMD ["uv", "run", "--with", "jupyter", "jupyter", "lab"] - diff --git a/jupyter/pyproject.toml b/jupyter/pyproject.toml index 2be6ffd..4f04dc9 100644 --- a/jupyter/pyproject.toml +++ b/jupyter/pyproject.toml @@ -1,10 +1,11 @@ [project] -name = "tmp" +name = "jupyter-docker" version = "0.1.0" description = "Add your description here" readme = "README.md" requires-python = ">=3.13" dependencies = [ + "jupyterlab>=4.4.7", "matplotlib>=3.10.6", "numpy>=2.3.2", "ollama>=0.5.3", @@ -15,3 +16,8 @@ "requests>=2.32.5", "sqlalchemy>=2.0.43", ] + +[tool.uv.workspace] +members = [ + "tmp", +] diff --git a/jupyter_gpu/Dockerfile b/jupyter_gpu/Dockerfile new file mode 100644 index 0000000..10b009f --- /dev/null +++ b/jupyter_gpu/Dockerfile @@ -0,0 +1,59 @@ +FROM nvidia/cuda:12.6.3-cudnn-runtime-ubuntu24.04 + +ENV DEBIAN_FRONTEND=noninteractive +# ENV http_proxy=http://127.0.0.1:3128/ +# ENV https_proxy=http://127.0.0.1:3128/ +# ENV no_proxy=localhost,127.0.0.1 + +# 必要パッケージインストール +RUN \ + apt-get update && \ + apt-get -y upgrade && \ + apt-get install -y \ + sudo \ + wget \ + git \ + curl \ + ffmpeg \ + postgresql-client \ + && \ + rm -rf /var/lib/apt/lists/* + + +# ユーザー追加 +RUN useradd -m jupyter --home-dir /opt/jupyter && \ + echo "jupyter ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/jupyter + +# jupyter ユーザーで実行 +USER jupyter +WORKDIR /opt/jupyter + +# ollama インストール +RUN curl -fsSL https://ollama.com/install.sh | sh + +# uv インストール +RUN curl -LsSf https://astral.sh/uv/install.sh | sh + +# uv 環境変数設定 +ENV PATH /opt/jupyter/.local/bin:$PATH + +# python インストール +RUN uv python install + +# Jupyter Lab 実行時の作業ディレクトリ +WORKDIR /opt/jupyter/jupyterlab +COPY --chown=jupyter:jupyter ./pyproject.toml /opt/jupyter/jupyterlab + +RUN uv sync +RUN uv run jupyter lab --generate-config && \ + sed -i \ + -e "s/^# c.ServerApp.ip.*$/c.ServerApp.ip = '0.0.0.0'/" \ + -e "s/^# c.ServerApp.port.*$/c.ServerApp.port = 8000/" \ + -e "s/^# c.ServerApp.password_required.*$/c.ServerApp.password_required = False/" \ + -e "s/^# c.ServerApp.token.*$/c.ServerApp.token = 'jupyter'/" \ + -e "s/^# c.ServerApp.notebook_dir.*$/c.ServerApp.notebook_dir = '\/opt\/jupyter\/jupyterlab\/notebook'/" \ + ~/.jupyter/jupyter_lab_config.py + + +CMD ["uv", "run", "jupyter", "lab"] + diff --git a/jupyter_gpu/pyproject.toml b/jupyter_gpu/pyproject.toml new file mode 100644 index 0000000..bb33b75 --- /dev/null +++ b/jupyter_gpu/pyproject.toml @@ -0,0 +1,18 @@ +[project] +name = "jupyter-docker-gpu" +version = "0.1.0" +description = "Add your description here" +readme = "README.md" +requires-python = ">=3.13" +dependencies = [ + "jupyterlab>=4.4.7", + "matplotlib>=3.10.6", + "numpy>=2.3.2", + "ollama>=0.5.3", + "openpyxl>=3.1.5", + "pandas>=2.3.2", + "psycopg-binary>=3.2.9", + "python-dotenv>=1.1.1", + "requests>=2.32.5", + "sqlalchemy>=2.0.43", +] diff --git a/README.md b/README.md index 0fc1f95..4eeabe3 100644 --- a/README.md +++ b/README.md @@ -1,32 +1,38 @@ # Jupyter Lab +次の2種類を用意しています。 +- CPU 版 +- GPU 版 (CUDA 13.0.0 cuDNN) + +GPU 対応バージョンを変更する場合は、 +jupyter_gpu/Docker ファイルの FROM を適宜修正ください。 + +# CPU 版 +``` # イメージ作成 - -* GPU対応の場合 -``` -cp jupyter/Dockerfile.gpu jupyter/Dockerfile -docker compose build -``` - - -* CPU の場合 -``` -cp jupyter/Dockerfile.cpu jupyter/Dockerfile -docker compose build -``` - +docker compose --profile jupyter build # 起動 -docker compose up -d +docker compose --profile jupyter up -d +``` +# GPU 版 (CUDA 13.0.0 cuDNN) +``` +# イメージ作成 +docker compose --profile jupyter_gpu build -# 終了 -docker compose down - +# 起動 +docker compose --profile jupyter_gpu up -d +``` # Jupyter Lab へのアクセス http://localhost:8000/lab?token=jupyter notebook 配下にファイルが保存されます。 +パッケージの追加等は、uv にて可能です。 +``` +!uv add <パッケージ> +``` + diff --git a/docker-compose.yaml b/docker-compose.yaml index ad65041..d415735 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,4 +1,25 @@ services: + jupyter_gpu: + build: + context: ./jupyter_gpu + dockerfile: Dockerfile + image: jupyter_gpu:cuda-12.6-cudnn-runtime + ports: + - 0.0.0.0:8000:8000 + volumes: + - ./notebook:/opt/jupyter/jupyterlab/notebook + tty: true + #environment: + # - NVIDIA_DISABLE_REQUIRE: true + deploy: + resources: + reservations: + devices: + - driver: nvidia + count: 1 + capabilities: [gpu] + profiles: + - jupyter_gpu jupyter: build: context: ./jupyter @@ -7,15 +28,8 @@ ports: - 0.0.0.0:8000:8000 volumes: - - ./notebook:/opt/jupyter/jupyterlab + - ./notebook:/opt/jupyter/jupyterlab/notebook tty: true - deploy: - resources: - reservations: - devices: - - driver: nvidia - count: 1 - capabilities: [gpu] - - + profiles: + - jupyter diff --git a/jupyter/Dockerfile b/jupyter/Dockerfile index c98acf4..db5bfab 100644 --- a/jupyter/Dockerfile +++ b/jupyter/Dockerfile @@ -1,8 +1,9 @@ -FROM python:3.10.17-bookworm +FROM python:3.10.18-bookworm ENV DEBIAN_FRONTEND=noninteractive # ENV http_proxy=http://127.0.0.1:3128/ # ENV https_proxy=http://127.0.0.1:3128/ +# ENV no_proxy=localhost,127.0.0.1 # 必要パッケージインストール RUN \ @@ -13,9 +14,6 @@ wget \ git \ curl \ - python3 \ - python3-dev \ - python3-pip \ ffmpeg \ postgresql-client \ && \ @@ -31,7 +29,7 @@ WORKDIR /opt/jupyter # ollama インストール -# RUN curl -fsSL https://ollama.com/install.sh | sh +RUN curl -fsSL https://ollama.com/install.sh | sh # uv インストール RUN curl -LsSf https://astral.sh/uv/install.sh | sh @@ -41,19 +39,20 @@ # python インストール RUN uv python install -COPY ./pyproject.toml /opt/jupyter/ + +# Jupyter Lab 実行時の作業ディレクトリ +WORKDIR /opt/jupyter/jupyterlab +COPY --chown=jupyter:jupyter ./pyproject.toml /opt/jupyter/jupyterlab RUN uv sync -RUN uv run --with jupyter jupyter lab --generate-config && \ +RUN uv run jupyter lab --generate-config && \ sed -i \ -e "s/^# c.ServerApp.ip.*$/c.ServerApp.ip = '0.0.0.0'/" \ -e "s/^# c.ServerApp.port.*$/c.ServerApp.port = 8000/" \ -e "s/^# c.ServerApp.password_required.*$/c.ServerApp.password_required = False/" \ -e "s/^# c.ServerApp.token.*$/c.ServerApp.token = 'jupyter'/" \ + -e "s/^# c.ServerApp.notebook_dir.*$/c.ServerApp.notebook_dir = '\/opt\/jupyter\/jupyterlab\/notebook'/" \ ~/.jupyter/jupyter_lab_config.py -# Jupyter Lab 実行時の作業ディレクトリ -WORKDIR /opt/jupyter/jupyterlab - -CMD ["uv", "run", "--with", "jupyter", "jupyter", "lab"] +CMD ["uv", "run", "jupyter", "lab"] diff --git a/jupyter/Dockerfile.cpu b/jupyter/Dockerfile.cpu deleted file mode 100644 index c98acf4..0000000 --- a/jupyter/Dockerfile.cpu +++ /dev/null @@ -1,59 +0,0 @@ -FROM python:3.10.17-bookworm - -ENV DEBIAN_FRONTEND=noninteractive -# ENV http_proxy=http://127.0.0.1:3128/ -# ENV https_proxy=http://127.0.0.1:3128/ - -# 必要パッケージインストール -RUN \ - apt-get update && \ - apt-get -y upgrade && \ - apt-get install -y \ - sudo \ - wget \ - git \ - curl \ - python3 \ - python3-dev \ - python3-pip \ - ffmpeg \ - postgresql-client \ - && \ - rm -rf /var/lib/apt/lists/* - - -# ユーザー追加 -RUN useradd -m jupyter --home-dir /opt/jupyter && \ - echo "jupyter ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/jupyter - -# jupyter ユーザーで実行 -USER jupyter -WORKDIR /opt/jupyter - -# ollama インストール -# RUN curl -fsSL https://ollama.com/install.sh | sh - -# uv インストール -RUN curl -LsSf https://astral.sh/uv/install.sh | sh - -# uv 環境変数設定 -ENV PATH /opt/jupyter/.local/bin:$PATH - -# python インストール -RUN uv python install -COPY ./pyproject.toml /opt/jupyter/ - -RUN uv sync -RUN uv run --with jupyter jupyter lab --generate-config && \ - sed -i \ - -e "s/^# c.ServerApp.ip.*$/c.ServerApp.ip = '0.0.0.0'/" \ - -e "s/^# c.ServerApp.port.*$/c.ServerApp.port = 8000/" \ - -e "s/^# c.ServerApp.password_required.*$/c.ServerApp.password_required = False/" \ - -e "s/^# c.ServerApp.token.*$/c.ServerApp.token = 'jupyter'/" \ - ~/.jupyter/jupyter_lab_config.py - -# Jupyter Lab 実行時の作業ディレクトリ -WORKDIR /opt/jupyter/jupyterlab - -CMD ["uv", "run", "--with", "jupyter", "jupyter", "lab"] - diff --git a/jupyter/Dockerfile.gpu b/jupyter/Dockerfile.gpu deleted file mode 100644 index 3ec58d8..0000000 --- a/jupyter/Dockerfile.gpu +++ /dev/null @@ -1,63 +0,0 @@ -FROM nvidia/cuda:12.6.3-cudnn-runtime-ubuntu24.04 - -ENV DEBIAN_FRONTEND=noninteractive -# ENV http_proxy=http://127.0.0.1:3128/ -# ENV https_proxy=http://127.0.0.1:3128/ - -# 必要パッケージインストール -RUN \ - apt-get update && \ - apt-get -y upgrade && \ - apt-get install -y \ - sudo \ - wget \ - git \ - curl \ - python3 \ - python3-dev \ - python3-pip \ - ffmpeg \ - build-essential libbz2-dev libdb-dev \ - libreadline-dev libffi-dev libgdbm-dev liblzma-dev \ - libncursesw5-dev libsqlite3-dev libssl-dev \ - zlib1g-dev uuid-dev tk-dev \ - postgresql-client \ - && \ - rm -rf /var/lib/apt/lists/* - - -# ユーザー追加 -RUN useradd -m jupyter --home-dir /opt/jupyter && \ - echo "jupyter ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/jupyter - -# jupyter ユーザーで実行 -USER jupyter -WORKDIR /opt/jupyter - -# ollama インストール -RUN curl -fsSL https://ollama.com/install.sh | sh - -# uv インストール -RUN curl -LsSf https://astral.sh/uv/install.sh | sh - -# uv 環境変数設定 -ENV PATH /opt/jupyter/.local/bin:$PATH - -# python インストール -RUN uv python install -COPY ./pyproject.toml /opt/jupyter/ - -RUN uv sync -RUN uv run --with jupyter jupyter lab --generate-config && \ - sed -i \ - -e "s/^# c.ServerApp.ip.*$/c.ServerApp.ip = '0.0.0.0'/" \ - -e "s/^# c.ServerApp.port.*$/c.ServerApp.port = 8000/" \ - -e "s/^# c.ServerApp.password_required.*$/c.ServerApp.password_required = False/" \ - -e "s/^# c.ServerApp.token.*$/c.ServerApp.token = 'jupyter'/" \ - ~/.jupyter/jupyter_lab_config.py - -# Jupyter Lab 実行時の作業ディレクトリ -WORKDIR /opt/jupyter/jupyterlab - -CMD ["uv", "run", "--with", "jupyter", "jupyter", "lab"] - diff --git a/jupyter/pyproject.toml b/jupyter/pyproject.toml index 2be6ffd..4f04dc9 100644 --- a/jupyter/pyproject.toml +++ b/jupyter/pyproject.toml @@ -1,10 +1,11 @@ [project] -name = "tmp" +name = "jupyter-docker" version = "0.1.0" description = "Add your description here" readme = "README.md" requires-python = ">=3.13" dependencies = [ + "jupyterlab>=4.4.7", "matplotlib>=3.10.6", "numpy>=2.3.2", "ollama>=0.5.3", @@ -15,3 +16,8 @@ "requests>=2.32.5", "sqlalchemy>=2.0.43", ] + +[tool.uv.workspace] +members = [ + "tmp", +] diff --git a/jupyter_gpu/Dockerfile b/jupyter_gpu/Dockerfile new file mode 100644 index 0000000..10b009f --- /dev/null +++ b/jupyter_gpu/Dockerfile @@ -0,0 +1,59 @@ +FROM nvidia/cuda:12.6.3-cudnn-runtime-ubuntu24.04 + +ENV DEBIAN_FRONTEND=noninteractive +# ENV http_proxy=http://127.0.0.1:3128/ +# ENV https_proxy=http://127.0.0.1:3128/ +# ENV no_proxy=localhost,127.0.0.1 + +# 必要パッケージインストール +RUN \ + apt-get update && \ + apt-get -y upgrade && \ + apt-get install -y \ + sudo \ + wget \ + git \ + curl \ + ffmpeg \ + postgresql-client \ + && \ + rm -rf /var/lib/apt/lists/* + + +# ユーザー追加 +RUN useradd -m jupyter --home-dir /opt/jupyter && \ + echo "jupyter ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/jupyter + +# jupyter ユーザーで実行 +USER jupyter +WORKDIR /opt/jupyter + +# ollama インストール +RUN curl -fsSL https://ollama.com/install.sh | sh + +# uv インストール +RUN curl -LsSf https://astral.sh/uv/install.sh | sh + +# uv 環境変数設定 +ENV PATH /opt/jupyter/.local/bin:$PATH + +# python インストール +RUN uv python install + +# Jupyter Lab 実行時の作業ディレクトリ +WORKDIR /opt/jupyter/jupyterlab +COPY --chown=jupyter:jupyter ./pyproject.toml /opt/jupyter/jupyterlab + +RUN uv sync +RUN uv run jupyter lab --generate-config && \ + sed -i \ + -e "s/^# c.ServerApp.ip.*$/c.ServerApp.ip = '0.0.0.0'/" \ + -e "s/^# c.ServerApp.port.*$/c.ServerApp.port = 8000/" \ + -e "s/^# c.ServerApp.password_required.*$/c.ServerApp.password_required = False/" \ + -e "s/^# c.ServerApp.token.*$/c.ServerApp.token = 'jupyter'/" \ + -e "s/^# c.ServerApp.notebook_dir.*$/c.ServerApp.notebook_dir = '\/opt\/jupyter\/jupyterlab\/notebook'/" \ + ~/.jupyter/jupyter_lab_config.py + + +CMD ["uv", "run", "jupyter", "lab"] + diff --git a/jupyter_gpu/pyproject.toml b/jupyter_gpu/pyproject.toml new file mode 100644 index 0000000..bb33b75 --- /dev/null +++ b/jupyter_gpu/pyproject.toml @@ -0,0 +1,18 @@ +[project] +name = "jupyter-docker-gpu" +version = "0.1.0" +description = "Add your description here" +readme = "README.md" +requires-python = ">=3.13" +dependencies = [ + "jupyterlab>=4.4.7", + "matplotlib>=3.10.6", + "numpy>=2.3.2", + "ollama>=0.5.3", + "openpyxl>=3.1.5", + "pandas>=2.3.2", + "psycopg-binary>=3.2.9", + "python-dotenv>=1.1.1", + "requests>=2.32.5", + "sqlalchemy>=2.0.43", +] diff --git a/notebook/.ipynb_checkpoints/README-checkpoint.ipynb b/notebook/.ipynb_checkpoints/README-checkpoint.ipynb new file mode 100644 index 0000000..363fcab --- /dev/null +++ b/notebook/.ipynb_checkpoints/README-checkpoint.ipynb @@ -0,0 +1,6 @@ +{ + "cells": [], + "metadata": {}, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/README.md b/README.md index 0fc1f95..4eeabe3 100644 --- a/README.md +++ b/README.md @@ -1,32 +1,38 @@ # Jupyter Lab +次の2種類を用意しています。 +- CPU 版 +- GPU 版 (CUDA 13.0.0 cuDNN) + +GPU 対応バージョンを変更する場合は、 +jupyter_gpu/Docker ファイルの FROM を適宜修正ください。 + +# CPU 版 +``` # イメージ作成 - -* GPU対応の場合 -``` -cp jupyter/Dockerfile.gpu jupyter/Dockerfile -docker compose build -``` - - -* CPU の場合 -``` -cp jupyter/Dockerfile.cpu jupyter/Dockerfile -docker compose build -``` - +docker compose --profile jupyter build # 起動 -docker compose up -d +docker compose --profile jupyter up -d +``` +# GPU 版 (CUDA 13.0.0 cuDNN) +``` +# イメージ作成 +docker compose --profile jupyter_gpu build -# 終了 -docker compose down - +# 起動 +docker compose --profile jupyter_gpu up -d +``` # Jupyter Lab へのアクセス http://localhost:8000/lab?token=jupyter notebook 配下にファイルが保存されます。 +パッケージの追加等は、uv にて可能です。 +``` +!uv add <パッケージ> +``` + diff --git a/docker-compose.yaml b/docker-compose.yaml index ad65041..d415735 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,4 +1,25 @@ services: + jupyter_gpu: + build: + context: ./jupyter_gpu + dockerfile: Dockerfile + image: jupyter_gpu:cuda-12.6-cudnn-runtime + ports: + - 0.0.0.0:8000:8000 + volumes: + - ./notebook:/opt/jupyter/jupyterlab/notebook + tty: true + #environment: + # - NVIDIA_DISABLE_REQUIRE: true + deploy: + resources: + reservations: + devices: + - driver: nvidia + count: 1 + capabilities: [gpu] + profiles: + - jupyter_gpu jupyter: build: context: ./jupyter @@ -7,15 +28,8 @@ ports: - 0.0.0.0:8000:8000 volumes: - - ./notebook:/opt/jupyter/jupyterlab + - ./notebook:/opt/jupyter/jupyterlab/notebook tty: true - deploy: - resources: - reservations: - devices: - - driver: nvidia - count: 1 - capabilities: [gpu] - - + profiles: + - jupyter diff --git a/jupyter/Dockerfile b/jupyter/Dockerfile index c98acf4..db5bfab 100644 --- a/jupyter/Dockerfile +++ b/jupyter/Dockerfile @@ -1,8 +1,9 @@ -FROM python:3.10.17-bookworm +FROM python:3.10.18-bookworm ENV DEBIAN_FRONTEND=noninteractive # ENV http_proxy=http://127.0.0.1:3128/ # ENV https_proxy=http://127.0.0.1:3128/ +# ENV no_proxy=localhost,127.0.0.1 # 必要パッケージインストール RUN \ @@ -13,9 +14,6 @@ wget \ git \ curl \ - python3 \ - python3-dev \ - python3-pip \ ffmpeg \ postgresql-client \ && \ @@ -31,7 +29,7 @@ WORKDIR /opt/jupyter # ollama インストール -# RUN curl -fsSL https://ollama.com/install.sh | sh +RUN curl -fsSL https://ollama.com/install.sh | sh # uv インストール RUN curl -LsSf https://astral.sh/uv/install.sh | sh @@ -41,19 +39,20 @@ # python インストール RUN uv python install -COPY ./pyproject.toml /opt/jupyter/ + +# Jupyter Lab 実行時の作業ディレクトリ +WORKDIR /opt/jupyter/jupyterlab +COPY --chown=jupyter:jupyter ./pyproject.toml /opt/jupyter/jupyterlab RUN uv sync -RUN uv run --with jupyter jupyter lab --generate-config && \ +RUN uv run jupyter lab --generate-config && \ sed -i \ -e "s/^# c.ServerApp.ip.*$/c.ServerApp.ip = '0.0.0.0'/" \ -e "s/^# c.ServerApp.port.*$/c.ServerApp.port = 8000/" \ -e "s/^# c.ServerApp.password_required.*$/c.ServerApp.password_required = False/" \ -e "s/^# c.ServerApp.token.*$/c.ServerApp.token = 'jupyter'/" \ + -e "s/^# c.ServerApp.notebook_dir.*$/c.ServerApp.notebook_dir = '\/opt\/jupyter\/jupyterlab\/notebook'/" \ ~/.jupyter/jupyter_lab_config.py -# Jupyter Lab 実行時の作業ディレクトリ -WORKDIR /opt/jupyter/jupyterlab - -CMD ["uv", "run", "--with", "jupyter", "jupyter", "lab"] +CMD ["uv", "run", "jupyter", "lab"] diff --git a/jupyter/Dockerfile.cpu b/jupyter/Dockerfile.cpu deleted file mode 100644 index c98acf4..0000000 --- a/jupyter/Dockerfile.cpu +++ /dev/null @@ -1,59 +0,0 @@ -FROM python:3.10.17-bookworm - -ENV DEBIAN_FRONTEND=noninteractive -# ENV http_proxy=http://127.0.0.1:3128/ -# ENV https_proxy=http://127.0.0.1:3128/ - -# 必要パッケージインストール -RUN \ - apt-get update && \ - apt-get -y upgrade && \ - apt-get install -y \ - sudo \ - wget \ - git \ - curl \ - python3 \ - python3-dev \ - python3-pip \ - ffmpeg \ - postgresql-client \ - && \ - rm -rf /var/lib/apt/lists/* - - -# ユーザー追加 -RUN useradd -m jupyter --home-dir /opt/jupyter && \ - echo "jupyter ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/jupyter - -# jupyter ユーザーで実行 -USER jupyter -WORKDIR /opt/jupyter - -# ollama インストール -# RUN curl -fsSL https://ollama.com/install.sh | sh - -# uv インストール -RUN curl -LsSf https://astral.sh/uv/install.sh | sh - -# uv 環境変数設定 -ENV PATH /opt/jupyter/.local/bin:$PATH - -# python インストール -RUN uv python install -COPY ./pyproject.toml /opt/jupyter/ - -RUN uv sync -RUN uv run --with jupyter jupyter lab --generate-config && \ - sed -i \ - -e "s/^# c.ServerApp.ip.*$/c.ServerApp.ip = '0.0.0.0'/" \ - -e "s/^# c.ServerApp.port.*$/c.ServerApp.port = 8000/" \ - -e "s/^# c.ServerApp.password_required.*$/c.ServerApp.password_required = False/" \ - -e "s/^# c.ServerApp.token.*$/c.ServerApp.token = 'jupyter'/" \ - ~/.jupyter/jupyter_lab_config.py - -# Jupyter Lab 実行時の作業ディレクトリ -WORKDIR /opt/jupyter/jupyterlab - -CMD ["uv", "run", "--with", "jupyter", "jupyter", "lab"] - diff --git a/jupyter/Dockerfile.gpu b/jupyter/Dockerfile.gpu deleted file mode 100644 index 3ec58d8..0000000 --- a/jupyter/Dockerfile.gpu +++ /dev/null @@ -1,63 +0,0 @@ -FROM nvidia/cuda:12.6.3-cudnn-runtime-ubuntu24.04 - -ENV DEBIAN_FRONTEND=noninteractive -# ENV http_proxy=http://127.0.0.1:3128/ -# ENV https_proxy=http://127.0.0.1:3128/ - -# 必要パッケージインストール -RUN \ - apt-get update && \ - apt-get -y upgrade && \ - apt-get install -y \ - sudo \ - wget \ - git \ - curl \ - python3 \ - python3-dev \ - python3-pip \ - ffmpeg \ - build-essential libbz2-dev libdb-dev \ - libreadline-dev libffi-dev libgdbm-dev liblzma-dev \ - libncursesw5-dev libsqlite3-dev libssl-dev \ - zlib1g-dev uuid-dev tk-dev \ - postgresql-client \ - && \ - rm -rf /var/lib/apt/lists/* - - -# ユーザー追加 -RUN useradd -m jupyter --home-dir /opt/jupyter && \ - echo "jupyter ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/jupyter - -# jupyter ユーザーで実行 -USER jupyter -WORKDIR /opt/jupyter - -# ollama インストール -RUN curl -fsSL https://ollama.com/install.sh | sh - -# uv インストール -RUN curl -LsSf https://astral.sh/uv/install.sh | sh - -# uv 環境変数設定 -ENV PATH /opt/jupyter/.local/bin:$PATH - -# python インストール -RUN uv python install -COPY ./pyproject.toml /opt/jupyter/ - -RUN uv sync -RUN uv run --with jupyter jupyter lab --generate-config && \ - sed -i \ - -e "s/^# c.ServerApp.ip.*$/c.ServerApp.ip = '0.0.0.0'/" \ - -e "s/^# c.ServerApp.port.*$/c.ServerApp.port = 8000/" \ - -e "s/^# c.ServerApp.password_required.*$/c.ServerApp.password_required = False/" \ - -e "s/^# c.ServerApp.token.*$/c.ServerApp.token = 'jupyter'/" \ - ~/.jupyter/jupyter_lab_config.py - -# Jupyter Lab 実行時の作業ディレクトリ -WORKDIR /opt/jupyter/jupyterlab - -CMD ["uv", "run", "--with", "jupyter", "jupyter", "lab"] - diff --git a/jupyter/pyproject.toml b/jupyter/pyproject.toml index 2be6ffd..4f04dc9 100644 --- a/jupyter/pyproject.toml +++ b/jupyter/pyproject.toml @@ -1,10 +1,11 @@ [project] -name = "tmp" +name = "jupyter-docker" version = "0.1.0" description = "Add your description here" readme = "README.md" requires-python = ">=3.13" dependencies = [ + "jupyterlab>=4.4.7", "matplotlib>=3.10.6", "numpy>=2.3.2", "ollama>=0.5.3", @@ -15,3 +16,8 @@ "requests>=2.32.5", "sqlalchemy>=2.0.43", ] + +[tool.uv.workspace] +members = [ + "tmp", +] diff --git a/jupyter_gpu/Dockerfile b/jupyter_gpu/Dockerfile new file mode 100644 index 0000000..10b009f --- /dev/null +++ b/jupyter_gpu/Dockerfile @@ -0,0 +1,59 @@ +FROM nvidia/cuda:12.6.3-cudnn-runtime-ubuntu24.04 + +ENV DEBIAN_FRONTEND=noninteractive +# ENV http_proxy=http://127.0.0.1:3128/ +# ENV https_proxy=http://127.0.0.1:3128/ +# ENV no_proxy=localhost,127.0.0.1 + +# 必要パッケージインストール +RUN \ + apt-get update && \ + apt-get -y upgrade && \ + apt-get install -y \ + sudo \ + wget \ + git \ + curl \ + ffmpeg \ + postgresql-client \ + && \ + rm -rf /var/lib/apt/lists/* + + +# ユーザー追加 +RUN useradd -m jupyter --home-dir /opt/jupyter && \ + echo "jupyter ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/jupyter + +# jupyter ユーザーで実行 +USER jupyter +WORKDIR /opt/jupyter + +# ollama インストール +RUN curl -fsSL https://ollama.com/install.sh | sh + +# uv インストール +RUN curl -LsSf https://astral.sh/uv/install.sh | sh + +# uv 環境変数設定 +ENV PATH /opt/jupyter/.local/bin:$PATH + +# python インストール +RUN uv python install + +# Jupyter Lab 実行時の作業ディレクトリ +WORKDIR /opt/jupyter/jupyterlab +COPY --chown=jupyter:jupyter ./pyproject.toml /opt/jupyter/jupyterlab + +RUN uv sync +RUN uv run jupyter lab --generate-config && \ + sed -i \ + -e "s/^# c.ServerApp.ip.*$/c.ServerApp.ip = '0.0.0.0'/" \ + -e "s/^# c.ServerApp.port.*$/c.ServerApp.port = 8000/" \ + -e "s/^# c.ServerApp.password_required.*$/c.ServerApp.password_required = False/" \ + -e "s/^# c.ServerApp.token.*$/c.ServerApp.token = 'jupyter'/" \ + -e "s/^# c.ServerApp.notebook_dir.*$/c.ServerApp.notebook_dir = '\/opt\/jupyter\/jupyterlab\/notebook'/" \ + ~/.jupyter/jupyter_lab_config.py + + +CMD ["uv", "run", "jupyter", "lab"] + diff --git a/jupyter_gpu/pyproject.toml b/jupyter_gpu/pyproject.toml new file mode 100644 index 0000000..bb33b75 --- /dev/null +++ b/jupyter_gpu/pyproject.toml @@ -0,0 +1,18 @@ +[project] +name = "jupyter-docker-gpu" +version = "0.1.0" +description = "Add your description here" +readme = "README.md" +requires-python = ">=3.13" +dependencies = [ + "jupyterlab>=4.4.7", + "matplotlib>=3.10.6", + "numpy>=2.3.2", + "ollama>=0.5.3", + "openpyxl>=3.1.5", + "pandas>=2.3.2", + "psycopg-binary>=3.2.9", + "python-dotenv>=1.1.1", + "requests>=2.32.5", + "sqlalchemy>=2.0.43", +] diff --git a/notebook/.ipynb_checkpoints/README-checkpoint.ipynb b/notebook/.ipynb_checkpoints/README-checkpoint.ipynb new file mode 100644 index 0000000..363fcab --- /dev/null +++ b/notebook/.ipynb_checkpoints/README-checkpoint.ipynb @@ -0,0 +1,6 @@ +{ + "cells": [], + "metadata": {}, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/notebook/.ipynb_checkpoints/Untitled-checkpoint.ipynb b/notebook/.ipynb_checkpoints/Untitled-checkpoint.ipynb deleted file mode 100644 index 363fcab..0000000 --- a/notebook/.ipynb_checkpoints/Untitled-checkpoint.ipynb +++ /dev/null @@ -1,6 +0,0 @@ -{ - "cells": [], - "metadata": {}, - "nbformat": 4, - "nbformat_minor": 5 -} diff --git a/README.md b/README.md index 0fc1f95..4eeabe3 100644 --- a/README.md +++ b/README.md @@ -1,32 +1,38 @@ # Jupyter Lab +次の2種類を用意しています。 +- CPU 版 +- GPU 版 (CUDA 13.0.0 cuDNN) + +GPU 対応バージョンを変更する場合は、 +jupyter_gpu/Docker ファイルの FROM を適宜修正ください。 + +# CPU 版 +``` # イメージ作成 - -* GPU対応の場合 -``` -cp jupyter/Dockerfile.gpu jupyter/Dockerfile -docker compose build -``` - - -* CPU の場合 -``` -cp jupyter/Dockerfile.cpu jupyter/Dockerfile -docker compose build -``` - +docker compose --profile jupyter build # 起動 -docker compose up -d +docker compose --profile jupyter up -d +``` +# GPU 版 (CUDA 13.0.0 cuDNN) +``` +# イメージ作成 +docker compose --profile jupyter_gpu build -# 終了 -docker compose down - +# 起動 +docker compose --profile jupyter_gpu up -d +``` # Jupyter Lab へのアクセス http://localhost:8000/lab?token=jupyter notebook 配下にファイルが保存されます。 +パッケージの追加等は、uv にて可能です。 +``` +!uv add <パッケージ> +``` + diff --git a/docker-compose.yaml b/docker-compose.yaml index ad65041..d415735 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,4 +1,25 @@ services: + jupyter_gpu: + build: + context: ./jupyter_gpu + dockerfile: Dockerfile + image: jupyter_gpu:cuda-12.6-cudnn-runtime + ports: + - 0.0.0.0:8000:8000 + volumes: + - ./notebook:/opt/jupyter/jupyterlab/notebook + tty: true + #environment: + # - NVIDIA_DISABLE_REQUIRE: true + deploy: + resources: + reservations: + devices: + - driver: nvidia + count: 1 + capabilities: [gpu] + profiles: + - jupyter_gpu jupyter: build: context: ./jupyter @@ -7,15 +28,8 @@ ports: - 0.0.0.0:8000:8000 volumes: - - ./notebook:/opt/jupyter/jupyterlab + - ./notebook:/opt/jupyter/jupyterlab/notebook tty: true - deploy: - resources: - reservations: - devices: - - driver: nvidia - count: 1 - capabilities: [gpu] - - + profiles: + - jupyter diff --git a/jupyter/Dockerfile b/jupyter/Dockerfile index c98acf4..db5bfab 100644 --- a/jupyter/Dockerfile +++ b/jupyter/Dockerfile @@ -1,8 +1,9 @@ -FROM python:3.10.17-bookworm +FROM python:3.10.18-bookworm ENV DEBIAN_FRONTEND=noninteractive # ENV http_proxy=http://127.0.0.1:3128/ # ENV https_proxy=http://127.0.0.1:3128/ +# ENV no_proxy=localhost,127.0.0.1 # 必要パッケージインストール RUN \ @@ -13,9 +14,6 @@ wget \ git \ curl \ - python3 \ - python3-dev \ - python3-pip \ ffmpeg \ postgresql-client \ && \ @@ -31,7 +29,7 @@ WORKDIR /opt/jupyter # ollama インストール -# RUN curl -fsSL https://ollama.com/install.sh | sh +RUN curl -fsSL https://ollama.com/install.sh | sh # uv インストール RUN curl -LsSf https://astral.sh/uv/install.sh | sh @@ -41,19 +39,20 @@ # python インストール RUN uv python install -COPY ./pyproject.toml /opt/jupyter/ + +# Jupyter Lab 実行時の作業ディレクトリ +WORKDIR /opt/jupyter/jupyterlab +COPY --chown=jupyter:jupyter ./pyproject.toml /opt/jupyter/jupyterlab RUN uv sync -RUN uv run --with jupyter jupyter lab --generate-config && \ +RUN uv run jupyter lab --generate-config && \ sed -i \ -e "s/^# c.ServerApp.ip.*$/c.ServerApp.ip = '0.0.0.0'/" \ -e "s/^# c.ServerApp.port.*$/c.ServerApp.port = 8000/" \ -e "s/^# c.ServerApp.password_required.*$/c.ServerApp.password_required = False/" \ -e "s/^# c.ServerApp.token.*$/c.ServerApp.token = 'jupyter'/" \ + -e "s/^# c.ServerApp.notebook_dir.*$/c.ServerApp.notebook_dir = '\/opt\/jupyter\/jupyterlab\/notebook'/" \ ~/.jupyter/jupyter_lab_config.py -# Jupyter Lab 実行時の作業ディレクトリ -WORKDIR /opt/jupyter/jupyterlab - -CMD ["uv", "run", "--with", "jupyter", "jupyter", "lab"] +CMD ["uv", "run", "jupyter", "lab"] diff --git a/jupyter/Dockerfile.cpu b/jupyter/Dockerfile.cpu deleted file mode 100644 index c98acf4..0000000 --- a/jupyter/Dockerfile.cpu +++ /dev/null @@ -1,59 +0,0 @@ -FROM python:3.10.17-bookworm - -ENV DEBIAN_FRONTEND=noninteractive -# ENV http_proxy=http://127.0.0.1:3128/ -# ENV https_proxy=http://127.0.0.1:3128/ - -# 必要パッケージインストール -RUN \ - apt-get update && \ - apt-get -y upgrade && \ - apt-get install -y \ - sudo \ - wget \ - git \ - curl \ - python3 \ - python3-dev \ - python3-pip \ - ffmpeg \ - postgresql-client \ - && \ - rm -rf /var/lib/apt/lists/* - - -# ユーザー追加 -RUN useradd -m jupyter --home-dir /opt/jupyter && \ - echo "jupyter ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/jupyter - -# jupyter ユーザーで実行 -USER jupyter -WORKDIR /opt/jupyter - -# ollama インストール -# RUN curl -fsSL https://ollama.com/install.sh | sh - -# uv インストール -RUN curl -LsSf https://astral.sh/uv/install.sh | sh - -# uv 環境変数設定 -ENV PATH /opt/jupyter/.local/bin:$PATH - -# python インストール -RUN uv python install -COPY ./pyproject.toml /opt/jupyter/ - -RUN uv sync -RUN uv run --with jupyter jupyter lab --generate-config && \ - sed -i \ - -e "s/^# c.ServerApp.ip.*$/c.ServerApp.ip = '0.0.0.0'/" \ - -e "s/^# c.ServerApp.port.*$/c.ServerApp.port = 8000/" \ - -e "s/^# c.ServerApp.password_required.*$/c.ServerApp.password_required = False/" \ - -e "s/^# c.ServerApp.token.*$/c.ServerApp.token = 'jupyter'/" \ - ~/.jupyter/jupyter_lab_config.py - -# Jupyter Lab 実行時の作業ディレクトリ -WORKDIR /opt/jupyter/jupyterlab - -CMD ["uv", "run", "--with", "jupyter", "jupyter", "lab"] - diff --git a/jupyter/Dockerfile.gpu b/jupyter/Dockerfile.gpu deleted file mode 100644 index 3ec58d8..0000000 --- a/jupyter/Dockerfile.gpu +++ /dev/null @@ -1,63 +0,0 @@ -FROM nvidia/cuda:12.6.3-cudnn-runtime-ubuntu24.04 - -ENV DEBIAN_FRONTEND=noninteractive -# ENV http_proxy=http://127.0.0.1:3128/ -# ENV https_proxy=http://127.0.0.1:3128/ - -# 必要パッケージインストール -RUN \ - apt-get update && \ - apt-get -y upgrade && \ - apt-get install -y \ - sudo \ - wget \ - git \ - curl \ - python3 \ - python3-dev \ - python3-pip \ - ffmpeg \ - build-essential libbz2-dev libdb-dev \ - libreadline-dev libffi-dev libgdbm-dev liblzma-dev \ - libncursesw5-dev libsqlite3-dev libssl-dev \ - zlib1g-dev uuid-dev tk-dev \ - postgresql-client \ - && \ - rm -rf /var/lib/apt/lists/* - - -# ユーザー追加 -RUN useradd -m jupyter --home-dir /opt/jupyter && \ - echo "jupyter ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/jupyter - -# jupyter ユーザーで実行 -USER jupyter -WORKDIR /opt/jupyter - -# ollama インストール -RUN curl -fsSL https://ollama.com/install.sh | sh - -# uv インストール -RUN curl -LsSf https://astral.sh/uv/install.sh | sh - -# uv 環境変数設定 -ENV PATH /opt/jupyter/.local/bin:$PATH - -# python インストール -RUN uv python install -COPY ./pyproject.toml /opt/jupyter/ - -RUN uv sync -RUN uv run --with jupyter jupyter lab --generate-config && \ - sed -i \ - -e "s/^# c.ServerApp.ip.*$/c.ServerApp.ip = '0.0.0.0'/" \ - -e "s/^# c.ServerApp.port.*$/c.ServerApp.port = 8000/" \ - -e "s/^# c.ServerApp.password_required.*$/c.ServerApp.password_required = False/" \ - -e "s/^# c.ServerApp.token.*$/c.ServerApp.token = 'jupyter'/" \ - ~/.jupyter/jupyter_lab_config.py - -# Jupyter Lab 実行時の作業ディレクトリ -WORKDIR /opt/jupyter/jupyterlab - -CMD ["uv", "run", "--with", "jupyter", "jupyter", "lab"] - diff --git a/jupyter/pyproject.toml b/jupyter/pyproject.toml index 2be6ffd..4f04dc9 100644 --- a/jupyter/pyproject.toml +++ b/jupyter/pyproject.toml @@ -1,10 +1,11 @@ [project] -name = "tmp" +name = "jupyter-docker" version = "0.1.0" description = "Add your description here" readme = "README.md" requires-python = ">=3.13" dependencies = [ + "jupyterlab>=4.4.7", "matplotlib>=3.10.6", "numpy>=2.3.2", "ollama>=0.5.3", @@ -15,3 +16,8 @@ "requests>=2.32.5", "sqlalchemy>=2.0.43", ] + +[tool.uv.workspace] +members = [ + "tmp", +] diff --git a/jupyter_gpu/Dockerfile b/jupyter_gpu/Dockerfile new file mode 100644 index 0000000..10b009f --- /dev/null +++ b/jupyter_gpu/Dockerfile @@ -0,0 +1,59 @@ +FROM nvidia/cuda:12.6.3-cudnn-runtime-ubuntu24.04 + +ENV DEBIAN_FRONTEND=noninteractive +# ENV http_proxy=http://127.0.0.1:3128/ +# ENV https_proxy=http://127.0.0.1:3128/ +# ENV no_proxy=localhost,127.0.0.1 + +# 必要パッケージインストール +RUN \ + apt-get update && \ + apt-get -y upgrade && \ + apt-get install -y \ + sudo \ + wget \ + git \ + curl \ + ffmpeg \ + postgresql-client \ + && \ + rm -rf /var/lib/apt/lists/* + + +# ユーザー追加 +RUN useradd -m jupyter --home-dir /opt/jupyter && \ + echo "jupyter ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/jupyter + +# jupyter ユーザーで実行 +USER jupyter +WORKDIR /opt/jupyter + +# ollama インストール +RUN curl -fsSL https://ollama.com/install.sh | sh + +# uv インストール +RUN curl -LsSf https://astral.sh/uv/install.sh | sh + +# uv 環境変数設定 +ENV PATH /opt/jupyter/.local/bin:$PATH + +# python インストール +RUN uv python install + +# Jupyter Lab 実行時の作業ディレクトリ +WORKDIR /opt/jupyter/jupyterlab +COPY --chown=jupyter:jupyter ./pyproject.toml /opt/jupyter/jupyterlab + +RUN uv sync +RUN uv run jupyter lab --generate-config && \ + sed -i \ + -e "s/^# c.ServerApp.ip.*$/c.ServerApp.ip = '0.0.0.0'/" \ + -e "s/^# c.ServerApp.port.*$/c.ServerApp.port = 8000/" \ + -e "s/^# c.ServerApp.password_required.*$/c.ServerApp.password_required = False/" \ + -e "s/^# c.ServerApp.token.*$/c.ServerApp.token = 'jupyter'/" \ + -e "s/^# c.ServerApp.notebook_dir.*$/c.ServerApp.notebook_dir = '\/opt\/jupyter\/jupyterlab\/notebook'/" \ + ~/.jupyter/jupyter_lab_config.py + + +CMD ["uv", "run", "jupyter", "lab"] + diff --git a/jupyter_gpu/pyproject.toml b/jupyter_gpu/pyproject.toml new file mode 100644 index 0000000..bb33b75 --- /dev/null +++ b/jupyter_gpu/pyproject.toml @@ -0,0 +1,18 @@ +[project] +name = "jupyter-docker-gpu" +version = "0.1.0" +description = "Add your description here" +readme = "README.md" +requires-python = ">=3.13" +dependencies = [ + "jupyterlab>=4.4.7", + "matplotlib>=3.10.6", + "numpy>=2.3.2", + "ollama>=0.5.3", + "openpyxl>=3.1.5", + "pandas>=2.3.2", + "psycopg-binary>=3.2.9", + "python-dotenv>=1.1.1", + "requests>=2.32.5", + "sqlalchemy>=2.0.43", +] diff --git a/notebook/.ipynb_checkpoints/README-checkpoint.ipynb b/notebook/.ipynb_checkpoints/README-checkpoint.ipynb new file mode 100644 index 0000000..363fcab --- /dev/null +++ b/notebook/.ipynb_checkpoints/README-checkpoint.ipynb @@ -0,0 +1,6 @@ +{ + "cells": [], + "metadata": {}, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/notebook/.ipynb_checkpoints/Untitled-checkpoint.ipynb b/notebook/.ipynb_checkpoints/Untitled-checkpoint.ipynb deleted file mode 100644 index 363fcab..0000000 --- a/notebook/.ipynb_checkpoints/Untitled-checkpoint.ipynb +++ /dev/null @@ -1,6 +0,0 @@ -{ - "cells": [], - "metadata": {}, - "nbformat": 4, - "nbformat_minor": 5 -} diff --git a/notebook/README.ipynb b/notebook/README.ipynb new file mode 100644 index 0000000..0a04b31 --- /dev/null +++ b/notebook/README.ipynb @@ -0,0 +1,64 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "f2e6b73f-063b-4f10-910f-2d46ed66b20b", + "metadata": {}, + "source": [ + "# Jupyter Lab 環境" + ] + }, + { + "cell_type": "markdown", + "id": "ed269f64-d9de-481b-a4b1-d4823316cc3e", + "metadata": {}, + "source": [ + "2. パッケージの追加\n", + "次のコマンドで追加ください。" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "200e60e3-1ddc-492b-b683-d7fc2e7bb6eb", + "metadata": {}, + "outputs": [], + "source": [ + "!uv add <パッケージ>" + ] + }, + { + "cell_type": "markdown", + "id": "f9005a2d-0458-4f8c-a2dc-d6d741ab5109", + "metadata": {}, + "source": [ + "3. その他ツールなど\n", + "次のコマンドがインストールされています。\n", + "\n", + "- ollama\n", + "- psql" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.13.7" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/README.md b/README.md index 0fc1f95..4eeabe3 100644 --- a/README.md +++ b/README.md @@ -1,32 +1,38 @@ # Jupyter Lab +次の2種類を用意しています。 +- CPU 版 +- GPU 版 (CUDA 13.0.0 cuDNN) + +GPU 対応バージョンを変更する場合は、 +jupyter_gpu/Docker ファイルの FROM を適宜修正ください。 + +# CPU 版 +``` # イメージ作成 - -* GPU対応の場合 -``` -cp jupyter/Dockerfile.gpu jupyter/Dockerfile -docker compose build -``` - - -* CPU の場合 -``` -cp jupyter/Dockerfile.cpu jupyter/Dockerfile -docker compose build -``` - +docker compose --profile jupyter build # 起動 -docker compose up -d +docker compose --profile jupyter up -d +``` +# GPU 版 (CUDA 13.0.0 cuDNN) +``` +# イメージ作成 +docker compose --profile jupyter_gpu build -# 終了 -docker compose down - +# 起動 +docker compose --profile jupyter_gpu up -d +``` # Jupyter Lab へのアクセス http://localhost:8000/lab?token=jupyter notebook 配下にファイルが保存されます。 +パッケージの追加等は、uv にて可能です。 +``` +!uv add <パッケージ> +``` + diff --git a/docker-compose.yaml b/docker-compose.yaml index ad65041..d415735 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,4 +1,25 @@ services: + jupyter_gpu: + build: + context: ./jupyter_gpu + dockerfile: Dockerfile + image: jupyter_gpu:cuda-12.6-cudnn-runtime + ports: + - 0.0.0.0:8000:8000 + volumes: + - ./notebook:/opt/jupyter/jupyterlab/notebook + tty: true + #environment: + # - NVIDIA_DISABLE_REQUIRE: true + deploy: + resources: + reservations: + devices: + - driver: nvidia + count: 1 + capabilities: [gpu] + profiles: + - jupyter_gpu jupyter: build: context: ./jupyter @@ -7,15 +28,8 @@ ports: - 0.0.0.0:8000:8000 volumes: - - ./notebook:/opt/jupyter/jupyterlab + - ./notebook:/opt/jupyter/jupyterlab/notebook tty: true - deploy: - resources: - reservations: - devices: - - driver: nvidia - count: 1 - capabilities: [gpu] - - + profiles: + - jupyter diff --git a/jupyter/Dockerfile b/jupyter/Dockerfile index c98acf4..db5bfab 100644 --- a/jupyter/Dockerfile +++ b/jupyter/Dockerfile @@ -1,8 +1,9 @@ -FROM python:3.10.17-bookworm +FROM python:3.10.18-bookworm ENV DEBIAN_FRONTEND=noninteractive # ENV http_proxy=http://127.0.0.1:3128/ # ENV https_proxy=http://127.0.0.1:3128/ +# ENV no_proxy=localhost,127.0.0.1 # 必要パッケージインストール RUN \ @@ -13,9 +14,6 @@ wget \ git \ curl \ - python3 \ - python3-dev \ - python3-pip \ ffmpeg \ postgresql-client \ && \ @@ -31,7 +29,7 @@ WORKDIR /opt/jupyter # ollama インストール -# RUN curl -fsSL https://ollama.com/install.sh | sh +RUN curl -fsSL https://ollama.com/install.sh | sh # uv インストール RUN curl -LsSf https://astral.sh/uv/install.sh | sh @@ -41,19 +39,20 @@ # python インストール RUN uv python install -COPY ./pyproject.toml /opt/jupyter/ + +# Jupyter Lab 実行時の作業ディレクトリ +WORKDIR /opt/jupyter/jupyterlab +COPY --chown=jupyter:jupyter ./pyproject.toml /opt/jupyter/jupyterlab RUN uv sync -RUN uv run --with jupyter jupyter lab --generate-config && \ +RUN uv run jupyter lab --generate-config && \ sed -i \ -e "s/^# c.ServerApp.ip.*$/c.ServerApp.ip = '0.0.0.0'/" \ -e "s/^# c.ServerApp.port.*$/c.ServerApp.port = 8000/" \ -e "s/^# c.ServerApp.password_required.*$/c.ServerApp.password_required = False/" \ -e "s/^# c.ServerApp.token.*$/c.ServerApp.token = 'jupyter'/" \ + -e "s/^# c.ServerApp.notebook_dir.*$/c.ServerApp.notebook_dir = '\/opt\/jupyter\/jupyterlab\/notebook'/" \ ~/.jupyter/jupyter_lab_config.py -# Jupyter Lab 実行時の作業ディレクトリ -WORKDIR /opt/jupyter/jupyterlab - -CMD ["uv", "run", "--with", "jupyter", "jupyter", "lab"] +CMD ["uv", "run", "jupyter", "lab"] diff --git a/jupyter/Dockerfile.cpu b/jupyter/Dockerfile.cpu deleted file mode 100644 index c98acf4..0000000 --- a/jupyter/Dockerfile.cpu +++ /dev/null @@ -1,59 +0,0 @@ -FROM python:3.10.17-bookworm - -ENV DEBIAN_FRONTEND=noninteractive -# ENV http_proxy=http://127.0.0.1:3128/ -# ENV https_proxy=http://127.0.0.1:3128/ - -# 必要パッケージインストール -RUN \ - apt-get update && \ - apt-get -y upgrade && \ - apt-get install -y \ - sudo \ - wget \ - git \ - curl \ - python3 \ - python3-dev \ - python3-pip \ - ffmpeg \ - postgresql-client \ - && \ - rm -rf /var/lib/apt/lists/* - - -# ユーザー追加 -RUN useradd -m jupyter --home-dir /opt/jupyter && \ - echo "jupyter ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/jupyter - -# jupyter ユーザーで実行 -USER jupyter -WORKDIR /opt/jupyter - -# ollama インストール -# RUN curl -fsSL https://ollama.com/install.sh | sh - -# uv インストール -RUN curl -LsSf https://astral.sh/uv/install.sh | sh - -# uv 環境変数設定 -ENV PATH /opt/jupyter/.local/bin:$PATH - -# python インストール -RUN uv python install -COPY ./pyproject.toml /opt/jupyter/ - -RUN uv sync -RUN uv run --with jupyter jupyter lab --generate-config && \ - sed -i \ - -e "s/^# c.ServerApp.ip.*$/c.ServerApp.ip = '0.0.0.0'/" \ - -e "s/^# c.ServerApp.port.*$/c.ServerApp.port = 8000/" \ - -e "s/^# c.ServerApp.password_required.*$/c.ServerApp.password_required = False/" \ - -e "s/^# c.ServerApp.token.*$/c.ServerApp.token = 'jupyter'/" \ - ~/.jupyter/jupyter_lab_config.py - -# Jupyter Lab 実行時の作業ディレクトリ -WORKDIR /opt/jupyter/jupyterlab - -CMD ["uv", "run", "--with", "jupyter", "jupyter", "lab"] - diff --git a/jupyter/Dockerfile.gpu b/jupyter/Dockerfile.gpu deleted file mode 100644 index 3ec58d8..0000000 --- a/jupyter/Dockerfile.gpu +++ /dev/null @@ -1,63 +0,0 @@ -FROM nvidia/cuda:12.6.3-cudnn-runtime-ubuntu24.04 - -ENV DEBIAN_FRONTEND=noninteractive -# ENV http_proxy=http://127.0.0.1:3128/ -# ENV https_proxy=http://127.0.0.1:3128/ - -# 必要パッケージインストール -RUN \ - apt-get update && \ - apt-get -y upgrade && \ - apt-get install -y \ - sudo \ - wget \ - git \ - curl \ - python3 \ - python3-dev \ - python3-pip \ - ffmpeg \ - build-essential libbz2-dev libdb-dev \ - libreadline-dev libffi-dev libgdbm-dev liblzma-dev \ - libncursesw5-dev libsqlite3-dev libssl-dev \ - zlib1g-dev uuid-dev tk-dev \ - postgresql-client \ - && \ - rm -rf /var/lib/apt/lists/* - - -# ユーザー追加 -RUN useradd -m jupyter --home-dir /opt/jupyter && \ - echo "jupyter ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/jupyter - -# jupyter ユーザーで実行 -USER jupyter -WORKDIR /opt/jupyter - -# ollama インストール -RUN curl -fsSL https://ollama.com/install.sh | sh - -# uv インストール -RUN curl -LsSf https://astral.sh/uv/install.sh | sh - -# uv 環境変数設定 -ENV PATH /opt/jupyter/.local/bin:$PATH - -# python インストール -RUN uv python install -COPY ./pyproject.toml /opt/jupyter/ - -RUN uv sync -RUN uv run --with jupyter jupyter lab --generate-config && \ - sed -i \ - -e "s/^# c.ServerApp.ip.*$/c.ServerApp.ip = '0.0.0.0'/" \ - -e "s/^# c.ServerApp.port.*$/c.ServerApp.port = 8000/" \ - -e "s/^# c.ServerApp.password_required.*$/c.ServerApp.password_required = False/" \ - -e "s/^# c.ServerApp.token.*$/c.ServerApp.token = 'jupyter'/" \ - ~/.jupyter/jupyter_lab_config.py - -# Jupyter Lab 実行時の作業ディレクトリ -WORKDIR /opt/jupyter/jupyterlab - -CMD ["uv", "run", "--with", "jupyter", "jupyter", "lab"] - diff --git a/jupyter/pyproject.toml b/jupyter/pyproject.toml index 2be6ffd..4f04dc9 100644 --- a/jupyter/pyproject.toml +++ b/jupyter/pyproject.toml @@ -1,10 +1,11 @@ [project] -name = "tmp" +name = "jupyter-docker" version = "0.1.0" description = "Add your description here" readme = "README.md" requires-python = ">=3.13" dependencies = [ + "jupyterlab>=4.4.7", "matplotlib>=3.10.6", "numpy>=2.3.2", "ollama>=0.5.3", @@ -15,3 +16,8 @@ "requests>=2.32.5", "sqlalchemy>=2.0.43", ] + +[tool.uv.workspace] +members = [ + "tmp", +] diff --git a/jupyter_gpu/Dockerfile b/jupyter_gpu/Dockerfile new file mode 100644 index 0000000..10b009f --- /dev/null +++ b/jupyter_gpu/Dockerfile @@ -0,0 +1,59 @@ +FROM nvidia/cuda:12.6.3-cudnn-runtime-ubuntu24.04 + +ENV DEBIAN_FRONTEND=noninteractive +# ENV http_proxy=http://127.0.0.1:3128/ +# ENV https_proxy=http://127.0.0.1:3128/ +# ENV no_proxy=localhost,127.0.0.1 + +# 必要パッケージインストール +RUN \ + apt-get update && \ + apt-get -y upgrade && \ + apt-get install -y \ + sudo \ + wget \ + git \ + curl \ + ffmpeg \ + postgresql-client \ + && \ + rm -rf /var/lib/apt/lists/* + + +# ユーザー追加 +RUN useradd -m jupyter --home-dir /opt/jupyter && \ + echo "jupyter ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/jupyter + +# jupyter ユーザーで実行 +USER jupyter +WORKDIR /opt/jupyter + +# ollama インストール +RUN curl -fsSL https://ollama.com/install.sh | sh + +# uv インストール +RUN curl -LsSf https://astral.sh/uv/install.sh | sh + +# uv 環境変数設定 +ENV PATH /opt/jupyter/.local/bin:$PATH + +# python インストール +RUN uv python install + +# Jupyter Lab 実行時の作業ディレクトリ +WORKDIR /opt/jupyter/jupyterlab +COPY --chown=jupyter:jupyter ./pyproject.toml /opt/jupyter/jupyterlab + +RUN uv sync +RUN uv run jupyter lab --generate-config && \ + sed -i \ + -e "s/^# c.ServerApp.ip.*$/c.ServerApp.ip = '0.0.0.0'/" \ + -e "s/^# c.ServerApp.port.*$/c.ServerApp.port = 8000/" \ + -e "s/^# c.ServerApp.password_required.*$/c.ServerApp.password_required = False/" \ + -e "s/^# c.ServerApp.token.*$/c.ServerApp.token = 'jupyter'/" \ + -e "s/^# c.ServerApp.notebook_dir.*$/c.ServerApp.notebook_dir = '\/opt\/jupyter\/jupyterlab\/notebook'/" \ + ~/.jupyter/jupyter_lab_config.py + + +CMD ["uv", "run", "jupyter", "lab"] + diff --git a/jupyter_gpu/pyproject.toml b/jupyter_gpu/pyproject.toml new file mode 100644 index 0000000..bb33b75 --- /dev/null +++ b/jupyter_gpu/pyproject.toml @@ -0,0 +1,18 @@ +[project] +name = "jupyter-docker-gpu" +version = "0.1.0" +description = "Add your description here" +readme = "README.md" +requires-python = ">=3.13" +dependencies = [ + "jupyterlab>=4.4.7", + "matplotlib>=3.10.6", + "numpy>=2.3.2", + "ollama>=0.5.3", + "openpyxl>=3.1.5", + "pandas>=2.3.2", + "psycopg-binary>=3.2.9", + "python-dotenv>=1.1.1", + "requests>=2.32.5", + "sqlalchemy>=2.0.43", +] diff --git a/notebook/.ipynb_checkpoints/README-checkpoint.ipynb b/notebook/.ipynb_checkpoints/README-checkpoint.ipynb new file mode 100644 index 0000000..363fcab --- /dev/null +++ b/notebook/.ipynb_checkpoints/README-checkpoint.ipynb @@ -0,0 +1,6 @@ +{ + "cells": [], + "metadata": {}, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/notebook/.ipynb_checkpoints/Untitled-checkpoint.ipynb b/notebook/.ipynb_checkpoints/Untitled-checkpoint.ipynb deleted file mode 100644 index 363fcab..0000000 --- a/notebook/.ipynb_checkpoints/Untitled-checkpoint.ipynb +++ /dev/null @@ -1,6 +0,0 @@ -{ - "cells": [], - "metadata": {}, - "nbformat": 4, - "nbformat_minor": 5 -} diff --git a/notebook/README.ipynb b/notebook/README.ipynb new file mode 100644 index 0000000..0a04b31 --- /dev/null +++ b/notebook/README.ipynb @@ -0,0 +1,64 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "f2e6b73f-063b-4f10-910f-2d46ed66b20b", + "metadata": {}, + "source": [ + "# Jupyter Lab 環境" + ] + }, + { + "cell_type": "markdown", + "id": "ed269f64-d9de-481b-a4b1-d4823316cc3e", + "metadata": {}, + "source": [ + "2. パッケージの追加\n", + "次のコマンドで追加ください。" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "200e60e3-1ddc-492b-b683-d7fc2e7bb6eb", + "metadata": {}, + "outputs": [], + "source": [ + "!uv add <パッケージ>" + ] + }, + { + "cell_type": "markdown", + "id": "f9005a2d-0458-4f8c-a2dc-d6d741ab5109", + "metadata": {}, + "source": [ + "3. その他ツールなど\n", + "次のコマンドがインストールされています。\n", + "\n", + "- ollama\n", + "- psql" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.13.7" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/notebook/Untitled.ipynb b/notebook/Untitled.ipynb deleted file mode 100644 index aedccdb..0000000 --- a/notebook/Untitled.ipynb +++ /dev/null @@ -1,181 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": 1, - "id": "1e47706c-bcfc-4c7f-91bc-c2920d3114c8", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Package Version\n", - "------------------------- --------------\n", - "annotated-types 0.7.0\n", - "anyio 4.9.0\n", - "argon2-cffi 25.1.0\n", - "argon2-cffi-bindings 21.2.0\n", - "arrow 1.3.0\n", - "asttokens 3.0.0\n", - "async-lru 2.0.5\n", - "attrs 25.3.0\n", - "babel 2.17.0\n", - "beautifulsoup4 4.13.4\n", - "bleach 6.2.0\n", - "certifi 2025.7.14\n", - "cffi 1.17.1\n", - "charset-normalizer 3.4.2\n", - "comm 0.2.2\n", - "contourpy 1.3.2\n", - "cycler 0.12.1\n", - "debugpy 1.8.15\n", - "decorator 5.2.1\n", - "defusedxml 0.7.1\n", - "et_xmlfile 2.0.0\n", - "executing 2.2.0\n", - "fastjsonschema 2.21.1\n", - "filelock 3.18.0\n", - "fonttools 4.59.0\n", - "fqdn 1.5.1\n", - "fsspec 2025.7.0\n", - "greenlet 3.2.3\n", - "h11 0.16.0\n", - "httpcore 1.0.9\n", - "httpx 0.28.1\n", - "idna 3.10\n", - "ipykernel 6.30.0\n", - "ipython 9.4.0\n", - "ipython_pygments_lexers 1.1.1\n", - "isoduration 20.11.0\n", - "jedi 0.19.2\n", - "Jinja2 3.1.6\n", - "json5 0.12.0\n", - "jsonpointer 3.0.0\n", - "jsonschema 4.25.0\n", - "jsonschema-specifications 2025.4.1\n", - "jupyter_client 8.6.3\n", - "jupyter_core 5.8.1\n", - "jupyter-events 0.12.0\n", - "jupyter-lsp 2.2.6\n", - "jupyter_server 2.16.0\n", - "jupyter_server_terminals 0.5.3\n", - "jupyterlab 4.4.5\n", - "jupyterlab_pygments 0.3.0\n", - "jupyterlab_server 2.27.3\n", - "kiwisolver 1.4.8\n", - "lark 1.2.2\n", - "MarkupSafe 3.0.2\n", - "matplotlib 3.10.3\n", - "matplotlib-inline 0.1.7\n", - "mistune 3.1.3\n", - "mpmath 1.3.0\n", - "nbclient 0.10.2\n", - "nbconvert 7.16.6\n", - "nbformat 5.10.4\n", - "nest-asyncio 1.6.0\n", - "networkx 3.5\n", - "notebook_shim 0.2.4\n", - "numpy 2.3.1\n", - "nvidia-cublas-cu12 12.6.4.1\n", - "nvidia-cuda-cupti-cu12 12.6.80\n", - "nvidia-cuda-nvrtc-cu12 12.6.77\n", - "nvidia-cuda-runtime-cu12 12.6.77\n", - "nvidia-cudnn-cu12 9.5.1.17\n", - "nvidia-cufft-cu12 11.3.0.4\n", - "nvidia-cufile-cu12 1.11.1.6\n", - "nvidia-curand-cu12 10.3.7.77\n", - "nvidia-cusolver-cu12 11.7.1.2\n", - "nvidia-cusparse-cu12 12.5.4.2\n", - "nvidia-cusparselt-cu12 0.6.3\n", - "nvidia-nccl-cu12 2.26.2\n", - "nvidia-nvjitlink-cu12 12.6.85\n", - "nvidia-nvtx-cu12 12.6.77\n", - "ollama 0.5.1\n", - "openpyxl 3.1.5\n", - "overrides 7.7.0\n", - "packaging 25.0\n", - "pandas 2.3.1\n", - "pandocfilters 1.5.1\n", - "parso 0.8.4\n", - "pexpect 4.9.0\n", - "pillow 11.3.0\n", - "pip 25.1.1\n", - "platformdirs 4.3.8\n", - "prometheus_client 0.22.1\n", - "prompt_toolkit 3.0.51\n", - "psutil 7.0.0\n", - "psycopg-binary 3.2.9\n", - "ptyprocess 0.7.0\n", - "pure_eval 0.2.3\n", - "pycparser 2.22\n", - "pydantic 2.11.7\n", - "pydantic_core 2.33.2\n", - "Pygments 2.19.2\n", - "pyparsing 3.2.3\n", - "python-dateutil 2.9.0.post0\n", - "python-dotenv 1.1.1\n", - "python-json-logger 3.3.0\n", - "pytz 2025.2\n", - "PyYAML 6.0.2\n", - "pyzmq 27.0.0\n", - "referencing 0.36.2\n", - "requests 2.32.4\n", - "rfc3339-validator 0.1.4\n", - "rfc3986-validator 0.1.1\n", - "rfc3987-syntax 1.1.0\n", - "rpds-py 0.26.0\n", - "Send2Trash 1.8.3\n", - "setuptools 80.9.0\n", - "six 1.17.0\n", - "sniffio 1.3.1\n", - "soupsieve 2.7\n", - "SQLAlchemy 2.0.41\n", - "stack-data 0.6.3\n", - "sympy 1.14.0\n", - "terminado 0.18.1\n", - "tinycss2 1.4.0\n", - "torch 2.7.1\n", - "tornado 6.5.1\n", - "traitlets 5.14.3\n", - "triton 3.3.1\n", - "types-python-dateutil 2.9.0.20250708\n", - "typing_extensions 4.14.1\n", - "typing-inspection 0.4.1\n", - "tzdata 2025.2\n", - "uri-template 1.3.0\n", - "urllib3 2.5.0\n", - "wcwidth 0.2.13\n", - "webcolors 24.11.1\n", - "webencodings 0.5.1\n", - "websocket-client 1.8.0\n" - ] - } - ], - "source": [ - "!pip list" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.13.5" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -}