Datalore 2023.6 Help

Customize notebook environment

When in the editor, you can install packages by running commands in the terminal or the notebook, using the Environment tool, or editing the environment.yml file.

Persistence

Packages installed via the Environment tool are persistent. This includes the packages that the Environment tool installs from the edited or newly added environment.yml file. Packages installed via commands are not persistent.

Dependencies

If you need to add a dependency before installing a package, use the terminal or notebook to run appropriate commands. Alternatively, you can edit the init.sh file that you can access via the Environment tool.

environment.yml

Every notebook is created with an automatically generated environment.yml file, which records the selected environment configuration and all changes to it made via the Environment tool. You can save this file to copy a specific environment configuration and use it in other notebooks:

  • Open the attached files of the notebook with the environment that you want to copy.

  • Download the environment.yml file.

  • Add the downloaded file to the attachments of the notebook where you want to use the saved environment configuration.

  • Refresh the attachment file list to make sure the newly added file replaced the old one.

  • Restart the computation to have the packages from the new environment.yml file installed.

Packages added from the environment.yml file are persistent and can be viewed and managed in the Environment tool.

requirements.txt

You can use requirements.txt files to customize the environments of your notebooks. The procedure below includes optional steps for cases when you create such a file in Datalore.

  • Run pip freeze > requirements.txt.

  • Open the Attached data tool and download the requirements.txt file.

  • Add the downloaded file to another notebook's attached files.

  • Run pip install -r requirements.txt.

Packages added from requirements.txt are not persistent and not recorded into environment.yml.

Cloned notebook environment

Cloned notebooks have the environment of the originals.

Last modified: 14 July 2022