CondaInstall

From GNU Radio
Revision as of 17:23, 8 January 2021 by Ryanvolz (talk | contribs)
Jump to navigation Jump to search

Why use conda?

Conda is a cross-platform package manager (supporting Linux, macOS, and Windows) that makes it easy to install GNU Radio, its dependencies, and out-of-tree modules in a self-contained environment. Conda lets you create independent environments with their own sets of packages, and those environments are separate from your system installation and other package managers. If you've struggled with installing GNU Radio by other methods, or you want to try out a new version without affecting your tried-and-true system installation, conda may be right for you!

Installation

The conda packages for GNU Radio are unofficial and supported through volunteer effort within the conda-forge community. Conda-forge is a community-maintained collection of conda packages where anyone with interest can help improve or add packages. Please report and discuss any packaging-specific issues with the maintainers at the gnuradio feedstock. If you'd like to help or are interested in adding other related software to conda-forge (e.g. out-of-tree modules), get in touch with the maintainers through Github.

Install conda itself

First, you will need to install a base conda distribution so that you can use the conda program to create an environment and install the GNU Radio packages. If you already have this and can run conda on a command line or use the Anaconda Navigator to install packages, skip to the next step.

If this is your first time using conda, we recommend miniforge for the base installation. This provides a minimal environment to run conda that is already set up to pull packages from conda-forge (which is where you can find GNU Radio). Download and install miniforge by following the instructions at [1]. Installers for many different platforms are available there, but the most relevant are the following:

For Linux and macOS, run the downloaded installer from a console and follow the prompts:

  • (Linux) bash Miniforge3-Linux-x86_64.sh
  • (macOS) bash Miniforge3-MacOSX-x86_64.sh

By default, this will install miniforge to your home directory at ~/miniforge3 and allow you to use the conda command from any console.

For Windows, double click on the downloaded installer executable and follow the prompts. By default, this will install miniforge to your user directory at C:\Users\USERNAME\miniforge3 and add a "Miniforge Prompt" entry to your start menu. Running the "Miniforge Prompt" should bring up a console window where your base conda environment is activated and you can use the conda command.

This guide provides a nice introduction to using conda generally; it may help you better understand the rest of these instructions, but it is not necessary to read.

(Optional, experts only) It may be convenient to now install mamba in your base environment and use it in place of the conda command. Mamba is a third-party alternative to conda that is written in C instead of Python, and its main benefit is faster dependency resolution when installing packages. If you do install mamba, you can simply use the mamba command in place of conda for all subsequent steps.

Create an environment for GNU Radio

It's almost never a good idea to install additional packages to your base conda environment because their dependencies may interfere with conda's own dependencies. We recommend creating an environment specifically for GNU Radio and related packages. From a console with the base conda environment activated, run

conda create -n gnuradio

to create an empty environment called "gnuradio". Enter the environment by activating it with the command:

conda activate gnuradio

Before installing the GNU Radio packages, we need to ensure that the environment is set up to look for packages from conda-forge:

conda config --env --add channels conda-forge conda config --env --set channel_priority strict

Now you're ready to actually install GNU Radio!

Install GNU Radio from conda-forge

GNU Radio on conda-forge is split into a few subpackages. Most users will be happy with the full installation provided by the gnuradio metapackage. From within your activated "gnuradio" environment (previous step), run the command:

conda install gnuradio

This will install the latest available version of GNU Radio along with the latest version of Python. If you want a specific version of the gnuradio package (get a list of possibilities from conda search gnuradio), you can specify it like

conda install gnuradio=3.8.2

If you want a specific version of Python, you can install it before gnuradio or specify them together like

conda install gnuradio python=3.8

To upgrade all non-Python packages in your environment to their latest available versions, use the upgrade command

conda upgrade --all

The gnuradio metapackage installs all of the following subpackages:

  • gnuradio-core
  • gnuradio-grc
  • gnuradio-qtgui
  • gnuradio-uhd
  • gnuradio-video-sdl
  • gnuradio-zeromq

If you don't want all of those and their dependencies, you can install the ones you'd like individually like

conda install gnuradio-uhd

to get only the core package (always a dependency) and UHD support without any GUI elements.