> ## Documentation Index
> Fetch the complete documentation index at: https://dragonwingdocs.qualcomm.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Set up Qualcomm AI Runtime SDK

> Configure the Qualcomm AI Runtime (QAIRT) SDK environment on Ubuntu 22.04, including Python setup, system dependencies, and ML framework installation.

## Prerequisites

* Host OS: **Ubuntu 22.04 LTS**

<Note>
  If the host computer uses Windows or macOS,
  install a virtual machine. Subsequent steps must be run in the virtual machine running Ubuntu 22.04 LTS.
</Note>

1. Enable Wi-Fi and SSH on the device.

   The device requires an internet connection to download the artifacts needed to run sample applications. If SSH and Wi-Fi are already configured, skip this step.

   Follow [Setup an SSH connection](https://dragonwingdocs.qualcomm.com/Technologies/Ethernet/get-started-with-ethernet#set-up-an-ssh-connection) to enable Wi-Fi and SSH on the device.

2. Sign in to the host computer:
   ```shell theme={null}
   ssh root@<IP_ADDRESS>
   ```

3. For the rest of the document, the `QAIRT_ROOT` environment variable
   represents the full path to the Qualcomm AI Runtime SDK root directory.

   * If installed using the direct download method, `${QAIRT_ROOT}` is the
     path to the unzipped SDK.

     ```shell theme={null}
     unzip v2.47.0.260601.zip
     ```

     ```shell theme={null}
     cd qairt/2.47.0.260601 
     ```

     ```shell theme={null}
     export QAIRT_ROOT=`pwd`
     ```

   * If installed using QPM, the SDK is installed
     under `/opt/qcom/aistack/qairt/<version>`

     ```shell theme={null}
     export QAIRT_ROOT=/opt/qcom/aistack/qairt/2.47.0.260601/
     ```

4. Python: **v3.10**

   If Python is already installed, ensure that the environment path is
   updated with the Python 3.10 path. If Python 3.10 isn't installed on
   your system, you may install it with the following commands:

   ```shell theme={null}
   sudo apt-get update
   ```

   ```shell theme={null}
   sudo apt-get install python3.10 python3-distutils libpython3.10
   ```

5. System Dependencies:

   <Note>
     Run the following command as administrator/root to install
     the system libraries. The command takes time to fully complete.
   </Note>

   ```shell theme={null}
   sudo bash ${QAIRT_ROOT}/bin/check-linux-dependency.sh
   ```

6. Virtual environment (VENV)

   <Note>
     `<venv_path>` is the path for the new virtual environment.
   </Note>

   ```shell theme={null}
   sudo apt-get install python3.10-venv 
   ```

   ```shell theme={null}
   python3.10 -m venv "<venv_path>"
   ```

   ```shell theme={null}
   source <venv_path>/bin/activate
   ```

7. Run the following script to check and install missing dependencies:

   ```shell theme={null}
   python3 -m pip install --upgrade pip
   ```

   ```shell theme={null}
   ${QAIRT_ROOT}/bin/check-python-dependency
   ```

   Expected output:

   ```
   Summary: 

   Package              Recommended    Installed
   ~~~~~~~              ~~~~~~~~~~~    ~~~~~~~~~
   absl-py              2.1.0          2.1.0
   attrs                23.2.0         23.2.0 
   dash                 2.12.1         2.12.1
   decorator            4.4.2          4.4.2
   invoke               1.7.3          1.7.3
   joblib               1.4.0          1.4.0
   jsonschema           4.19.0         4.19.0
   Ixml                 5.2.1          5.2.1
   mako                 1.1.0          1.1.0
   matplotlib           3.3.4          3.3.4
   mock                 3.0.5          3.0.5
   numpy                1.26.4         1.26.4
   opencv-python        4.5.4.58       4.5.4.58
   optuna               3.3.0          3.3.0
   packaging            24.0           24.0
   pandas               2.0.1          2.0.1
   paramiko             3.4.0          3.4.0
   pathlib2             2.3.6          2.3.6
   pillow               10.2.0         10.2.0
   plotly               5.20.0         5.20.0
   protobuf             3.19.6         3.19.6
   psutil               5.6.4          5.6.4 
   pytest               8.1.1          8.1.1
   pyyaml               5.3            5.3 
   scikit-optimize      0.9.0          0.9.0
   scipy                1.10.1         1.10.1
   six                  1.16.0         1.16.0
   tabulate             0.9.0          0.9.0
   typing-extensions    4.10.0         4.10.0
   xlsxwriter           1.2.2          1.2.2
   ```

## Setup ML Frameworks

To convert ML models trained on different frameworks into
intermediate representations consumable by the
Qualcomm AI Runtime SDK, you may need to download and install
the corresponding frameworks on your host computer.

This Qualcomm AI Runtime SDK release is verified to work with
the following versions of the ML training frameworks:

| Framework      | Version |
| -------------- | ------- |
| **TensorFlow** | 2.10.1  |
| **TFLite**     | 2.18.0  |
| **PyTorch**    | 2.4.1   |
| **ONNX**       | 1.19.1  |

* Install TensorFlow

  ```shell theme={null}
  pip install tensorflow==2.10.1
  ```

* Install TFLite

  ```shell theme={null}
  pip install tflite==2.18.0
  ```

* Install PyTorch

  ```shell theme={null}
  pip install torch==2.4.1 torchvision==0.19.1
  ```

* Install ONNX

  ```shell theme={null}
  pip install onnx==1.19.1 onnxruntime==1.23.2 onnxsim==0.6.2
  ```

## Setup Qualcomm AI Runtime SDK environment

Source the environment setup script provided by Qualcomm AI Runtime
SDK to ensure all necessary tools and libraries are available in `$PATH`
for the workflow.

```shell theme={null}
source ${QAIRT_ROOT}/bin/envsetup.sh
```
