Customize notebook environment
When in the editor, you can install and manage packages for the notebook you are currently working on. Below is the list of your options.
Environment tool
Recommended as the best option, this tool not only installs packages, but also allows you to manage packages that you installed by editing the environment.yml. Packages that you can manage in the Environment tool are persistent. Find more details in this topic.
Other options
- Run commands in the notebook or in Terminal
Packages that you install in this way are NOT persistent.
- Edit the environment.yml file
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 data tool from the left-hand sidebar of the editor.
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 file
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.