Packages

Using and installing Python packages.

Default Packages

Many libraries are included by default, here are some examples:

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

import pandas as pd
import numpy as np 
import scipy

Micropiparrow-up-right can be used to install additional Python packages that aren't automatically supported (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()
fake.name()

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 Pyodidearrow-up-right.

Last updated

Was this helpful?