-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[NEWTON]Enables omni-client be installed with packman #4141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
kellyguo11
merged 4 commits into
isaac-sim:dev/newton
from
ooctipus:feature/newton/omni-client-packman
Dec 5, 2025
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,128 @@ | ||
| #!/usr/bin/env python3 | ||
| # Copyright (c) 2022-2025, The Isaac Lab Project Developers (https://github.com/isaac-sim/IsaacLab/blob/main/CONTRIBUTORS.md). | ||
| # All rights reserved. | ||
| # | ||
| # SPDX-License-Identifier: BSD-3-Clause | ||
|
|
||
| """ | ||
| Install omni.client from a prebuilt 7z payload into the current Python environment. | ||
|
|
||
| - Downloads https://d4i3qtqj3r0z5.cloudfront.net/omni_client_library.linux-x86_64@<version>.7z | ||
| - Extracts to a cache dir (default: $TMPDIR/omni_client_cache; override with OMNI_CLIENT_CACHE) | ||
| - Copies the Python package (release/bindings-python) and native libs (release/*.so) into site-packages/_omni_client | ||
| - Drops a .pth for import visibility | ||
| - Creates a minimal dist-info so `pip uninstall omni-client-offline` works | ||
|
|
||
| # TODO: Once pip has been shipped, remove this script and use pip install omniverseclient==<version> instead. | ||
| """ | ||
|
|
||
| import logging | ||
| import os | ||
| import pathlib | ||
| import shutil | ||
| import site | ||
| import subprocess | ||
| import sys | ||
| import tempfile | ||
| import urllib.request | ||
|
|
||
| # Ensure py7zr is available | ||
| try: | ||
| import py7zr # type: ignore # noqa: F401 | ||
| except ImportError: | ||
| subprocess.check_call([sys.executable, "-m", "pip", "install", "py7zr"]) | ||
| import py7zr # type: ignore | ||
|
|
||
|
|
||
| logger = logging.getLogger(__name__) | ||
|
|
||
| # Configuration | ||
| pkg_ver = os.environ.get("OMNI_CLIENT_VERSION", "2.68.1") | ||
| cache_root = pathlib.Path(os.environ.get("OMNI_CLIENT_CACHE", tempfile.gettempdir())) / "omni_client_cache" | ||
| payload_url = f"https://d4i3qtqj3r0z5.cloudfront.net/omni_client_library.linux-x86_64%40{pkg_ver}.7z" | ||
ooctipus marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| # Paths | ||
| cache_root.mkdir(parents=True, exist_ok=True) | ||
| payload = cache_root / f"omni_client.{pkg_ver}.7z" | ||
| extract_root = cache_root / f"omni_client.{pkg_ver}.extracted" | ||
|
|
||
| # Download payload if missing | ||
| if not payload.exists(): | ||
| logger.info(f" Downloading omni.client payload from {payload_url} ...") | ||
| urllib.request.urlretrieve(payload_url, payload) | ||
|
|
||
| # Extract payload only if not already present | ||
| extract_root.mkdir(parents=True, exist_ok=True) | ||
| already_extracted = (extract_root / "release" / "bindings-python" / "omni" / "client").exists() | ||
| if not already_extracted: | ||
| logger.info(f" Extracting omni.client payload into {extract_root} ...") | ||
| with py7zr.SevenZipFile(payload, mode="r") as z: | ||
| z.extractall(path=extract_root) | ||
| else: | ||
| logger.info(f" Reusing existing extraction at {extract_root}") | ||
|
|
||
| # Locate python package and native libs | ||
| src_py = extract_root / "release" / "bindings-python" | ||
| if not (src_py / "omni" / "client").exists(): | ||
| raise RuntimeError(f"Could not locate omni.client python package at {src_py}") | ||
|
|
||
| src_lib = extract_root / "release" | ||
| if not any(src_lib.glob("libomni*.so*")): | ||
| raise RuntimeError(f"Could not locate native libs under {src_lib}") | ||
|
|
||
| # Install into site-packages | ||
| if hasattr(site, "getsitepackages"): | ||
| candidates = [pathlib.Path(p) for p in site.getsitepackages() if p.startswith(sys.prefix)] | ||
| site_pkgs = candidates[0] if candidates else pathlib.Path(site.getusersitepackages()) | ||
| else: | ||
| site_pkgs = pathlib.Path(site.getusersitepackages()) | ||
| dest = site_pkgs / "_omni_client" | ||
| dest.mkdir(parents=True, exist_ok=True) | ||
| shutil.copytree(src_py, dest, dirs_exist_ok=True) | ||
| shutil.copytree(src_lib, dest / "lib", dirs_exist_ok=True) | ||
|
|
||
| # Ensure the extension can find its libs without env vars | ||
| client_dir = dest / "omni" / "client" | ||
| client_dir.mkdir(parents=True, exist_ok=True) | ||
| for libfile in (dest / "lib").glob("libomni*.so*"): | ||
| target = client_dir / libfile.name | ||
| if not target.exists(): | ||
| try: | ||
| target.symlink_to(libfile) | ||
| except Exception: | ||
| shutil.copy2(libfile, target) | ||
|
|
||
| # Add .pth for import visibility | ||
| with open(site_pkgs / "omni_client.pth", "w", encoding="utf-8") as f: | ||
| f.write(str(dest) + "\n") | ||
| f.write(str(dest / "lib") + "\n") | ||
|
|
||
| # Minimal dist-info so pip can uninstall (pip uninstall omni-client) | ||
| dist_name = "omni-client" | ||
| dist_info = site_pkgs / f"{dist_name.replace('-', '_')}-{pkg_ver}.dist-info" | ||
| dist_info.mkdir(parents=True, exist_ok=True) | ||
| (dist_info / "INSTALLER").write_text("manual\n", encoding="utf-8") | ||
| metadata = "\n".join([ | ||
| f"Name: {dist_name}", | ||
| f"Version: {pkg_ver}", | ||
| "Summary: Offline omni.client bundle", | ||
| "", | ||
| ]) | ||
| (dist_info / "METADATA").write_text(metadata, encoding="utf-8") | ||
|
|
||
| records = [] | ||
| for path in [ | ||
| site_pkgs / "omni_client.pth", | ||
| dist_info / "INSTALLER", | ||
| dist_info / "METADATA", | ||
| ]: | ||
| records.append(f"{path.relative_to(site_pkgs)},,") | ||
| for path in dest.rglob("*"): | ||
| records.append(f"{path.relative_to(site_pkgs)},,") | ||
| for path in dist_info.rglob("*"): | ||
| if path.name != "RECORD": | ||
| records.append(f"{path.relative_to(site_pkgs)},,") | ||
| (dist_info / "RECORD").write_text("\n".join(records), encoding="utf-8") | ||
|
|
||
| logger.info(f"Installed omni.client to {dest} (dist: {dist_info.name})") | ||
| logger.info("Uninstall with: pip uninstall omni-client") | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.