Customize notebook environment
When in the editor, you can install packages by running commands in the terminal or the notebook, using the Library manager tool, or editing the environment.yml file.
- Packages installed via the library manager are persistent. This includes the packages that the library manager installs from the edited or newly added environment.yml file. Packages installed via commands are not persistent.
You cannot use the library manager to install packages that have dependencies. If you need to add a dependency before installing a package, use the terminal or notebook to run appropriate commands.
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 library manager. You can save this file to copy a particular 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 library manager.
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.
pip freeze > requirements.txt.
Open the Attached files tool and download requirements.txt.
Add the downloaded file to another notebook's attached files.
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.