Using and installing Python packages.

Default Packages

The following libraries are included by default:

Default packages can be imported like any other native Python package.

import pandas as pd
import numpy as np 
import scipy

Micropip can be used to install additional Python packages (and their dependencies).

import micropip

# `await` is necessary to wait until the package is available
await micropip.install("faker")

# Import installed package
from faker import Faker

# Use the package!
fake = Faker()

This only works for packages that are either pure Python or for packages with C extensions that are built in Pyodide. If a pure Python package is not found in the Pyodide repository, it will be loaded from PyPI. Learn more about how packages work in Pyodide.

Last updated