
Databricks recommends using %pip for managing notebook-scoped libraries. %conda commands have been deprecated, and will no longer be supported after Databricks Runtime ML 8.4.

To install libraries for all notebooks attached to a cluster, use workspace libraries or cluster libraries. The library utility is supported only on Databricks Runtime, not Databricks Runtime ML. On Databricks Runtime 10.5 and below, you can use the Databricks library utility. This article describes how to use these magic commands. Databricks recommends using this approach for new workloads. Run the %pip magic command in a notebook.

There are two methods for installing notebook-scoped libraries: You must reinstall notebook-scoped libraries at the beginning of each session, or whenever the notebook is detached from a cluster. Notebook-scoped libraries do not persist across sessions. Other notebooks attached to the same cluster are not affected. When you install a notebook-scoped library, only the current notebook and any jobs associated with that notebook have access to that library.

Notebook-scoped libraries let you create, modify, save, reuse, and share custom Python environments that are specific to a notebook.
