在kneron_plus_v2.0.1資料中執行example python檔有誤
在window時執行example和自己的訓練檔都沒問題,
但換在jetson xavier NX 上建虛擬環境用python3.8想執行時出現以下錯誤
以下是指令問題回報與執行畫面截圖:
(無sudo)
(kneo) chica@chica-desktop:~/下載/kneron_plus_v2.0.1/kneron_plus/python/example$ python KL720DemoGenericImageInference.py
Traceback (most recent call last):
File "KL720DemoGenericImageInference.py", line 12, in <module>
from utils.ExampleHelper import get_device_usb_speed_by_port_id
File "/home/chica/下載/kneron_plus_v2.0.1/kneron_plus/python/example/utils/ExampleHelper.py", line 15, in <module>
import kp
File "/home/chica/miniforge-pypy3/envs/kneo/lib/python3.8/site-packages/kp/__init__.py", line 5, in <module>
from .KP import *
File "/home/chica/miniforge-pypy3/envs/kneo/lib/python3.8/site-packages/kp/KP.py", line 6, in <module>
from .Legacy import V1 as v1
File "/home/chica/miniforge-pypy3/envs/kneo/lib/python3.8/site-packages/kp/Legacy/V1/__init__.py", line 5, in <module>
from .KP import *
File "/home/chica/miniforge-pypy3/envs/kneo/lib/python3.8/site-packages/kp/Legacy/V1/KP.py", line 5, in <module>
from .KPInference import KPInference as inference
File "/home/chica/miniforge-pypy3/envs/kneo/lib/python3.8/site-packages/kp/Legacy/V1/KPInference.py", line 6, in <module>
from .KPValue import \
File "/home/chica/miniforge-pypy3/envs/kneo/lib/python3.8/site-packages/kp/Legacy/V1/KPValue.py", line 16, in <module>
from ...KPValue import \
File "/home/chica/miniforge-pypy3/envs/kneo/lib/python3.8/site-packages/kp/KPValue.py", line 6, in <module>
from .KPWrapperUtils import KPWrapperUtils as wrapper_utils
File "/home/chica/miniforge-pypy3/envs/kneo/lib/python3.8/site-packages/kp/KPWrapperUtils.py", line 10, in <module>
class KPWrapperUtils:
File "/home/chica/miniforge-pypy3/envs/kneo/lib/python3.8/site-packages/kp/KPWrapperUtils.py", line 11, in KPWrapperUtils
__KP_WRAPPER = KPWrapper()
File "/home/chica/miniforge-pypy3/envs/kneo/lib/python3.8/site-packages/kp/KPBaseClass/WrapperBase.py", line 16, in __call__
instance = super(Singleton, cls).__call__(*args, **kwargs)
File "/home/chica/miniforge-pypy3/envs/kneo/lib/python3.8/site-packages/kp/KPWrapper.py", line 32, in __init__
super(KPWrapper, self).__init__(lib_loader=KPLibLoader())
File "/home/chica/miniforge-pypy3/envs/kneo/lib/python3.8/site-packages/kp/KPBaseClass/WrapperBase.py", line 25, in __init__
self._load_libKSI()
File "/home/chica/miniforge-pypy3/envs/kneo/lib/python3.8/site-packages/kp/KPBaseClass/WrapperBase.py", line 33, in _load_libKSI
ctypes.CDLL(share_lib, mode=ctypes.RTLD_GLOBAL)
File "/home/chica/miniforge-pypy3/envs/kneo/lib/python3.8/ctypes/__init__.py", line 373, in __init__
self._handle = _dlopen(self._name, mode)
OSError: /home/chica/miniforge-pypy3/envs/kneo/lib/python3.8/site-packages/kp/KPBaseClass/../../kp/lib/libusb-1.0.so.0: cannot open shared object file: No such file or directory
(有sudo)
(kneo) chica@chica-desktop:~/下載/kneron_plus_v2.0.1/kneron_plus/python/example$ sudo python KL720DemoGenericImageInference.py
File "KL720DemoGenericImageInference.py", line 104
print(' - ', end='')
^
SyntaxError: invalid syntax
Comments
Hi Su,
在執行gereric inference時不用加sudo,因為在python環境中用sudo的話會跑到另外一個環境,可能就不是您安裝的環境了。
若是沒有用sudo會遇到USB權限問題,請參考文件說明設定使用權限: Install Dependency - Document Center (kneron.com)
還有,您可以確認是否有安裝需要的packages,像是在python/package裡面的.whl檔,或是$sudo bash install_libusb.sh,也可以確認使用的python版本是3.5-3.9。
您好!想請問如已執行以上方式,還是無法獲得解決是甚麼原因與方法,
同在jetson xavier NX ubuntu 18.04 上建虛擬環境使用 python3.8.13
@Maria Chen 想請問 如KL720在window執行成功後,還能在ubuntu環境執行嗎]? 或需要做甚麼額外安裝設定嗎?
您好,
那個error還有另外一個可能性: 因為您的「下載」資料夾是用中文寫的,所以有可能program找不到檔案。可以請您試著把Kneron PLUS的路徑放在沒有中文的地方,再試一次嗎?
如果還是不行,請確認Jetson Xavier NX的ubuntu platform有沒有符合x86_64 (不支援ARM。這時候,要用C去build,才可以跑)
KL720在Windows執行成功後,也可以在ubuntu環境執行,不用做其他設定喔。