No module named 'carb' when running python script

Isaac Sim Version

4.5.0

Operating System

Ubuntu 22.04

GPU Information

  • Model: RTX 3070
  • Driver Version: nvidia-driver-550

Topic Description

I’ve installed Isaac Sim and Isaac Lab using based on this tutorial

I’m currently working on this tutorial

When I copy the first code snippet which is the following

import carb
from isaacsim import SimulationApp
import sys

BACKGROUND_STAGE_PATH = "/background"
BACKGROUND_USD_PATH = "/Isaac/Environments/Simple_Warehouse/warehouse_with_forklifts.usd"

CONFIG = {"renderer": "RayTracedLighting", "headless": False}

# Example ROS2 bridge sample demonstrating the manual loading of stages and manual publishing of images
simulation_app = SimulationApp(CONFIG)
import omni
import numpy as np
from isaacsim.core.api import SimulationContext
from isaacsim.core.utils import stage, extensions, nucleus
import omni.graph.core as og
import omni.replicator.core as rep
import omni.syntheticdata._syntheticdata as sd

from isaacsim.core.utils.prims import set_targets
from isaacsim.sensors.camera import Camera
import isaacsim.core.utils.numpy.rotations as rot_utils
from isaacsim.core.utils.prims import is_prim_path_valid
from isaacsim.core.nodes.scripts.utils import set_target_prims

# Enable ROS2 bridge extension
extensions.enable_extension("isaacsim.ros2.bridge")

simulation_app.update()

simulation_context = SimulationContext(stage_units_in_meters=1.0)

# Locate Isaac Sim assets folder to load environment and robot stages
assets_root_path = nucleus.get_assets_root_path()
if assets_root_path is None:
    carb.log_error("Could not find Isaac Sim assets folder")
    simulation_app.close()
    sys.exit()

# Loading the environment
stage.add_reference_to_stage(assets_root_path + BACKGROUND_USD_PATH, BACKGROUND_STAGE_PATH)


###### Camera helper functions for setting up publishers. ########

# Paste functions from the tutorial here
# def publish_camera_tf(camera: Camera): ...
# def publish_camera_info(camera: Camera, freq): ...
# def publish_pointcloud_from_depth(camera: Camera, freq): ...
# def publish_depth(camera: Camera, freq): ...
# def publish_rgb(camera: Camera, freq): ...

###################################################################

# Create a Camera prim. Note that the Camera class takes the position and orientation in the world axes convention.
camera = Camera(
    prim_path="/World/floating_camera",
    position=np.array([-3.11, -1.87, 1.0]),
    frequency=20,
    resolution=(256, 256),
    orientation=rot_utils.euler_angles_to_quats(np.array([0, 0, 0]), degrees=True),
)
camera.initialize()

simulation_app.update()
camera.initialize()

############### Calling Camera publishing functions ###############

# Call the publishers.
# Make sure you pasted in the helper functions above, and uncomment out the following lines before running.

approx_freq = 30
#publish_camera_tf(camera)
#publish_camera_info(camera, approx_freq)
#publish_rgb(camera, approx_freq)
#publish_depth(camera, approx_freq)
#publish_pointcloud_from_depth(camera, approx_freq)

####################################################################

# Initialize physics
simulation_context.initialize_physics()
simulation_context.play()

while simulation_app.is_running():
    simulation_context.step(render=True)

simulation_context.stop()
simulation_app.close()

and run it as a python script, I get the following error

(env_isaaclab) tingsheng@tingsheng:~/Documents/Softwares/IsaacSim$ python3 publishing_camera_data.py 
Traceback (most recent call last):
  File "/home/tingsheng/Documents/Softwares/IsaacSim/publishing_camera_data.py", line 1, in <module>
    import carb
ModuleNotFoundError: No module named 'carb'

How do I resolve the import issue? Besides, what is the difference between these two installation? I get that the first one include the installation of Isaac Lab, but is there a difference when using the Isaac Sim?

Hi @lee43

Please, try importing the carb module after simulation_app = SimulationApp(CONFIG).

The reason, in Workflow installation, the python.sh script populate the PYTHONPATH with some Isaac Sim / Kit key paths, while in the Isaac Sim - Python package installation, this is done when import isaacsim. So, to make sure it works in both cases, do the import after instantiating SimulationApp.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.