To install the UHD Python API from source, Ubuntu 22.04 and Python 3.8 or higher are required.
Follow the steps below to compile UHD, install the Python bindings, and configure USB permissions for USRP B200/B210 devices.
sudo apt update
sudo apt install -y \
git cmake g++ python3 python3-dev python3-pip \
libboost-all-dev libusb-1.0-0-dev libncurses5-dev \
python3-mako libaio-devcd ~
git clone https://github.com/EttusResearch/uhd.git
mv uhd uhd_repocd ~/uhd_repo/host
mkdir build
cd build
cmake \
-DENABLE_PYTHON_API=ON \
-DPYTHON_EXECUTABLE=$(which python3) \
-DPYTHON3_SITEPKG=/usr/local/lib/python3.10/dist-packages \
..
make -j$(( $(nproc) / 2 ))
sudo make install
sudo ldconfigcd ~/uhd_repo/host/build/python
sudo python3 setup.py installIf there are no errors, then the UHD module installed successfully
USB 3.0/3.1 must be used for B210/B200 devices.
sudo cp ~/uhd_repo/host/utils/uhd-usrp.rules /etc/udev/rules.d/sudo udevadm control --reload-rules
sudo udevadm triggersudo usermod -aG plugdev $USER
sudo usermod -aG dialout $USERsudo reboot nowAfter reboot:
uhd_find_devicesExpected output:
-- UHD Device 0 --
serial: XXXXXXX
product: B200
type: b200
python3 - << 'EOF'
import uhd
print("UHD Python API is working")
print("UHD Version:", uhd.get_version_string())
EOFExpected output:
UHD Python API is working
UHD Version: 4.x.x