Runtimes
In Anaconda Notebooks, a runtime is what powers your code execution. You can think of a runtime as a conda environment connected to a language-specific kernel. Anaconda Notebooks provides several pre-configured runtimes that include the ipykernel
package and all the packages from the latest Anaconda Distribution release, giving you immediate access to a comprehensive data science toolkit.
Environments, kernels, and runtimes
What is an environment?
An environment is a folder or directory that contains a specific collection of conda packages and their dependencies.
Working in separate environments allows you to maintain and run packages without interference from other collections of packages. For example, you may require separate conda environments to maintain distinct versions of Python based on distinct package dependencies.
What is a kernel?
A kernel is a programming-language-specific process that interprets your code, runs it, and gives you the results. In Jupyter Notebooks, kernels allow users to run code in cells and receive immediate output. For example, ipykernel
enables interactive computing in Python, and r-irkernel
enables the same for R.
What is a runtime?
A runtime in Anaconda Notebooks is a conda environment that has been associated with a specific kernel, enabling it to execute code. For an environment to be usable in JupyterLab, it must contain a kernel package (such as ipykernel
for Python). Without this kernel association, JupyterLab cannot recognize the environment as an available option for running notebooks.
The default runtimes provided in Anaconda Notebooks come with the ipykernel
package already installed, making them immediately available for your Python notebooks.
To add a kernel package to a custom environment and create your own runtime, see creating custom runtimes.
Using default runtimes
Custom runtimes often use large amounts of your limited Anaconda Notebooks storage space. Because of this, Anaconda provides a number of read-only default runtimes that contain all the packages from the latest release of Anaconda Distribution.
The default runtime naming convention is typically anaconda-<YEAR>.<MONTH>-py<PYTHON_VERSION>
, which maps to Anaconda Distribution releases:
Environment Name | Status | Description |
---|---|---|
anaconda-2024.02-py10 | Live | Latest Anaconda Packages (stable & recommended) |
anaconda-ai-2024.04-py10 | Live | Latest Anaconda Packages + AI Packages |
anaconda-01-nvidia-a10 | Live | Latest Anaconda, AI, + NVIDIA Packages (see GPU Runtimes) |
To see a list of available runtimes, enter the following in a notebook cell then click Run:
To see a list of packages in your current runtime, enter the following in a notebook cell then click Run:
Creating custom runtimes
If you need a specific set of packages that are not included in one of our default runtimes, you can create your own runtime to customize to your needs.
Custom runtimes are stored using your dedicated, persistent Anaconda Notebooks storage. This ensures the custom runtime remains available after your current session ends. Custom runtimes use your personal storage space and can easily get quite large, so only include the packages you need.
To create a new runtime:
-
Open a terminal from the Launcher, which you can access by clicking the blue plus in the top-left corner.
-
Create a new runtime by running the following command:
- To create a Python runtime, replace
<KERNEL_PACKAGE>
withipykernel
. - To create an R runtime, replace
<KERNEL_PACKAGE>
withr-irkernel
.
- To create a Python runtime, replace
For more information about creating conda environments, see the official conda docs.
It might take a minute for your runtime to be created and available for use. You might need to close and reopen your active notebook or refresh the browser for your new runtime to appear.
Activating a runtime
There are a few locations from which you can activate your runtime:
Run the following in a terminal in Anaconda Notebooks:
Run the following in a terminal in Anaconda Notebooks:
Select the notebook displaying your custom runtime name.
Click the runtime in the top right, then switch to your desired runtime in the Select Runtime modal.
Installing additional packages
Even after you’ve created a runtime, you can continue to add packages as needed. To add packages to a runtime, use the !
syntax to access the system shell and run conda commands. In a notebook cell, run:
Shutting down runtimes
It is best practice to shut down your runtime when you are finished working in it. To shut down a runtime, click Kernels in the top menu, then select the specific runtime you want to shut down or Shut Down All.