Numpy Error on Yolov8

yolo detect predict model=yolov8n.engine source=‘’ device =0
Ultralytics YOLOv8.1.5 🚀 Python-3.8.10 torch-2.1.0a0+41361538.nv23.06 CUDA:0 (Orin, 6481MiB)
Loading yolov8n.engine for TensorRT inference…
[01/24/2024-13:57:17] [TRT] [I] Loaded engine size: 13 MiB
[01/24/2024-13:57:31] [TRT] [I] [MemUsageChange] Init cuDNN: CPU +617, GPU +377, now: CPU 1009, GPU 4625 (MiB)
[01/24/2024-13:57:31] [TRT] [I] [MemUsageChange] TensorRT-managed allocation in engine deserialization: CPU +0, GPU +13, now: CPU 0, GPU 13 (MiB)
[01/24/2024-13:57:31] [TRT] [I] [MemUsageChange] Init cuDNN: CPU +0, GPU +23, now: CPU 996, GPU 4637 (MiB)
[01/24/2024-13:57:33] [TRT] [I] [MemUsageChange] TensorRT-managed allocation in IExecutionContext creation: CPU +0, GPU +19, now: CPU 0, GPU 32 (MiB)
/usr/lib/python3.8/dist-packages/tensorrt/ FutureWarning: In the future np.bool will be defined as the corresponding NumPy scalar.
bool: np.bool,
Traceback (most recent call last):
File “/home/sai/.local/bin/yolo”, line 8, in
File “/home/sai/.local/lib/python3.8/site-packages/ultralytics/cfg/”, line 567, in entrypoint
getattr(model, mode)(**overrides) # default args from model
File “/home/sai/.local/lib/python3.8/site-packages/ultralytics/engine/”, line 268, in predict
self.predictor.setup_model(model=self.model, verbose=is_cli)
File “/home/sai/.local/lib/python3.8/site-packages/ultralytics/engine/”, line 341, in setup_model
self.model = AutoBackend(
File “/home/sai/.local/lib/python3.8/site-packages/torch/utils/”, line 115, in decorate_context
return func(*args, **kwargs)
File “/home/sai/.local/lib/python3.8/site-packages/ultralytics/nn/”, line 223, in init
dtype = trt.nptype(model.get_binding_dtype(i))
File “/usr/lib/python3.8/dist-packages/tensorrt/”, line 166, in nptype
bool: np.bool,
File “/home/sai/.local/lib/python3.8/site-packages/numpy/”, line 305, in getattr
raise AttributeError(former_attrs[attr])
AttributeError: module ‘numpy’ has no attribute ‘bool’.
np.bool was a deprecated alias for the builtin bool. To avoid this error in existing code, use bool by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use np.bool_ here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
NumPy 1.20.0 Release Notes — NumPy v2.0.dev0 Manual


Could you try to install numpy v1.23 and try it again?

$ pip3 install numpy==1.23.1


Thanks for the response. i went to the source code and changed np.bool to bool and it worked

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