Environment
In this guide, we'll explain how to set up your environment using Jupyter Notebook, a web-based computing platform that enables interactive code execution, plotting, and visualization. We'll cover the Ubuntu and CUDA version supported, the pre-installed libraries, and how to create your own custom image.
We provide a Jupyter Notebook environment based on a Docker image that can be hosted on any free container registry, such as GitHub (ghcr.io) or Docker. The image is continuously built and deployed to the server if changes have been made, ensuring that you always have the latest version of the environment.
Ubuntu and CUDA version
Our environment supports the different CUDA versions. Please refer to a2s docker-stacks for the supported versions here.
Python Libraries
Our generic image already contains some popular machine learning frameworks, such as Tensorflow, PyTorch, and Keras. You can find the list of the supported libraries in each image here, while the specific version of PyTorch is defined in the base-gpu-notebook image.
If you need different libraries or versions, you can make a pull request to github.com/a2s-institute/docker-stacks. Once your pull request is reviewed and approved, the new image will automatically be deployed to the server.
Note that you need to wait several minutes for the GitHub action to build and deploy the new image to the registry.
Creating your own image
To create your own custom image, we recommend that you still inherit the base image using our image. This will ensure that all required libraries can run on the server as well as reducing the use of storage to store the image on the server. Here's an example of how to add vim and the Pandas library to the image:
FROM ghcr.io/a2s-institute/docker-stacks/gpu-base-notebook:11.8.0-cudnn8-runtime-ubuntu22.04
LABEL maintainer="b-it-bots <robotics@h-brs.de>"
USER root
RUN apt-get update
# Install vim
RUN apt-get install -y vim
# Install pandas
RUN apt install -y pandas
Creating your own environment on the server
As mentioned in the previous section, the environment is based on the image defined in the docker-stacks. However, if you want to add your own environment on the server without changing the upstream environment, you can do so by installing it directly on the server.
Creating you own conda environment (recommended)
- Open terminal (Notebook Home -> New -> Terminal)
- Crate the environment
conda create --prefix ~/.local/opt/conda/envs/my_env python=3.11 pip ipykernel
infoYou need ipykernel to make it available in Jupyter Notebook
- Add your new conda environment to
.conda/environments.txt
/home/jovyan/.local/opt/conda/envs/my_env
A new kernel with your new environment should be available when you create a new Notebook. You can also switch to your new kernel in your running Notebook session.
If you want to use terminal, you can activate your environment using conda activate
source /opt/conda/bin/activate /home/jovyan/.local/opt/conda/envs/my_env
Installing packages directly to your local Python environment (not recommended)
Open terminal (Notebook Home -> New -> Terminal)
Add your libraries directly via pip
pip install tensorflow==2.13 --user
...
...infoYou should add
--user
argument to make it persistent, otherwise your library will be removed when your Notebook server is terminated.Please not that installing pip environment with
--user
option locally can result in conflicts with the system-wide environment.