You can programmatically restart the Python process on Databricks to ensure that locally installed or upgraded libraries function correctly in the Python kernel for your current SparkSession.
When you restart the Python process, you lose Python state information. Databricks recommends installing all session-scoped libraries at the beginning of a notebook and running dbutils.library.restartPython()
to clean up the Python process before proceeding.
You can use this process in interactive notebooks or for Python tasks scheduled with jobs.
What isdbutils.library.restartPython
?â
The helper function dbutils.library.restartPython()
is the recommended way to restart the Python process in a Databricks notebook.
note
Most functions in the dbutils.library
submodule are deprecated. Databricks strongly recommends using %pip
to manage all notebook-scoped library installations. See Notebook-scoped Python libraries.
It is a good idea to restart your Python process anytime you perform a local installation that includes any of the following:
%pip install <library-name> --upgrade
.requirements.txt
file.RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4