Use additional Python packages#

Installing packages at runtime#

JupyterLite provides an additional piplite layer on top of micropip to install packages from Python notebooks.

New packages can be downloaded and installed at runtime. For example to install snowballstemmer.

%pip install -q snowballstemmer

which translates to:

import piplite
await piplite.install("snowballstemmer")

Note

Some Python packages require a frontend extension to also be installed.

See Adding extensions for more information.

See also how to ship additional wheels at build time.

Bundling additional packages by default#

At the moment the most reasonable way to make additional packages available by default when starting the Python kernel is to add new packages to the Pyodide distribution.

The process is detailed in the Pyodide documentation.

Once you have added the new package(s) and rebuilt Pyodide, you can configure JupyterLite to use a custom Pyodide distribution.