Installing XenseSDK

Installation Guide

Step 1: Prepare the Python Development Environment

# Navigate to the Xense SDK directory
cd xensesdk

# Create and activate a virtual environment
conda create -n xenseenv python=3.9
# or conda create -n xenseenv python=3.10

conda activate xenseenv

Note

It is recommended to use Anaconda with Python version 3.9 or 3.10.

Step 2: Install CUDA Toolkit and cuDNN

The SDK requires onnxruntime_gpu, along with the matching cuDNN and cudatoolkit. Select the following installation method based on your environment:

  1. Install the required versions:

# This example uses CUDA 12.9
conda install nvidia/label/cuda-12.9.0::cuda-toolkit nvidia::cudnn
  1. Add the CUDA path to the environment variable ‘LD_LIBRARY_PATH’:

# Run the following command in Linux
export LD_LIBRARY_PATH=$CONDA_PREFIX/lib:$CONDA_PREFIX/lib64 # (Temporary)
mkdir -p $CONDA_PREFIX/etc/conda/activate.d && echo 'export LD_LIBRARY_PATH=$CONDA_PREFIX/lib:$CONDA_PREFIX/lib64:$LD_LIBRARY_PATH' > $CONDA_PREFIX/etc/conda/activate.d/env_vars.sh # (Permanent)
  1. Search for the required versions:

conda search cudnn
conda search cudatoolkit
  1. Install the required versions:

conda install cudnn==8.9.2.26 cudatoolkit==11.8.0

Step 3: Install the Xense SDK Package Install the SDK package into your environment:

After XenseSDK version 2.0.0, multiple installation options are available, and additional features can be installed via pip extras:

  • Core package: pip install xensesdk

  • Visualization: pip install xensesdk[viz]

  • ONNX inference: pip install xensesdk[onnx]

  • Full installation: pip install xensesdk[full]

# Install from a local directory (for custom packages)
pip install xensesdk-x.x.x-cp39-cp39-win_amd64.whl[full]
# Or install from PyPI
pip install xensesdk[full] -i https://repo.huaweicloud.com/repository/pypi/simple/

Step 4: Ubuntu Environment Notes

For first-time installation of xensesdk >= 1.6.7 on Ubuntu, run the following script first for proper operation.

#!/bin/bash

# 1) Create group (if it already exists, no error will be reported)
sudo groupadd -f xense

# Remove the rule file if it exists (optional).
if [ -f '/etc/udev/rules.d/99-xense.rules' ]; then
    echo "Udev rule already exists, removing old one..."
    sudo rm /etc/udev/rules.d/99-xense.rules
fi

# 2) Rule to match all Xense devices by vendor ID 3938 (covers current and future products).
sudo tee /etc/udev/rules.d/99-xense.rules > /dev/null <<EOF
# 99-xense.rules - allow users in 'xense' group to access Xense Robotics USB devices
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ATTR{idVendor}=="3938", MODE="0660", GROUP="${USER}"
EOF

# 3) Reload the udev rules and trigger the events (to apply the new rules).
sudo udevadm control --reload-rules
sudo udevadm trigger

echo "Xense udev rule installed. Please reboot"