cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Warehousing & Analytics
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
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.

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.