Jupyter Notebooks come with pre-configured environments that include software commonly used by researchers for analyses. However, researchers often want to tinker with these packages to create an environment that fits all their needs. Conda is a package management system that assists researchers to find and install the packages they need.
Conda is a cross-platform package management system that works on Windows, MacOS, and Linux. Conda is used to install software packages and their dependencies. As a package manager, it can help you find and install packages.
By default, Jupyter Notebooks come with a pre-configured base environment that includes software most researchers will use for their analyses. However, sometimes you will need to add, remove, or update packages to better suit your needs. To do that, you will need to configure a new conda environment where you can fully customize the installed software.
How to install conda
You can install conda and keep it on a detachable persistent disk.
1. In your Jupyter Notebook, run the following code (this may take 2-4 minutes to complete)
conda create --clone base --prefix /home/jupyter/name_of_new_environment -y
Note: The -y is important. Since the output is non-interactive, this will respond “y” to any prompts. Without the flag, the notebook will hang, and you will need to restart the kernel.
2. To see the new environment, refresh the webpage
3. Verify you're in the correct environment by finding Python[conda:env:name_of_new_environment] in the toolbar.
4. Once you have selected your new kernel, use the following code to customize your environment by adding, removing, or changing versions of packages.
conda install package name
Note: When installing conda on a Jupyter instance, keep in mind the configuration of your persistent disk. If you delete your Cloud Environment while retaining your persistent disk, you will still get rid of conda.
To learn more about setting up your persistent disk, read How to set up persistent disk storage for your analysis app.