## PySDK Supported Configurations The table below lists operating systems, CPU architectures, and Python versions supported by latest released PySDK version. | Operating System |Supported CPU Architectures | Supported Python Versions | DeGirum Orca Hardware Support| |----------|-----|----|---| |**Ubuntu Linux 20.04 LTS**| x86-64| 3.8, 3.9|Yes| |**Ubuntu Linux 20.04 LTS**|ARM AArch64 |3.9| Yes| |**Raspberry Pi OS (64 bit)**|ARM AArch64|3.9|Yes| |**Windows 10**|x86-64|3.8, 3.9|Planned| |**macOS 12**|x86-64|3.9|Planned| |**macOS 12**|ARM AArch64|3.9|Planned| ## PySDK Installation To install DeGirum PySDK from the DeGirum index server use the following command: ```bash python3 -m pip install degirum --extra-index-url https://degirum.github.io/simple ``` To force reinstall the most recent PySDK version without reinstalling all dependencies use the following command: ```bash python3 -m pip install degirum --upgrade --no-deps --force-reinstall --extra-index-url https://degirum.github.io/simple ``` ## DeGirum Docker Images For the ease of deployment, DeGirum provides Docker images for the [DeGirum AI server](https://hub.docker.com/r/degirum/aiserver) and [PySDK AI client](https://hub.docker.com/r/degirum/aiclient) installations. Please follow [this GitHub link to DeGirum Docker repo](https://github.com/DeGirum/docker-degirum) for details how to run these images and for corresponding source Dockerfiles.

PySDK Documentation

## DeGirum AI Server Configuration PySDK can be used to configure and launch DeGirum AI server on hosts equipped with DeGirum Orca AI accelerator card(s). This allows you running AI inferences on this AI server host initiated from remote clients. To run PySDK as a server on some host perform the following steps on this host: 1. Create or select a user name to be used for all the following configuration steps. This user should have administrative rights on this host. The user name *ai-user* is used in the instructions below, but it can be changed to any other user name of your choice. 1. For convenience of future maintenance we recommend you to install PySDK into virtual environment, such as [Miniconda](https://docs.conda.io/en/latest/miniconda.html). Make sure you activated your Python virtual environment with Python 3.8 and PySDK installed into this virtual environment. 1. Create a directory for the AI server model zoo, and change your current working directory to this directory. For example: ```bash mkdir /home/ai-user/zoo cd /home/ai-user/zoo ``` 1. Download all models from DeGirum public model zoo into the current working directory by executing the following command: ```python python3 -c "from degirum import server; server.download_models('.', token='token string')" ``` Where the `'token string'` is your personal access token string to the model zoo repository. In case of DeGirum public model zoo, any valid [GitHub personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token) will work. 1. Start DeGirum AI server process by executing the following command: ```bash python3 -m degirum.server --zoo /home/ai-user/zoo ``` The AI server is up and will run until you press ENTER in the same terminal where you started it. By default, AI server listens to 8778 TCP port. If you want to change the TCP port, pass `--port` command line argument when launching the server, for example: ```bash python3 -m degirum.server --zoo /home/ai-user/zoo --port 8780 ``` ### Starting AI Server as Linux System Service It is convenient to automate the process of AI server launch so it will be started automatically on each system startup. To do so you need to define and configure Linux system service, which will do it for you. Please perform the following steps: 1. Create the configuration file in */etc/systemd/system* directory named *degirum.service*. You will need administrative rights to create this file. You can use the following template as an example: ```ini [Unit] Description=DeGirum AI Service [Service] # >> you may want to adjust the working directory: WorkingDirectory=/home/ai-user/ # >> you may want to adjust the path to your Python executable and --zoo model zoo path; # >> also you may specify server TCP port other than default 8778 by adding --port <port> argument: ExecStart=/home/ai-user/miniconda3/bin/python -m degirum.server --zoo /home/ai-user/zoo Restart=always # >> you may want to adjust the restart time interval: RestartSec=10 SyslogIdentifier=degirum-ai-server # >> you may want to change the user name under which this service will run. # >> This user should have rights to access model zoo directory User=ai-user [Install] WantedBy=multi-user.target ``` 1. Start the system service by executing the following command: ```bash sudo systemctl start degirum.service ``` 1. Check the system service status by executing the following command: ```bash sudo systemctl status degirum.service ``` If the status is "Active", that means the configuration is good and the service is up and running. 1. Then enable the service for automatic startup by executing the following command: ```bash sudo systemctl enable degirum.service ``` ### Connecting to AI Server from Client Side Now your AI server is up and running and you may connect to it from Python scripts using PySDK. To do so you pass the AI server network hostname or its IP address to the `connect_model_zoo()` PySDK function: ```python import degirum as dg model_zoo = dg.connect_model_zoo(host_address) ``` If you run your PySDK script on the **same** host as the AI server, you may use the 'localhost' string as a network hostname. In local Linux networks with standard mDNS configuration the network hostname is a concatenation of the local hostname as returned by *hostname* command and *.local* suffix, for example, if *hostname* command returns *ai-host*, then the network hostname will be *ai-host.local* ## Linux Driver Installation Hosts that have DeGirum Orca card installed need a driver to enable its functionality. The driver is distributed as a source package via a DeGirum aptitude repository. It can be built automatically after download. To download, built, and install the driver please perfrom the following steps: 1. To add the DeGirum repository, add the following to /etc/apt/sources.list: ```bash deb-src https://degirum.github.io/apt-repo ORCA main ``` 1. Then, download DeGirum public key: ```bash wget -O - -q http://degirum.github.io/apt-repo/DeGirum.gpg.key | sudo apt-key add - ``` 1. Update package information from configured sources, then download prerequisites: ```bash sudo apt update sudo apt install dpkg-dev debhelper ``` 1. Finally, download and build DeGirum Linux driver package: ```bash sudo apt-get --build source orca-driver ```