cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Warehousing & Analytics
Engage in discussions on data warehousing, analytics, and BI solutions within the Databricks Community. Share insights, tips, and best practices for leveraging data for informed decision-making.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Automatically importing packages in notebooks

Kaz
New Contributor II

Within our team, there are certain (custom) python packages we always use and import in the same way. When starting a new notebook or analysis, we have to import these packages every time. Is it possible to automatically make these imports available for all notebooks on a cluster?

4 REPLIES 4

-werners-
Esteemed Contributor III

is it an option to put the imports in a separate notebook and call that notebook using %run?

Kaz
New Contributor II

Definitely already an improvement! But it would be even better if we don't have to type the %run in each notebook.

-werners-
Esteemed Contributor III

I don't see how that is possible as the imports are part of the program.  Somewhere you will have to type them.
Even if it were possible, I would advise against it.  Imports should be stated explicitly and be traceable in case something does not work as expected f.e.

Tharun-Kumar
Honored Contributor II

@Kaz 

You can install these libraries using the Libraries section in the Compute. 

TharunKumar_0-1696567166528.png

All of the libraries mentioned here would be installed whenever the cluster is spun up.

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโ€™t want to miss the chance to attend and share knowledge.

If there isnโ€™t a group near you, start one and help create a community that brings people together.

Request a New Group