An error was reported when importing other Python files into Isaac Sim's Helloworld file

134/5000
I am trying to add a new feature to Isaac Sim’s HelloWorld: get a camera image, and want to use YoloV5 to do object detection on the captured image. However, when I added yoloV5 project files to HelloWorld folder, I reported an error when loading yoloV5 related modules in HelloWorld. Is there a solution?



Hi @845004988

You can install any python package by following the step, to install additional packages, described in the Isaac Sim doc: 4. Python Environment Installation — Omniverse Robotics documentation

Also, you can use the omni.kit.pipapi extension to install the required package at run time

try:
    import yolov5
except ImportError:
    omni.kit.pipapi.install("yolov5")
    import yolov5
1 Like

thank you,it really helpful!

Hi. I got a similar problem when tried to import a package named Pinocchio. I followed the instructions in Python Environment Installation: open a terminal directly at the Isaac Sim root folder and use pip to install the package:

./python.sh -m pip install pin

where pin is the package name which is implied by Pinocchio installation instructions (Pinocchio Installation Procedure).

Then I tried to import the pinocchio package (import pinocchio) in the script editor or in the example extension
HelloWorld, and the console gave a no module found error:

2023-11-15 15:35:33  [Error] [omni.ext._impl.custom_importer] Failed to import python module omni.isaac.examples.tests. Error: No module named 'pinocchio'. Traceback:
2023-11-15 15:35:33  [Error] [omni.ext._impl.custom_importer] Traceback (most recent call last):
2023-11-15 15:35:33  [Error] [omni.ext._impl.custom_importer]   File "/home/boxing/.local/share/ov/pkg/isaac_sim-2023.1.0-hotfix.1/kit/kernel/py/omni/ext/_impl/custom_importer.py", line 76, in import_module
2023-11-15 15:35:33  [Error] [omni.ext._impl.custom_importer]     return importlib.import_module(name)
2023-11-15 15:35:33  [Error] [omni.ext._impl.custom_importer]   File "/home/boxing/.local/share/ov/pkg/isaac_sim-2023.1.0-hotfix.1/kit/python/lib/python3.10/importlib/__init__.py", line 126, in import_module
2023-11-15 15:35:33  [Error] [omni.ext._impl.custom_importer]     return _bootstrap._gcd_import(name[level:], package, level)
2023-11-15 15:35:33  [Error] [omni.ext._impl.custom_importer]   File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
2023-11-15 15:35:33  [Error] [omni.ext._impl.custom_importer]   File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
2023-11-15 15:35:33  [Error] [omni.ext._impl.custom_importer]   File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
2023-11-15 15:35:33  [Error] [omni.ext._impl.custom_importer]   File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
2023-11-15 15:35:33  [Error] [omni.ext._impl.custom_importer]   File "<frozen importlib._bootstrap_external>", line 883, in exec_module
2023-11-15 15:35:33  [Error] [omni.ext._impl.custom_importer]   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
2023-11-15 15:35:33  [Error] [omni.ext._impl.custom_importer]   File "/home/boxing/.local/share/ov/pkg/isaac_sim-2023.1.0-hotfix.1/exts/omni.isaac.examples/omni/isaac/examples/tests/__init__.py", line 12, in <module>
2023-11-15 15:35:33  [Error] [omni.ext._impl.custom_importer]     from .test_hello_world import *
2023-11-15 15:35:33  [Error] [omni.ext._impl.custom_importer]   File "/home/boxing/.local/share/ov/pkg/isaac_sim-2023.1.0-hotfix.1/exts/omni.isaac.examples/omni/isaac/examples/tests/test_hello_world.py", line 21, in <module>
2023-11-15 15:35:33  [Error] [omni.ext._impl.custom_importer]     from omni.isaac.examples.hello_world import HelloWorld
2023-11-15 15:35:33  [Error] [omni.ext._impl.custom_importer]   File "/home/boxing/.local/share/ov/pkg/isaac_sim-2023.1.0-hotfix.1/exts/omni.isaac.examples/omni/isaac/examples/hello_world/__init__.py", line 10, in <module>
2023-11-15 15:35:33  [Error] [omni.ext._impl.custom_importer]     from omni.isaac.examples.hello_world.hello_world import HelloWorld
2023-11-15 15:35:33  [Error] [omni.ext._impl.custom_importer]   File "/home/boxing/.local/share/ov/pkg/isaac_sim-2023.1.0-hotfix.1/exts/omni.isaac.examples/omni/isaac/examples/hello_world/hello_world.py", line 11, in <module>
2023-11-15 15:35:33  [Error] [omni.ext._impl.custom_importer]     import pinocchio
2023-11-15 15:35:33  [Error] [omni.ext._impl.custom_importer] ModuleNotFoundError: No module named 'pinocchio'
2023-11-15 15:35:33  [Error] [omni.ext._impl.custom_importer] 
2023-11-15 15:35:33  [Error] [carb.scripting-python.plugin] Exception: Extension python module: 'omni.isaac.examples.tests' in '/home/boxing/.local/share/ov/pkg/isaac_sim-2023.1.0-hotfix.1/exts/omni.isaac.examples' failed to load.
2023-11-15 15:35:33  [Error] [carb.scripting-python.plugin] 
2023-11-15 15:35:33  [Error] [carb.scripting-python.plugin] At:
2023-11-15 15:35:33  [Error] [carb.scripting-python.plugin]   /home/boxing/.local/share/ov/pkg/isaac_sim-2023.1.0-hotfix.1/kit/kernel/py/omni/ext/_impl/_internal.py(213): startup
2023-11-15 15:35:33  [Error] [carb.scripting-python.plugin]   /home/boxing/.local/share/ov/pkg/isaac_sim-2023.1.0-hotfix.1/kit/kernel/py/omni/ext/_impl/_internal.py(328): startup_extension
2023-11-15 15:35:33  [Error] [carb.scripting-python.plugin]   PythonExtension.cpp::startup()(2): <module>
2023-11-15 15:35:33  [Error] [carb.scripting-python.plugin] 
2023-11-15 15:35:33  [Error] [omni.ext.plugin] [ext: omni.isaac.examples-1.7.8] Failed to startup python extension.

Any suggestions please?

Please follow this document which gives info about python environment Python Environment — Omniverse IsaacSim latest documentation

In Isaac Sim, you can follow this document if you want to use omni.anim extension.
https://docs.omniverse.nvidia.com/isaacsim/latest/features/warehouse_logistics/ext_omni_anim_people.html