rockchip-linux / rknn-toolkit2

BSD 3-Clause "New" or "Revised" License
889 stars 155 forks source link

Cannot load RKNN in jupyter-notebook #222

Open ramonbroox opened 1 year ago

ramonbroox commented 1 year ago

When using jupyter-notebook (ipython) the RKNN module fails loading with:

NameError: name 'exit' is not defined

though it runs ok on normal python. Also, pre-defining from sys import exit does not work either.

from rknn.api import RKNN

---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[6], line 1
----> 1 from rknn.api import RKNN

File ~/Repos/rknn-toolkit2/.venv/lib/python3.8/site-packages/rknn/api/__init__.py:1
----> 1 from rknn.api.rknn import RKNN

File ~/Repos/rknn-toolkit2/.venv/lib/python3.8/site-packages/rknn/api/rknn.py:7
      5 from .rknn_log import set_log_level_and_file_path
      6 from .rknn_platform import get_host_os_platform, get_librknn_api_require_dll_dir
----> 7 from .rknn_base import RKNNBase
      8 from argparse import Namespace
      9 from sys import exit

File rknn/api/rknn_base.py:23, in init rknn.api.rknn_base()

File rknn/api/graph_optimizer.py:10, in init rknn.api.graph_optimizer()

File rknn/api/model_pruning.py:1, in init rknn.api.model_pruning()

NameError: name 'exit' is not defined
chopin1998 commented 3 months ago

same question, any update?

Mavacer commented 3 months ago

same question, jupyter simply cant import rknn, but i need it to quickly debug my code. happy to see any update of this issue.