Skip to main content

RKNN Toolkit Lite2 Environment Setup

Note

The inference environment described in this chapter is deployed on the development board. System version: Debian 13 Tool version: RKNN-Toolkit2 2.3.2 Driver version: NPU Driver 0.9.8

1. Introduction​

RKNN Toolkit Lite2 is a lightweight Python inference interface designed for the Rockchip NPU platform. It is mainly used to load and run RKNN models on the device side (development board).

Compared with the full version of RKNN Toolkit, Lite2 focuses on the inference stage only. It removes model conversion and training-related functionalities, offering advantages such as fewer dependencies, simpler deployment, and higher efficiency. This makes it well-suited for rapid integration and application development on resource-constrained embedded devices.

With RKNN Toolkit Lite2, developers can easily perform model loading, input/output processing, and inference execution, enabling efficient deployment of AI capabilities on edge devices.

2. Installing RKNN Toolkit Lite2​

Note

The provided installation package rknn_toolkit_lite2-2.3.2-cp312-xxx.whl supports up to Python 3.12, while the default Python version in Aura Debian 13 is Python 3.13. To avoid compatibility issues, it is recommended to use a Python 3.12 virtual environment for installation and usage. Using Conda to create the virtual environment is recommended, as it allows flexible switching between different environments and effective dependency isolation.

2.1 Installing Conda​

  1. Obtain the Miniforge3 installation script. You can use the provided cloud resource or download the latest version from GitHub: https://github.com/conda-forge/miniforge/

  2. Grant execution permission and run the installation script:

    chmod +x Miniforge3-26.1.1-3-Linux-aarch64.sh
    ./Miniforge3-26.1.1-3-Linux-aarch64.sh
    # During installation, confirm the following prompts:
    Do you accept the license terms? [yes|no]
    >>> yes

    [/root/miniforge3] >>> press Enter
    PREFIX=/root/miniforge3

    Proceed with initialization? [yes|no]
    [no] >>> yes
  3. Reload the shell environment and verify that Conda is installed.

    source ~/.bashrc
    conda --version

  4. Create a Python 3.12 Conda environment.

    conda create -n rknn-toolkit-lite2 python=3.12 -y
    conda activate rknn-toolkit-lite2
  5. Clone or download the RKNN Toolkit2 source package.

    git clone https://github.com/airockchip/rknn-toolkit2.git
  6. Install RKNN Toolkit Lite2

    cd rknn-toolkit2-master/rknn-toolkit-lite2
    conda activate rknn-toolkit-lite2
    pip install packages/rknn_toolkit_lite2-2.3.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

  7. Verify the installation.

    (rknn-toolkit-lite2) root@aura:/home/aura/rknn-toolkit2-master/rknn-toolkit-lite2# python
    Python 3.12.13 | packaged by conda-forge | (main, Mar 5 2026, 16:39:32) [GCC 14.3.0] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> from rknnlite.api import RKNNLite
    >>>

  8. Install OpenCV using Conda.

    conda install -c conda-forge opencv

3. Upgrade NPU Runtime Library​

  1. The current Runtime version on the board is 2.3.0, while RKNN-Toolkit2 uses 2.3.2.To avoid version mismatch issues, the Runtime library needs to be upgraded manually.
    strings /usr/bin/rknn_server | grep -i "rknn_server version"
    strings /usr/lib/librknnrt.so | grep -i "librknnrt version"

  2. Replace the Runtime libraries with version 2.3.2.
    cd /home/aura/rknn-toolkit2-master/rknpu2/runtime/Linux
    cp librknn_api/aarch64/librknnrt.so /usr/lib/
    cp rknn_server/aarch64/usr/bin/* /usr/bin/
    mkdir -p /usr/lib64/
    cp /usr/lib/librknnrt.so /usr/lib64/

  3. Add execute permissions and restart the service.
    chmod +x /usr/bin/rknn_server
    chmod +x /usr/bin/start_rknn.sh
    chmod +x /usr/bin/restart_rknn.sh
    restart_rknn.sh
  4. Verify the upgrade.
    strings /usr/bin/rknn_server | grep -i "rknn_server version"
    strings /usr/lib/librknnrt.so | grep -i "librknnrt version"