Module to enable usage of
pip install in Omniverse Kit environment. It wraps
pip install calls and reroutes package installation into
user specified environment folder.
It also extends Kit Extension System by enabling extensions to depend on python packages and providing pip archive folders for offline pip install (prebundling).
All extensions that loaded after omni.kit.pipapi can specify those additional configuration settings in their extension.toml file:
[python.pipapi] # List of additional directories with pip achives to be passed into pip using ``--find-links`` arg. # Relative paths are relative to extension root. Tokens can be used. archiveDirs = ["path/to/pip_archive"] # Commands passed to pip install before extension gets enabled. Can also contain flags, like `--upgrade`, `--no--index`, etc. # Refer to: https://pip.pypa.io/en/stable/reference/pip_install/#requirements-file-format requirements = [ "simplejson=6.1", "numpy" ] # Allow going to online index if package can't be found locally (not recommended) use_online_index = false # Use this to specify a list of additional repositories if your pip package is hosted somewhere other # than the default repo(s) configured in pip. Will pass these to pip with "--extra-index-url" argument repositories = ["https://my.additional.pip_repo.com/"]
That means that extensions can either:
Depend on other pip packages
Bring wheels (bundle) pip packages for others to use.
add_archive_directory(path: str, root: Optional[str] = None)¶
Add pip additional dirs/links (for pip install –find-links).
install(package: str, module: Optional[str] = None, ignore_import_check: bool = False, ignore_cache: bool = False, version: Optional[str] = None, use_online_index: bool = True, surpress_output: bool = False, extra_args: Optional[List[str]] = None) → bool¶
Install pacakage using pip into user specified env path. Install calls for particular package name persistently cache to avoid overhead for future calls when package is already installed. Cache is stored in the .install_cache.json file in the user specified env path folder.
package (str) – Package name to install. It is basically a command to pip install, it can include version and other flags.
module (str) – Module name to import, by default module assumed to be equal to package.
ignore_import_check (bool, optional) – If
Trueignore attempt to import module and call to
pipanyway - can be slow.
ignore_cache (bool, optional) – If
Trueignore caching and call to
pipanyway - can be slow.
version (str, optional) – Package version.
use_online_index (bool, optional) – If
Trueand package can’t be found in any of archive directories try to use default pip index.
surpress_output (bool, optional) – If
Truepip process output to stdout and stderr will be surpressed, as well as warning when install failed.
extra_args (List[str], optional) – a list of extra arguments to pass to the Pip process
Trueif installation was successfull.