Micropip API#

micropip.freeze() str#

Produce a json string which can be used as the contents of the repodata.json lock file.

If you later load Pyodide with this lock file, you can use pyodide.loadPackage to load packages that were loaded with micropip this time. Loading packages with pyodide.loadPackage is much faster and you will always get consistent versions of all your dependencies.

You can use your custom lock file by passing an appropriate url to the lockFileURL argument to loadPyodide.

async micropip.install(requirements: str | list[str], keep_going: bool = False, deps: bool = True, credentials: Optional[str] = None, pre: bool = False) None#

Install the given package and all of its dependencies.

See loading packages for more information.

If a package is not found in the Pyodide repository it will be loaded from PyPI. Micropip can only load pure Python wheels or wasm32/emscripten wheels built by Pyodide.

When used in web browsers, downloads from PyPI will be cached. When run in Node.js, packages are currently not cached, and will be re-downloaded each time micropip.install is run.


requirements (str | List[str]) –

A requirement or list of requirements to install. Each requirement is a string, which should be either a package name or a wheel URI:

  • If the requirement does not end in .whl, it will be interpreted as a package name. A package with this name must either be present in the Pyodide lock file or on PyPI.

  • If the requirement ends in .whl, it is a wheel URI. The part of the requirement after the last / must be a valid wheel name in compliance with the PEP 427 naming convention.

  • If a wheel URI starts with emfs:, it will be interpreted as a path in the Emscripten file system (Pyodide’s file system). E.g., emfs:../relative/path/wheel.whl or emfs:/absolute/path/wheel.whl. In this case, only .whl files are supported.

  • If a wheel URI requirement starts with http: or https: it will be interpreted as a URL.

  • In node, you can access the native file system using a URI that starts with file:. In the browser this will not work.

keep_going : bool, default: False

This parameter decides the behavior of the micropip when it encounters a Python package without a pure Python wheel while doing dependency resolution:

  • If False, an error will be raised on first package with a missing wheel.

  • If True, the micropip will keep going after the first error, and report a list of errors at the end.

deps : bool, default: True

If True, install dependencies specified in METADATA file for each package. Otherwise do not install dependencies.

credentials : Optional[str]

This parameter specifies the value of credentials when calling the fetch() function which is used to download the package.

When not specified, fetch() is called without credentials.

pre : bool, default: False

If True, include pre-release and development versions. By default, micropip only finds stable versions.


A Future that resolves to None when all packages have been downloaded and installed.

Return type



Get the dictionary of installed packages.


packages – A dictionary of installed packages.

>>> import micropip
>>> await micropip.install('regex') 
>>> package_list = micropip.list()
>>> print(package_list) 
Name              | Version  | Source
----------------- | -------- | -------
regex             | 2021.7.6 | pyodide
>>> "regex" in package_list 

Return type


class package.PackageDict(dict=None, /, **kwargs)#

A dictionary that holds list of metadata on packages. This class is used in micropip to keep the list of installed packages.