from rknn.api import RKNN Traceback (most recent call last): File "<stdin>", line 1, in…
- User
from rknn.api import RKNN Traceback (most recent call last): File "", line 1, in File "/root/venv/lib/python3.11/site-packages/rknn/api/init.py", line 1, in from rknn.api.rknn import RKNN File "/root/venv/lib/python3.11/site-packages/rknn/api/rknn.py", line 7, in from .rknn_base import RKNNBase File "rknn/api/rknn_base.py", line 25, in init rknn.api.rknn_base File "rknn/api/cpp_gen.py", line 4, in init rknn.api.cpp_gen File "/root/venv/lib/python3.11/site-packages/cv2/init.py", line 181, in bootstrap() File "/root/venv/lib/python3.11/site-packages/cv2/init.py", line 153, in bootstrap native_module = importlib.import_module("cv2") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.11/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ImportError: libGL.so.1: cannot open shared object file: No such file or directory
- Assistant
The error message:
codeImportError: libGL.so.1: cannot open shared object file: No such file or directoryindicates that the system is missing the
libGL.so.1shared library which is required by OpenCV (cv2), which is in turn needed by RKNN.What is
libGL.so.1?libGL.so.1is part of the OpenGL graphics library, typically installed with GPU drivers or graphics-related packages.
How to fix it?
You need to install the package that provides
libGL.so.1. The package depends on your Linux distribution.
- Assistant
It looks like your environment is missing the
libGL.so.1library required by OpenCV (used internally byrknn).To resolve this, install the missing OpenGL library on your system. For example, if you use Ubuntu/Debian, run:
bashsudo apt update sudo apt install -y libgl1-mesa-glxIf you use CentOS/RHEL:
bashsudo yum install mesa-libGLAfter installing, retry your Python code. This should fix the
ImportError: libGL.so.1: cannot open shared object fileproblem. - User
convert.py lpr_all_640.onnx rv1106 i8 W init: rknn-toolkit2 version: 1.6.0+81f21f4d --> Config model done --> Loading model E load_onnx: Catch exception when loading onnx model: /root/rknn_model_zoo/examples/yolov5/python/lpr_all_640.onnx! E load_onnx: Traceback (most recent call last): E load_onnx: File "rknn/api/rknn_base.py", line 1501, in rknn.api.rknn_base.RKNNBase.load_onnx E load_onnx: File "/root/venv/lib/python3.11/site-packages/google/protobuf/internal/containers.py", line 93, in getitem E load_onnx: return self._values[key] E load_onnx: ~~~~~~~~~~~~^^^^^ E load_onnx: IndexError: list index out of range W If you can't handle this error, please try updating to the latest version of the toolkit2 and runtime from: https://console.zbox.filez.com/l/I00fc3 (Pwd: rknn) Path: RKNPU2_SDK / 1.X.X / develop / If the error still exists in the latest version, please collect the corresponding error logs and the model, convert script, and input data that can reproduce the problem, and then submit an issue on: https://redmine.rock-chips.com (Please consult our sales or FAE for the redmine account) Load model failed!
- Assistant
- User
root@dev-coder002:~/rknn_model_zoo/examples/yolov5/python# python3 convert.py best.onnx rv1106 i8 W init: rknn-toolkit2 version: 1.6.0+81f21f4d --> Config model done --> Loading model Loading : 100%|████████████████████████████████████████████████| 123/123 [00:00<00:00, 52105.79it/s] done --> Building model
A module that was compiled using NumPy 1.x cannot be run in NumPy 2.3.1 as it may crash. To support both 1.x and 2.x versions of NumPy, modules must be compiled with NumPy 2.0. Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.
If you are a user of the module, the easiest solution will be to downgrade to 'numpy<2' or try to upgrade the affected module. We expect that some modules will need time to support NumPy 2.
Traceback (most recent call last): File "/root/rknn_model_zoo/examples/yolov5/python/convert.py", line 60, in ret = rknn.build(do_quantization=do_quant, dataset=DATASET_PATH) File "/root/venv/lib/python3.11/site-packages/rknn/api/rknn.py", line 197, in build return self.rknn_base.build(do_quantization=do_quantization, dataset=dataset, expand_batch_size=rknn_batch_size) File "/root/venv/lib/python3.11/site-packages/onnxruntime/.py", line 23, in from onnxruntime.capi._pybind_state import ExecutionMode # noqa: F401 File "/root/venv/lib/python3.11/site-packages/onnxruntime/capi/_pybind_state.py", line 32, in from .onnxruntime_pybind11_state import * # noqa AttributeError: _ARRAY_API not found ImportError: numpy.core.multiarray failed to import
- Assistant
The error you encountered relates to incompatible NumPy versions and binary incompatibility between NumPy and packages compiled against earlier NumPy versions. Key parts of the message:
code