Manage packages for notebook environment
When in the editor, you can manage packages for the notebook you are currently working on. Below is the list of your options.
Use the Environment tool
Recommended as the best option, this tool allows you not only to manage packages, but also to manage environment variables and Git repositories used for environment. All customizations made using this tool are saved to the environment.yml file. Packages that you can manage in the Environment tool are persistent.
Use the Environment tool to manage packages for your notebook in the editor.
Open the Environment tool
You have the following options:
Click the Environment icon on the left-hand sidebar.
Select
.Use the command palette.
![Environment tool Environment tool](https://resources.jetbrains.com.cn/help/img/datalore/2025.1/environment_tool.png)
Change environment
Click Change next to the current environment name.
In the Change environment dialog, select another environment.
Click the Apply and restart kernel button to close the dialog and apply the changes.
Find and install packages
You can add packages to the environment of your notebook.
On the Explore tab, type the package name in the search field and press Enter.
After you get the search results, do one of the following:
Click the intended package to open it on a new tab. This allows you to view the package details and choose the version to install.
Hover over the package and click the Install icon to install it immediately.
After the package is installed, click restart kernel in the notification popup to complete the environment update.
Remove an installed package
Go to the Installed tab.
From the package list, hover over the one you want to remove and click the Remove icon.
Click OK in the popup to confirm your action.
After the package is removed, click restart kernel in the notification popup to complete the environment update.
Update an installed package
Go to the Installed tab.
From the package list, click the one you want to update. You can see its details on a new tab.
Click the version picker, select another version from the list, and click the Update button.
Click OK in the popup to confirm your action.
After the package is updated, click restart kernel in the notification popup to complete the environment update.
Use initialization scripts
For some additional tools and dependencies, you can run initialization scripts right in the Datalore editor.
Click init.sh. This will open the file in the editor pane.
Edit the file by adding the required initialization script.
Restart the machine: select Restart machine in the popup in the lower right corner of the editor.
and click
Edit, save, and share environment files
Datalore allows you to customize environment using files that you can then save and share either for selected notebooks or for entire workspaces.
Use 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.
Apply the saved file:
To use the same environment in another notebook, add the saved environment.yml file to the Notebook filescontrol>.
To use the same environment across all notebooks in a selected workspace, add the saved environment.yml file to the Workspace files.
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.
Use the init.sh file
You can use a init.sh file to customize the environment of your notebook via shell commands. You can also 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.
In the tool, click Edit init.sh to install additional dependencies. This will open the file in the editor on the right side of the screen.
Edit the file by adding the required shell commands.
Open the Attached data tool from the left-hand sidebar of the editor.
Download the init.sh file.
Apply the saved file:
To use the same environment in another notebook, add the saved init.sh file to the Notebook files.
To use the same environment across all notebooks in a selected workspace, add the saved init.sh file to the Workspace files.
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 init.sh file installed.
Packages that are added using init.sh files are not saved to the environment.yml file and are not accessible from the Environment tool.