# 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](manage-environment-variables-in-a-notebook.html) and [Git repositories](manage-git-repositories-in-notebook-environment.html) used for environment. All customizations made using this tool are saved to the `environment.yml` file. Packages that you can manage in the ![Environment](https://resources.jetbrains.com.cn/help/img/datalore/2026.3/environment.svg)Environment tool are persistent.

Use the ![Environment](https://resources.jetbrains.com.cn/help/img/datalore/2026.3/environment.svg)Environment tool to manage packages for your notebook in the editor.

Procedure: Open the Environment tool

You have the following options:

* Click the ![Environment](https://resources.jetbrains.com.cn/help/img/datalore/2026.3/environment.svg)Environment icon on the left-hand sidebar.

* Select `Main menu | Tools | Environment`.

* Use the [command palette](feedback-and-reference-options.html#palette).

![Environment tool](https://resources.jetbrains.com.cn/help/img/datalore/2026.3/environment_tool.png)

Procedure: Change environment

1. Click Change next to the current environment name.

2. In the Change environment dialog, select another environment.

3. Click the Apply and restart kernel button to close the dialog and apply the changes.

![Change environment dialog](https://resources.jetbrains.com.cn/help/img/datalore/2026.3/change_package.png)

Procedure: Find and install packages

You can add packages to the environment of your notebook.

1. On the Explore tab, type the package name in the search field and press Enter.

2. 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. ![View package to install](https://resources.jetbrains.com.cn/help/img/datalore/2026.3/view_install_package.png)

* Hover over the package and click the Install icon to install it immediately. ![Install package icon](https://resources.jetbrains.com.cn/help/img/datalore/2026.3/package_install.png)

> **Tip:**
> You can select a package from search suggestions while typing your search text.

3. After the package is installed, click restart kernel in the notification popup to complete the environment update.

Procedure: Remove an installed package

1. Go to the Installed tab.

2. From the package list, hover over the one you want to remove and click the Remove icon.

![Remove package icon](https://resources.jetbrains.com.cn/help/img/datalore/2026.3/remove_package.png)

3. Click OK in the popup to confirm your action.

4. After the package is removed, click restart kernel in the notification popup to complete the environment update.

Procedure: Update an installed package

1. Go to the Installed tab.

2. From the package list, click the one you want to update. You can see its details on a new tab.

3. Click the version picker, select another version from the list, and click the Update button.

![Package version picker](https://resources.jetbrains.com.cn/help/img/datalore/2026.3/update_package.png)

4. Click OK in the popup to confirm your action.

5. After the package is updated, click restart kernel in the notification popup to complete the environment update.

Procedure: Use initialization scripts

For some additional tools and dependencies, you can run initialization scripts right in the Datalore editor.

1. Click init.sh. This will open the file in the editor pane.

2. Edit the file by adding the required initialization script.

3. Restart the machine: select `Main menu | Run | Stop machine` and click Restart machine in the popup in the lower right corner of the editor.

> **Tip:**
> To apply an init.sh script to all notebooks in your workspace, move the `init.sh` file to workspace files. This will be executing the added file for any notebook in the workspace once it is started.

## 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.

Procedure: 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.

1. In the sidebar, select ![Attach](https://resources.jetbrains.com.cn/help/img/datalore/2026.3/attach.svg) (Attached data).

2. Download the `environment.yml` file.

3. Apply the saved file:

* To use the same environment in another notebook, add the saved `environment.yml` file to the Notebook files.

* To use the same environment across all notebooks in a selected workspace, add the saved `environment.yml` file to the Workspace files. > **Note:** > Both procedures are performed using the Attached data tool. Find more details in [Add files](add-files.html).

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

5. 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](https://resources.jetbrains.com.cn/help/img/datalore/2026.3/environment.svg)Environment tool.

Procedure: 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.

1. In the sidebar, select ![Attach](https://resources.jetbrains.com.cn/help/img/datalore/2026.3/attach.svg) (Attached data).

2. 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.

3. Edit the file by adding the required shell commands.

4. In the sidebar, select ![Attach](https://resources.jetbrains.com.cn/help/img/datalore/2026.3/attach.svg) (Attached data).

5. Download the `init.sh` file.

6. 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. > **Note:** > Both procedures are performed using the Attached data tool. Find more details in [Add files](add-files.html).

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

8. 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](https://resources.jetbrains.com.cn/help/img/datalore/2026.3/environment.svg)Environment tool.

