Can't import any python package from pip-installed IsaacSim

Isaac Sim Version

4.5.0
4.2.0
4.1.0
4.0.0
4.5.0
2023.1.1
2023.1.0-hotfix.1
Other (please specify):

Operating System

Ubuntu 22.04
Ubuntu 20.04
Windows 11
Windows 10
Other (please specify): Ubuntu 24.04

Topic Description

Installing IsaacSim via pip and starting a SimulationApp works perfectly fine. However, none of the other IsaacSim packages installed can be imported / used.

Detailed Description

After successfull installation, the next thing I wanted to try was going through the standalone python intro. However, as soon as I try to import any isaac sim package beyond isaacsim itself, I get a ModuleNotFoundError.

Steps to Reproduce

  1. pip install isaacsim[all]==4.5.0 --extra-index-url https://pypi.nvidia.com
  2. In python, execute, for example:
import isaacsim  # all good
import isaacsim.examples  # breaks
import isaacsim.core  # also breaks

The isaacsim installation itself seems to be successful. I can run:

import isaacsim
from isaacsim import SimulationApp

SimulationApp()  # After accepting the EULA, I get the startup log of the SimulationApp

Error Messages

For example:

>>> import isaacsim.core
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'isaacsim.core'

A deeper dive

I’ve been looking into the code that’s executed when importing isaacsim and found the following snippets (from isaacsim.__init__.py:

    paths += [
        os.path.join(isaacsim_path, "exts", "isaacsim.simulation_app"),
        os.path.join(isaacsim_path, "extsDeprecated", "omni.isaac.kit"),
    ]
    # update sys.path
    for path in paths:
        if not path in sys.path:
            if not os.path.exists(path):
                print(f"PYTHONPATH: path doesn't exist ({path})")
                continue
            sys.path.insert(0, path)

and

      try:
          # get isaacsim/simulation_app folder path
          isaacsim_path = os.path.dirname(os.path.abspath(os.path.realpath(__file__)))
          path = glob.glob(
              os.path.join(
                  os.environ.get("ISAAC_PATH", isaacsim_path), "exts*", "isaacsim.simulation_app*", "isaacsim"
              )
          )[0]
          if os.path.exists(path):
              # register path
              sys.path.insert(0, path)
              # import API
              from simulation_app import AppFramework, SimulationApp

              # register module to support 'from isaacsim.simulation_app import SimulationApp'
              sys.modules["isaacsim.simulation_app"] = type(sys)("isaacsim.simulation_app")
              sys.modules["isaacsim.simulation_app.SimulationApp"] = SimulationApp
              sys.modules["isaacsim.simulation_app.AppFramework"] = AppFramework
          else:
              print(f"PYTHONPATH: path doesn't exist ({path})")

so it seems, that for the simulation_app only, it is ensured that it is actually in the pythonpath and registered as a module. However, this is not happening for any over exts in isaac – so apparently, there is a known issue with importing the simulation app. So I tried the following:

import isaacsim
import traceback

try:
    import isaacsim.core.api
except ModuleNotFoundError as e:
    print('Unable to import isaacsim.core.api')
    print(e)
    print(traceback.format_exc())

import os
import sys
path = "/home/chicken/anaconda3/envs/isaac/lib/python3.10/site-packages/isaacsim/exts/isaacsim.core.api"
sys.path.insert(0, path)
sys.path.insert(0, path + '/isaacsim')
try:
    from core import api
except ModuleNotFoundError as e:
    print("Failed with the following error")
    print(e)
    print(traceback.format_exc())

As expected, the first import of isaacsim.core.api fails completely. However, when manually adding the path to the source code, it fails with a different traceback, because core.api can now be found, but is still not registered properly. Here’s the print statements of the above program:

Unable to import isaacsim.core.api
No module named 'isaacsim.core'
Traceback (most recent call last):
  File "/home/chicken/Code/IsaacSims/mcfly/debug.py", line 5, in <module>
    import isaacsim.core.api
ModuleNotFoundError: No module named 'isaacsim.core'

Failed with the following error
No module named 'isaacsim.core'
Traceback (most recent call last):
  File "/home/chicken/Code/IsaacSims/mcfly/debug.py", line 17, in <module>
    from core import api
  File "/home/chicken/anaconda3/envs/isaac/lib/python3.10/site-packages/isaacsim/exts/isaacsim.core.api/isaacsim/core/api/__init__.py", line 11, in <module>
    from isaacsim.core.api.physics_context.physics_context import PhysicsContext
ModuleNotFoundError: No module named 'isaacsim.core'

My assumption: The naming convention of the extensions clashes with Python naming conventions. However, it seems to be a bug that could be fixed either by renaming the extensions, or by extending the isaacsim __init__ function to check not only if the SimulationApp can be imported, but any of the packages.

Additional Information

The packages were successfully installed, which shows in pip list:

pip list | grep isaac                                                           
isaacsim                   4.5.0.0
isaacsim-app               4.5.0.0
isaacsim-asset             4.5.0.0
isaacsim-benchmark         4.5.0.0
isaacsim-code-editor       4.5.0.0
isaacsim-core              4.5.0.0
isaacsim-cortex            4.5.0.0
isaacsim-example           4.5.0.0
isaacsim-extscache-kit     4.5.0.0
isaacsim-extscache-kit-sdk 4.5.0.0
isaacsim-extscache-physics 4.5.0.0
isaacsim-gui               4.5.0.0
isaacsim-kernel            4.5.0.0
isaacsim-replicator        4.5.0.0
isaacsim-rl                4.5.0.0
isaacsim-robot             4.5.0.0
isaacsim-robot-motion      4.5.0.0
isaacsim-robot-setup       4.5.0.0
isaacsim-ros1              4.5.0.0
isaacsim-ros2              4.5.0.0
isaacsim-sensor            4.5.0.0
isaacsim-storage           4.5.0.0
isaacsim-template          4.5.0.0
isaacsim-test              4.5.0.0
isaacsim-utils             4.5.0.0

They seem to be where they are supposed to be:

(isaac) ➜  ~ pip show isaacsim
Name: isaacsim
Version: 4.5.0.0
Summary: A metapackage to manage the Isaac Sim installation
Home-page: 
Author: Isaac Sim team
Author-email: 
License: NVIDIA Proprietary Software
Location: /home/.../anaconda3/envs/isaac/lib/python3.10/site-packages
Requires: isaacsim-kernel
Required-by: 
(isaac) ➜  ~ pip show isaacsim-example
Name: isaacsim-example
Version: 4.5.0.0
Summary: Isaac Sim examples
Home-page: 
Author: Isaac Sim team
Author-email: 
License: NVIDIA Proprietary Software
Location: /home/.../anaconda3/envs/isaac/lib/python3.10/site-packages
Requires: isaacsim-cortex
Required-by: 

Edit

Just out of curiosity, I tried the same using the python runtime shipped with isaacsim – still, I got an import error:

>>> ./python.sh -c 'import isaacsim.core.api'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'isaacsim.core'