mgonzs13 / yolo_ros

Ultralytics YOLOv8, YOLOv9, YOLOv10, YOLOv11 for ROS 2
GNU General Public License v3.0
336 stars 89 forks source link

ModuleNotFoundError: No module named 'ultralytics.tracker' #1

Closed hcdiekmann closed 1 year ago

hcdiekmann commented 1 year ago

Launching with

ros2 launch yolov8_bringup yolov8.launch.py 

gives me an import error:

[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [yolov8_node-1]: process started with pid [24716]
[yolov8_node-1] Traceback (most recent call last):
[yolov8_node-1]   File "/home/aaeon/interbotix_ws/install/yolov8_ros/lib/yolov8_ros/yolov8_node", line 11, in <module>
[yolov8_node-1]     load_entry_point('yolov8-ros==0.0.0', 'console_scripts', 'yolov8_node')()
[yolov8_node-1]   File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 490, in load_entry_point
[yolov8_node-1]     return get_distribution(dist).load_entry_point(group, name)
[yolov8_node-1]   File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2854, in load_entry_point
[yolov8_node-1]     return ep.load()
[yolov8_node-1]   File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2445, in load
[yolov8_node-1]     return self.resolve()
[yolov8_node-1]   File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2451, in resolve
[yolov8_node-1]     module = __import__(self.module_name, fromlist=['__name__'], level=0)
[yolov8_node-1]   File "/home/aaeon/interbotix_ws/install/yolov8_ros/lib/python3.8/site-packages/yolov8_ros/yolov8_node.py", line 13, in <module>
[yolov8_node-1]     from ultralytics.tracker.trackers.basetrack import BaseTrack
[yolov8_node-1] ModuleNotFoundError: No module named 'ultralytics.tracker'
[ERROR] [yolov8_node-1]: process has died [pid 24716, exit code 1, cmd '/home/aaeon/interbotix_ws/install/yolov8_ros/lib/yolov8_ros/yolov8_node --ros-args -r __node:=yolov8_node -r __ns:=/yolo --params-file /tmp/launch_params_mijvcv3d -r image_raw:=/camera/rgb/image_raw'].

Any help would be appreciated.

mgonzs13 commented 1 year ago

Hi @hcdiekmann, which version of ultralytics are you using? The last version, 8.0.58, should work.

hcdiekmann commented 1 year ago

Yes indeed, I had an old version of ultralytics installed. Updating to the latest version resolves the initial error. However now I am getting the following RunTime error:

[yolov8_node-1] Traceback (most recent call last):
[yolov8_node-1]   File "/home/hcdiekmann/ros2_ws/install/yolov8_ros/lib/yolov8_ros/yolov8_node", line 33, in <module>
[yolov8_node-1]     sys.exit(load_entry_point('yolov8-ros==0.0.0', 'console_scripts', 'yolov8_node')())
[yolov8_node-1]   File "/home/hcdiekmann/ros2_ws/install/yolov8_ros/lib/python3.10/site-packages/yolov8_ros/yolov8_node.py", line 181, in main
[yolov8_node-1]     node = Yolov8Node()
[yolov8_node-1]   File "/home/hcdiekmann/ros2_ws/install/yolov8_ros/lib/python3.10/site-packages/yolov8_ros/yolov8_node.py", line 55, in __init__
[yolov8_node-1]     self.yolo.to(device)
[yolov8_node-1]   File "/home/hcdiekmann/.local/lib/python3.10/site-packages/ultralytics/yolo/engine/model.py", line 344, in to
[yolov8_node-1]     self.model.to(device)
[yolov8_node-1]   File "/home/hcdiekmann/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1145, in to
[yolov8_node-1]     return self._apply(convert)
[yolov8_node-1]   File "/home/hcdiekmann/.local/lib/python3.10/site-packages/ultralytics/nn/tasks.py", line 146, in _apply
[yolov8_node-1]     self = super()._apply(fn)
[yolov8_node-1]   File "/home/hcdiekmann/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 797, in _apply
[yolov8_node-1]     module._apply(fn)
[yolov8_node-1]   File "/home/hcdiekmann/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 797, in _apply
[yolov8_node-1]     module._apply(fn)
[yolov8_node-1]   File "/home/hcdiekmann/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 797, in _apply
[yolov8_node-1]     module._apply(fn)
[yolov8_node-1]   File "/home/hcdiekmann/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 820, in _apply
[yolov8_node-1]     param_applied = fn(param)
[yolov8_node-1]   File "/home/hcdiekmann/.local/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1143, in convert
[yolov8_node-1]     return t.to(device, dtype if t.is_floating_point() or t.is_complex() else None, non_blocking)
[yolov8_node-1]   File "/home/hcdiekmann/.local/lib/python3.10/site-packages/torch/cuda/__init__.py", line 247, in _lazy_init
[yolov8_node-1]     torch._C._cuda_init()
[yolov8_node-1] RuntimeError: Found no NVIDIA driver on your system. Please check that you have an NVIDIA GPU and installed a driver from http://www.nvidia.com/Download/index.aspx
[ERROR] [yolov8_node-1]: process has died [pid 637, exit code 1, cmd '/home/hcdiekmann/ros2_ws/install/yolov8_ros/lib/yolov8_ros/yolov8_node --ros-args -r __node:=yolov8_node -r __ns:=/yolo --params-file /tmp/launch_params_kilod8m_ -r image_raw:=/camera/rgb/image_raw'].

As far as I remember ultralytics should be able to run on CPU only?

mgonzs13 commented 1 year ago

Launching with ros2 launch yolov8_bringup yolov8.launch.py device:=cpu should use CPU instead of GPU.

hcdiekmann commented 1 year ago

Thank you. This works.