cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

How to restart the kernel on my notebook in databricks?

Paddy_chu
New Contributor

while installing a python package on my databricks notebook, I kept getting a message saying that: "Note: you may need to restart the kernel using dbutils.library.restartPython() to use updated packages."

I've tried restarting my cluster, also detach and reattach my cluster but the Note message still pops up on my notebook, after I ran my code.

Anyone knows how to solve this issue?error message

3 REPLIES 3

Evan_MCK
Contributor

dbutils.library.restartPython()

Just run this code in the notebook without restarting the cluster or using pip install again. Restarting the cluster erased what you just installed with pip and you are back to square one. Restarting python after the pip installs will leave the packages installed and just restart the python interpreter.

see this: https://stackoverflow.com/a/75333780/22103209

johnb1
Contributor

@Evan_MCK 

Follow-up question:

When other notebooks run Python code on the same cluster, will those runs be aborted when dbutils.library.restartPython() is called?

Imalkov
New Contributor III

no, it's related only to current spark session

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