AttributeError: module 'omni' has no attribute 'usd'

Hi everyone,

When I try to execute

import omni
stage = omni.usd.get_context().get_stage()

from here
https://docs.omniverse.nvidia.com/robotics/text/Robotics_PythonAPI.html

I got error:
Traceback (most recent call last):
File “”, line 1, in
AttributeError: module ‘omni’ has no attribute ‘usd’

I initialize python with setup_python_env

Any Ideas?

I think this could be related to your python environment and the error below that you are getting with Isaac SDK on another post.

ImportError: cannot import name ‘PybindMessage’

Was there any warnings or errors when running ./setup_python_env.sh?
Do you have any problems running the Leonardo Preview sample of any other samples on Isaac Sim?

Hi Sheikh_Dawood,
No, there are no warnings during ./setup_python_env.py execution. All samples from Isaac Sim work correctly, also I can run python example from here
https://docs.omniverse.nvidia.com/robotics/text/Robotics_SyntheticData_Samples.html
without any errors.

I would recommend looking at omnikit.py in the helpers folder under the omni_dl_examples folder. If you instantiate an OmniKitHelper object and then import omni it should work.

Same problem:

OS: Ubuntu 22.04
Isaac Sim Ver. 2022.2.1(installed by Omniverse Launcher)
Shell: Bash

run ./python.sh after source setup_python_env.sh, then run import omni in python is OK, but import omni.usd will lead to AttributeError: module 'omni' has no attribute 'usd' problem

Hi @Te77iiiii_Ho - The error message “AttributeError: module ‘omni’ has no attribute ‘usd’” indicates that the ‘omni.usd’ module is not found in your current Python environment. This could be due to several reasons:

  1. The ‘omni.usd’ module is not installed in your Python environment. You can check this by running pip list in your Python environment to see if ‘omni.usd’ is listed.
  2. The ‘omni.usd’ module is not in your Python path. Python uses the PYTHONPATH environment variable to determine where to look for modules to import. You can check your Python path by running echo $PYTHONPATH in your terminal. If the path to the ‘omni.usd’ module is not listed, you can add it by running export PYTHONPATH=$PYTHONPATH:/path/to/omni.usd.
  3. There might be a conflict with another module named ‘omni’ in your Python environment. You can check this by running pip list | grep omni in your Python environment to see if there are any other modules named ‘omni’.

same problem

Hi @lxu322 - In order to help further, please provide the error that you are seeing and log file.