omni.kit.pipapi¶
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).
Extension Config¶
All extensions that loaded after omni.kit.pipapi can specify those additional configuration settings in their extension.toml file:
extension.toml¶
[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/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.
Or both.
API Reference¶
-
omni.kit.pipapi.
add_archive_directory
(path: str, root: Optional[str] = None)¶ Add pip additional dirs/links (for pip install –find-links).
-
omni.kit.pipapi.
install
(package: str, module: str = None, ignore_import_check: bool = False, ignore_cache: bool = False, version: str = None, use_online_index: bool = True, surpress_output: bool = False, extra_args: 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.
- Parameters
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
True
ignore attempt to import module and call topip
anyway - can be slow.ignore_cache (bool, optional) – If
True
ignore caching and call topip
anyway - can be slow.version (str, optional) – Package version.
use_online_index (bool, optional) – If
True
and package can’t be found in any of archive directories try to use default pip index.surpress_output (bool, optional) – If
True
pip 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
- Returns
True
if installation was successfull.
-
omni.kit.pipapi.
profile
(f=None, mask=1, zone_name=None, add_args=True)¶
-
omni.kit.pipapi.
remove_archive_directory
(path: str)¶ Remove pip additional dirs/links.