Cant access GPU in isaac ros docker container

Jetson Orin Nano
JP 5.1.2
Isaac ros

Hello I am working in Isaac ros dev container and I am trying to access the gpu; however it is not letting me.

This is where I set the GPT:

device = LaunchConfiguration("device")
device_cmd = DeclareLaunchArgument(
    "device",
    default_value="cuda:0",
    description="Device to use (GPU/CPU)")

I keep getting this error:

[debug_node-5] [INFO] [1715222348.594584401] [yolo.debug_node]: Debug node created
[debug_node-5] [INFO] [1715222348.597204296] [yolo.debug_node]: Configuring debug_node
[yolov8_node-3] [INFO] [1715222348.699881743] [yolo.yolov8_node]: Yolov8Node created
[yolov8_node-3] [INFO] [1715222348.719104354] [yolo.yolov8_node]: Configuring yolov8_node
[debug_node-5] [INFO] [1715222349.129248467] [yolo.debug_node]: Activating debug_node
[yolov8_node-3] [INFO] [1715222349.159166150] [yolo.yolov8_node]: Activating yolov8_node
[tracking_node-4] [INFO] [1715222349.533656877] [yolo.tracking_node]: Configuring tracking_node
[tracking_node-4] [INFO] [1715222349.728183256] [yolo.tracking_node]: Activating tracking_node
[yolov8_node-3] Traceback (most recent call last):
[yolov8_node-3] File “/workspaces/isaac_ros-dev/install/yolov8_ros/lib/yolov8_ros/yolov8_node”, line 33, in
[yolov8_node-3] sys.exit(load_entry_point(‘yolov8-ros’, ‘console_scripts’, ‘yolov8_node’)())
[yolov8_node-3] File “/workspaces/isaac_ros-dev/build/yolov8_ros/yolov8_ros/yolov8_node.py”, line 300, in main
[yolov8_node-3] rclpy.spin(node)
[yolov8_node-3] File “/opt/ros/humble/lib/python3.8/site-packages/rclpy/init.py”, line 222, in spin
[yolov8_node-3] executor.spin_once()
[yolov8_node-3] File “/opt/ros/humble/lib/python3.8/site-packages/rclpy/executors.py”, line 739, in spin_once
[yolov8_node-3] self._spin_once_impl(timeout_sec)
[yolov8_node-3] File “/opt/ros/humble/lib/python3.8/site-packages/rclpy/executors.py”, line 736, in _spin_once_impl
[yolov8_node-3] raise handler.exception()
[yolov8_node-3] File “/opt/ros/humble/lib/python3.8/site-packages/rclpy/task.py”, line 239, in call
[yolov8_node-3] self._handler.send(None)
[yolov8_node-3] File “/opt/ros/humble/lib/python3.8/site-packages/rclpy/executors.py”, line 437, in handler
[yolov8_node-3] await call_coroutine(entity, arg)
[yolov8_node-3] File “/opt/ros/humble/lib/python3.8/site-packages/rclpy/executors.py”, line 362, in _execute_subscription
[yolov8_node-3] await await_or_execute(sub.callback, msg)
[yolov8_node-3] File “/opt/ros/humble/lib/python3.8/site-packages/rclpy/executors.py”, line 107, in await_or_execute
[yolov8_node-3] return callback(*args)
[yolov8_node-3] File “/workspaces/isaac_ros-dev/build/yolov8_ros/yolov8_ros/yolov8_node.py”, line 246, in image_cb
[yolov8_node-3] results = self.yolo.predict(
[yolov8_node-3] File “/home/admin/.local/lib/python3.8/site-packages/ultralytics/engine/model.py”, line 432, in predict
[yolov8_node-3] self.predictor.setup_model(model=self.model, verbose=is_cli)
[yolov8_node-3] File “/home/admin/.local/lib/python3.8/site-packages/ultralytics/engine/predictor.py”, line 299, in setup_model
[yolov8_node-3] device=select_device(self.args.device, verbose=verbose),
[yolov8_node-3] File “/home/admin/.local/lib/python3.8/site-packages/ultralytics/utils/torch_utils.py”, line 127, in select_device
[yolov8_node-3] raise ValueError(
[yolov8_node-3] ValueError: Invalid CUDA ‘device=0’ requested. Use ‘device=cpu’ or pass valid CUDA device(s) if available, i.e. ‘device=0’ or ‘device=0,1,2,3’ for Multi-GPU.
[yolov8_node-3]
[yolov8_node-3] torch.cuda.is_available(): False
[yolov8_node-3] torch.cuda.device_count(): 0
[yolov8_node-3] os.environ[‘CUDA_VISIBLE_DEVICES’]: None
[yolov8_node-3] See Start Locally | PyTorch for up-to-date torch install instructions if no CUDA devices are seen by torch.
[yolov8_node-3]
[ERROR] [yolov8_node-3]: process has died [pid 188247, exit code 1, cmd ‘/workspaces/isaac_ros-dev/install/yolov8_ros/lib/yolov8_ros/yolov8_node --ros-args -r __node:=yolov8_node -r __ns:=/yolo --params-file /tmp/launch_params_niwjeph4 -r image_raw:=/zed/zed_node/rgb_raw/image_raw_color’].
^C[WARNING] [launch]: user interrupted with ctrl-c (SIGINT)
[zed_wrapper-2] [INFO] [1715222599.369360464] [rclcpp]: signal_handler(signum=2)
[robot_state_publisher-1] [INFO] [1715222599.369359504] [rclcpp]: signal_handler(signum=2)
[debug_node-5] Traceback (most recent call last):
[debug_node-5] File “/workspaces/isaac_ros-dev/install/yolov8_ros/lib/yolov8_ros/debug_node”, line 33, in
[debug_node-5] sys.exit(load_entry_point(‘yolov8-ros’, ‘console_scripts’, ‘debug_node’)())
[debug_node-5] File “/workspaces/isaac_ros-dev/build/yolov8_ros/yolov8_ros/debug_node.py”, line 299, in main
[debug_node-5] rclpy.spin(node)
[debug_node-5] File “/opt/ros/humble/lib/python3.8/site-packages/rclpy/init.py”, line 222, in spin
[debug_node-5] executor.spin_once()
[debug_node-5] File “/opt/ros/humble/lib/python3.8/site-packages/rclpy/executors.py”, line 739, in spin_once
[debug_node-5] self._spin_once_impl(timeout_sec)
[debug_node-5] File “/opt/ros/humble/lib/python3.8/site-packages/rclpy/executors.py”, line 728, in _spin_once_impl
[debug_node-5] handler, entity, node = self.wait_for_ready_callbacks(timeout_sec=timeout_sec)
[debug_node-5] File “/opt/ros/humble/lib/python3.8/site-packages/rclpy/executors.py”, line 711, in wait_for_ready_callbacks
[debug_node-5] return next(self._cb_iter)
[debug_node-5] File “/opt/ros/humble/lib/python3.8/site-packages/rclpy/executors.py”, line 608, in _wait_for_ready_callbacks
[debug_node-5] wait_set.wait(timeout_nsec)
[debug_node-5] KeyboardInterrupt
[tracking_node-4] Traceback (most recent call last):
[tracking_node-4] File “/workspaces/isaac_ros-dev/install/yolov8_ros/lib/yolov8_ros/tracking_node”, line 33, in
[tracking_node-4] sys.exit(load_entry_point(‘yolov8-ros’, ‘console_scripts’, ‘tracking_node’)())
[tracking_node-4] File “/workspaces/isaac_ros-dev/build/yolov8_ros/yolov8_ros/tracking_node.py”, line 191, in main
[tracking_node-4] rclpy.spin(node)
[tracking_node-4] File “/opt/ros/humble/lib/python3.8/site-packages/rclpy/init.py”, line 222, in spin
[tracking_node-4] executor.spin_once()
[tracking_node-4] File “/opt/ros/humble/lib/python3.8/site-packages/rclpy/executors.py”, line 739, in spin_once
[tracking_node-4] self._spin_once_impl(timeout_sec)
[tracking_node-4] File “/opt/ros/humble/lib/python3.8/site-packages/rclpy/executors.py”, line 728, in _spin_once_impl
[tracking_node-4] handler, entity, node = self.wait_for_ready_callbacks(timeout_sec=timeout_sec)
[tracking_node-4] File “/opt/ros/humble/lib/python3.8/site-packages/rclpy/executors.py”, line 711, in wait_for_ready_callbacks
[tracking_node-4] return next(self._cb_iter)
[tracking_node-4] File “/opt/ros/humble/lib/python3.8/site-packages/rclpy/executors.py”, line 608, in _wait_for_ready_callbacks
[tracking_node-4] wait_set.wait(timeout_nsec)
[tracking_node-4] KeyboardInterrupt
[INFO] [robot_state_publisher-1]: process has finished cleanly [pid 188243]
[ERROR] [debug_node-5]: process has died [pid 188251, exit code -2, cmd ‘/workspaces/isaac_ros-dev/install/yolov8_ros/lib/yolov8_ros/debug_node --ros-args -r __node:=debug_node -r __ns:=/yolo --params-file /tmp/launch_params_plf3pfua -r image_raw:=/zed/zed_node/rgb_raw/image_raw_color -r detections:=tracking’].
[ERROR] [tracking_node-4]: process has died [pid 188249, exit code -2, cmd ‘/workspaces/isaac_ros-dev/install/yolov8_ros/lib/yolov8_ros/tracking_node --ros-args -r __node:=tracking_node -r __ns:=/yolo --params-file /tmp/launch_params_ntrm1kqv -r image_raw:=/zed/zed_node/rgb_raw/image_raw_color’].
[INFO] [zed_wrapper-2]: process has finished cleanly [pid 188245]

It works when I use CPU but it is very slow.

Also when I try and use nvidia-smi in the container it doesnt work.

Any help would be awesome :))))

Hi @conorspalvieri1

I’m trying to determine which setup you’re using for your test. Please let me know if I’m mistaken, but it doesn’t appear that you’re working with Isaac ROS yolo8. isaac_ros_yolov8 — isaac_ros_docs documentation
I suggest using the Isaac ROS yolo8 package as it is optimized for NVIDIA Jetson.

If you are working with this package: GitHub - mgonzs13/yolov8_ros: Ultralytics YOLOv8 and YOLOv9 for ROS 2
Please look that your bug is coming from this issue:

Let me know if I helped you

Best,
Raffaello

Yeah, thank you for bringing this to my attention, I was trying to use a different YOLO package for 3D object detection. I thought the Isaac ros obj det was only for 2D but now I realize I need to use it to create my own 3D obj det now. Thank you.

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