Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
GNURadio with Anaconda Python 3 Installation Guide

GNURadio with Anaconda Python 3 Installation Guide

At its current state, GNURadio 3.7 does not work out-of-the-box with Python 3. This is a guide to building GNURadio from source to use a Python 3 Anaconda environment. This setup is particularly nice since you can still easily import other Python packages with conda and use them inside GNURadio blocks.

This guide assumes you have installed all the system dependencies of GNURadio (not including the Python ones) and Anaconda 3. You can find the list of system dependencies on the GNURadio website. You need all the ones that aren't called gnuradio or python-*.

Pulling the Source

Pull the GNURadio source and the environment.yml file that describes the conda environment that plays nice with GNURadio. At the time that this tutorial was written, this worked for 72aa97d.

$ git clone --recurse-submodules
$ cd gnuradio
$ wget


Create the conda environment (the one described by the yml file is called "dsp") and build GNURadio using the Python interpreter and libraries in the conda environment.

$ conda env create -f gr_py3_env.yml
$ conda activate dsp
$ mkdir build
$ cd build
$ cmake -DPYTHON_EXECUTABLE=~/anaconda3/envs/dsp/bin/python3.7 -DPYTHON_INCLUDE_DIR=~/anaconda3/envs/dsp/include/python3.7m -DPYTHON_LIBRARY=~/anaconda3/envs/dsp/lib/ -DCMAKE_INSTALL_PREFIX=~/anaconda3/envs/dsp ../
$ make -j$(nproc)
$ sudo make install
$ sudo ldconfig

Configuring Path to GNURadio's Python Libs

By default, make installs to -DCMAKE_INSTALL_PREFIX/libs/<python version>/dist-packages/, but the conda Python interpreter looks for packages in <prefix>/libs/<python version>/site-packages/. Thus, we symlink to the packages installed.

$ ln -s ~/anaconda3/envs/dsp/lib/python3.7/dist-packages/* ~/anaconda3/envs/dsp/lib/python3.7/site-packages

And that's it. You should now be able to import GNURadio from (dsp) and run grc blocks written in (dsp).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.