Load 3rd party packages from other extension

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):

Topic Description

I want to use CuRobo in a custom user extension. The library has dependencies on some 3rd party libraries. These dependencies are shipped with three IsaacSim extensions, which is why CuRobo standalone applications (see code snippet below) need this:

  ext_list = [
      "omni.kit.asset_converter",
      "omni.kit.tool.asset_importer",
      "omni.isaac.asset_browser",
  ]
  if headless_mode:
      logging.warning("Running in headless mode: " + headless_mode)
      ext_list += ["omni.kit.livestream." + headless_mode]
  [enable_extension(x) for x in ext_list]
  sim.update()

This works fine in standalone apps, but it doesn’t in user extensions.

Detailed Description

Importing anything from curobo fails with ModuleNotFoundError when done in a custom user extension. For example:

from curobo.util.usd_helper import UsdHelper
>>> ModuleNotFoundError: No module named 'setuptools_scm'

(There has been a similar issue reported here. However, for my use case, just removing the dependency on setuptools_scm doesn’t help because it is not the only module that is not found)

Additional Information

What I’ve Tried

  • I checked the extension window: The three extensions that I need are enabled
  • If I disable the extensions, they are being reloaded if I run the above snippet within my extension. Still, I can’t import the 3rd party libraries
  • I have added the extensions as dependencies in my extension.toml
  • I don’t have a SimulationApp object in my extension. However, omni.kit.app.get_app().update() should have the same effect as sim.update(). Still doesn’t help.
  • If I start a python shell via the provided python.sh, I can import the missing 3rd party libraries. I can also confirm that they are loaded from the extension, e.g.
import setuptools_scm
setuptools_scm.__file__
>>> '.../isaacsim/exts/isaacsim.asset.exporter.urdf/pip_prebundle/setuptools_scm/__init__.py'

Hotfix

I can manually adapt the PYTHONPATH by including sys.path.append('.../isaacsim/exts/isaacsim.asset.exporter.urdf/pip_prebundle') before importing anythinf from CuRobo. This seems to work for now, but feels like a dirty fix – there must be a better option?

Question

How can I load 3rd party libraries that are bundled with builtin extensions in my own extension?

Additional Context

I know that CuRobo does not yet support Isaacsim 4.5 - however, I believe this is not a version-specific problem. I patched my local CuRobo build and it works just fine in standalone applications in isaacsim 4.5.

It sounds like you’re encountering a common issue with managing Python dependencies in Isaac Sim extensions. The recommended approach is to use a pip_prebundle extension, as described in the Using Python Pip Packages tutorial in the Kit App Template.