Customizing Envirionments and Adding Packages
Adding packages - customizing images
In that Jupyter you have access to Jupyter notebooks and a terminal, so you can run any code you want. However, changes that you make by running one-off commands won’t be replicated when you create a Dask cluster or Deployment - or when you restart your Jupyter instance.
Click the “Images” menu item which will show all images you have access to. Saturn administrators will see all images, regular saturn users can only their images, or special images that have been shared with the entire company. Clicking the plus icon will bring up an image creation dialog
We have a few options:
Source: A “Saturn” image is one that Saturn builds for you via configuration files specified below. External is any existing image you want to add to the system. Saturn is configured to pull from the ECR(Elastic Container Registry) associated with your AWS account, and can also pull from any public repository. External images must conform to a certain specification to fully function in Saturn. More on that later.
Share with: Admin users can elect to share the image with any user in Saturn (including the whole company)
Copy configuration from: If you’ve already built an image, this drop down let’s you load that configuration, so that you can modify it, and do a new build.
Image URI: the name of the image you wish to load (if External), or build.
Build Data: Saturn knows how to build images using a few confguration files
- Conda environment, via an
- Pip environment, via a
- apt get - via a list of apt get packages
- postBuild - a bash script that is executed in your Docker container after everything else has been run.
Please see repo2docker for more information on these configuration files.
I will set my “Base Image” to the GPU base as I will eventually attach this to a GPU Jupyter instance. One powerful configuration option is to use a custom conda environment. In the Build Data box, paste in the YAML describing an environment. If you have an existing conda environment, you can run conda env export –no-builds to generate this YAML file. For more details, see the conda documentation.
These are completely new imagesThe
requirements.txtthat you add generates a brand new python environment. These are not modifications of the ones that ship with Saturn. You must include all the packages you’re going to want to use.
You can then check on the status of the image build by clicking on the building status button next to your image:
Once your image has been built, it will appear in the image dropdown on the Jupyter page.
Here are a few examples to help you get started.
Add packages using the conda environment syntax
Add jupyter labextensions under the postBuild tab