Skip to content

Makes Newton path truly kitless - #4849

Merged
kellyguo11 merged 6 commits into
isaac-sim:developfrom
kellyguo11:kitless-newton
Mar 6, 2026
Merged

kellyguo11 merged 6 commits into
isaac-sim:developfrom
kellyguo11:kitless-newton

Conversation

@kellyguo11

Copy link
Copy Markdown
Contributor

Description

We still had an isaac sim import in the code that was forcing isaac sim to be installed even when not requiring to launch isaac sim. This fix ensures that in a kitless path, we can fully remove the isaac sim dependency and run in environments that do not have isaac sim installed.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • I have read and understood the contribution guidelines
  • I have run the pre-commit checks with ./isaaclab.sh --format
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the changelog and the corresponding version in the extension's config/extension.toml file
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

@github-actions github-actions Bot added the isaac-lab Related to Isaac Lab team label Mar 6, 2026
@greptile-apps

greptile-apps Bot commented Mar 6, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes a kitless execution path by removing three Isaac Sim / Omniverse Kit top-level imports that were loaded unconditionally at module import time, even when the simulation never needed to launch Kit.

Key changes:

  • app_launcher.py: from isaacsim import SimulationApp is moved inside the existing contextlib.suppress(ModuleNotFoundError) block so the module can be imported without Isaac Sim present. The -> SimulationApp return-type annotation remains safe because from __future__ import annotations (PEP 563) stores all annotations as strings, deferring evaluation.
  • viewport_camera_controller.py: import omni.kit.app is converted to a lazy import inside __init__, preventing a top-level import failure when the module is loaded in a Kit-free environment.
  • sim_launcher.py: An early-exit guard using importlib.util.find_spec("isaacsim") is added before AppLauncher is instantiated. This produces a helpful, human-readable error and exits cleanly (SystemExit(1)) if a Kit-requiring config is requested but Isaac Sim is not installed.

Confidence Score: 4/5

  • Safe to merge — fixes a real import-time regression in the kitless path with no breaking changes to Kit-based workflows.
  • All three changes are targeted and minimal. The contextlib.suppress move is correct and the from __future__ import annotations guard ensures the unresolved SimulationApp name in the type annotation is never evaluated at class-definition time. The lazy import in viewport_camera_controller.py is straightforward. The new find_spec guard in sim_launcher.py is a good defensive check. Minor style point: the guard uses print instead of the module-level logger, and if AppLauncher is used directly without going through sim_launcher.py in a no-isaacsim environment, the resulting NameError is less actionable than a structured message.
  • No files require special attention; pay light attention to the SimulationApp undefined-name edge case in app_launcher.py.

Important Files Changed

Filename Overview
source/isaaclab/isaaclab/app/app_launcher.py Moves from isaacsim import SimulationApp inside the contextlib.suppress(ModuleNotFoundError) block so the module no longer fails to import in kitless environments. The annotation -> SimulationApp is safe due to from __future__ import annotations (PEP 563). The only edge case is a NameError if AppLauncher is used directly without Isaac Sim, but this is guarded in sim_launcher.py.
source/isaaclab/isaaclab/envs/ui/viewport_camera_controller.py Moves import omni.kit.app from module-level to a lazy import inside __init__, preventing an import error when the module is loaded in a kitless environment. Clean and correct fix.
source/isaaclab_tasks/isaaclab_tasks/utils/sim_launcher.py Adds an importlib.util.find_spec("isaacsim") guard before launching Kit-based simulation, providing a clear error message and clean exit when Isaac Sim is absent. Minor style issue: uses print instead of the module's logger for the error message.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[launch_simulation called] --> B{needs_kit?}
    B -- No --> C[Kitless / Newton path\nno isaacsim import]
    B -- Yes --> D{importlib.util.find_spec\nisaacsim found?}
    D -- No --> E[print error + SystemExit 1]
    D -- Yes --> F[from isaaclab.app import AppLauncher\nAppLauncher created]
    F --> G[AppLauncher.__init__\n→ _create_app\n→ SimulationApp loaded from isaacsim]
    G --> H[yield — user code runs]
    C --> H
    H --> I[finally: close_fn if Kit was launched]
Loading

Comments Outside Diff (1)

  1. source/isaaclab/isaaclab/app/app_launcher.py, line 835-870 (link)

    SimulationApp may be undefined when AppLauncher is used without sim_launcher.py guard

    With this change, SimulationApp is only bound in the module namespace when isaacsim is importable. If a caller bypasses sim_launcher.py and instantiates AppLauncher directly in an environment without Isaac Sim, _create_app() will raise a cryptic NameError: name 'SimulationApp' is not defined at line 870 rather than a helpful diagnostic message.

    The guard in sim_launcher.py prevents this in the standard code path, but AppLauncher is a public class and direct use is documented. Consider adding an explicit guard inside _create_app() (or __init__) to give a clear error when SimulationApp is not available:

    def _create_app(self):
        if "SimulationApp" not in globals():
            raise RuntimeError(
                "Isaac Sim is not installed. Cannot create AppLauncher without Isaac Sim."
            )
        ...

    This makes the failure mode self-explanatory regardless of how AppLauncher is invoked.

Last reviewed commit: 4b2d6c5

Comment on lines +162 to +171
print(
"\n[ERROR] Isaac Sim is not installed or not found on PYTHONPATH.\n"
"\n"
" This environment requires Isaac Sim and Omniverse Kit.\n"
" PhysX backend and Kit visualizer currently requires Isaac Sim.\n"
"\n"
" To fix this, ensure Isaac Sim is installed and available in the current environment.\n"
"\n"
" See https://isaac-sim.github.io/IsaacLab/main/source/setup/installation for details.\n"
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use logger.error instead of print for error reporting

The file already has a logger = logging.getLogger(__name__) instance defined at module level (line 20), and uses logger.info elsewhere (e.g., lines 148 and 153). Using a bare print() here for the error message is inconsistent with the established logging pattern and bypasses any log-level controls the caller may have configured.

Suggested change
print(
"\n[ERROR] Isaac Sim is not installed or not found on PYTHONPATH.\n"
"\n"
" This environment requires Isaac Sim and Omniverse Kit.\n"
" PhysX backend and Kit visualizer currently requires Isaac Sim.\n"
"\n"
" To fix this, ensure Isaac Sim is installed and available in the current environment.\n"
"\n"
" See https://isaac-sim.github.io/IsaacLab/main/source/setup/installation for details.\n"
)
if importlib.util.find_spec("isaacsim") is None:
logger.error(
"\n[ERROR] Isaac Sim is not installed or not found on PYTHONPATH.\n"
"\n"
" This environment requires Isaac Sim and Omniverse Kit.\n"
" PhysX backend and Kit visualizer currently requires Isaac Sim.\n"
"\n"
" To fix this, ensure Isaac Sim is installed and available in the current environment.\n"
"\n"
" See https://isaac-sim.github.io/IsaacLab/main/source/setup/installation for details.\n"
)

@kellyguo11
kellyguo11 merged commit f42eccb into isaac-sim:develop Mar 6, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants