InstallingGR: Difference between revisions

From GNU Radio
Jump to navigation Jump to search
m (Update radioconda version and links)
 
(118 intermediate revisions by 19 users not shown)
Line 1: Line 1:
= From Binaries =
<div style="float:right">
{{Template:BeginnerTutorials}}
</div>
= Quick Start =
{| class="wikitable"
|+
! Platform !! Method !! GNU Radio version
<!-- ======================================================================================================================================================================== -->
<!-- DEBIANOIDS ============================ -->
<!-- ======================================================================================================================================================================== -->
|-
|rowspan=3 style="background-color:#eaecf0;"| [[File:Debian.png|32px|middle|link=]] '''Debian''' ≥12<br>[[File:Ubuntu.png|32px|middle|link=]] '''Ubuntu''' ≥22.04<br>[[File:LinuxMint.png|32px|middle|link=]] '''Linux Mint''' ≥21.1<br>[[File:RaspberryPi.png|32px|middle|link=]]'''Raspberry Pi OS'''<sub>64-bit</sub> ≥2021-10-30
|rowspan=3| <syntaxhighlight lang="shell">sudo apt-get install gnuradio</syntaxhighlight>


The recommended way to install GNU Radio on most platforms is using already available binary packages (see [[#Ubuntu_PPA_Installation|Ubuntu PPA Installation]]). For some platforms there are no binaries provided by available package managers or the GNU Radio project. In these cases please contact the maintainer of the package manager or the GNU Radio project to find a sensible way to provide binaries for your platform.
||<div style="min-width: 25ch; display: flex; justify-content: space-between; flex-flow: row wrap;"><div style="min-width: 12ch; clear: none;">Ubuntu 24.04:</div><div>v3.10.9.2</div></div>
 
|-
In addition to using binaries, GNU Radio can be installed:
||<div style="min-width: 25ch; display: flex; justify-content: space-between; flex-flow: row wrap;"><div style="min-width: 12ch; clear: none;">Ubuntu 22.04:</div><div>v3.10.1.1</div></div>
 
# '''[[#From_Source|From source]]''' (for those who want full control)
# '''[[#Using_PyBOMBS|Using PyBOMBS]]''' (for those who want it built from source and/or installed to a specific directory using a script)
# '''[[CondaInstall|Using conda]]''' (for those who want binaries installed to managed environments)
 
== Linux ==
 
Most distributions contain a package named <code>gnuradio</code> or similar in their standard repositories. For most use cases it is enough to install this package and start developing.
 
The development of GNU Radio can be fast-paced, and binaries provided by your distribution may be outdated. '''Do check if the version you're installing is up to date! Sometimes old versions are not updated in the packaging systems.''' If you find a bug in a older GNU Radio version, please check if the bug still exists in the newer version of GNU Radio before filing a new issue.
 
If the version shipped in your distribution is outdated please contact the corresponding maintainer to update it in the packaging system.
 
Here are examples of how to install GNU Radio in various Linux distributions (click the link under &quot;Distribution&quot; for more installation details):
 
{|class="wikitable" style="margin: auto; width: 90%;"
!scope="col"|Distribution
!scope="col"|Command
|-
|-
| [[UbuntuInstall|Debian/Ubuntu and derivates]]
||<div style="min-width: 25ch; display: flex; justify-content: space-between; flex-flow: row wrap;"><div style="min-width: 12ch; clear: none;">Debian 12:</div><div>v3.10.5.1</div></div>
| <pre>$ apt install gnuradio</pre>
<!-- ======================================================================================================================================================================== -->
<!-- FEDORA ============================ -->
<!-- ======================================================================================================================================================================== -->
|-
|-
| [[FedoraInstall|Fedora]]
| rowspan=2 style="background-color:#eaecf0;"| [[File:Fedora.png|32px|middle|link=]] '''Fedora''' ≥39
| <pre>$ dnf install gnuradio</pre>
| rowspan=2 |
<syntaxhighlight lang="shell">
sudo dnf install gnuradio
</syntaxhighlight>
||<div style="min-width: 25ch; display: flex; justify-content: space-between; flex-flow: row wrap;"><div style="min-width: 12ch; clear: none;">Fedora 39:</div><div>v3.10.6.0</div></div>
|-
|-
| RHEL/CentOS
||<div style="min-width: 25ch; display: flex; justify-content: space-between; flex-flow: row wrap;"><div style="min-width: 12ch; clear: none;">Fedora 40:</div><div>v3.10.9.2</div></div>
| <pre>$ yum install gnuradio</pre>
<!-- ======================================================================================================================================================================== -->
<!-- PPA UBUNTU ============================ -->
<!-- ======================================================================================================================================================================== -->
|-
|-
| [[ArchInstall|Archlinux]]
|style="background-color:#eaecf0;"| [[File:Ubuntu.png|32px|middle|link=]] '''Ubuntu''' 20.04<br><small>Consider [https://ubuntu.com/tutorials/upgrading-ubuntu-desktop#1-before-you-start upgrading] your Ubuntu</small><br><br>[[File:Ubuntu.png|32px|middle|link=]] '''Ubuntu''' 22.04
| <pre>$ pacman -S gnuradio</pre>
||
<syntaxhighlight lang="shell">
sudo add-apt-repository ppa:gnuradio/gnuradio-releases
sudo apt-get update
sudo apt-get install gnuradio python3-packaging
</syntaxhighlight>
| style="text-align: right;" | v3.10.7.0
<!-- ======================================================================================================================================================================== -->
<!-- OTHER LINUXES ========================= -->
<!-- ======================================================================================================================================================================== -->
|-
|-
| [[GentooInstall|Gentoo Linux]]
|style="background-color:#eaecf0;"| [[File:Tux.png|32px|middle|link=]] '''Other Linux Distros'''
| <pre>$ emerge net-wireless/gnuradio</pre>
||
<syntaxhighlight lang="shell">
sudo {apt,dnf,yay,emerge,…} install gnuradio
</syntaxhighlight>
| style="text-align: right;" | See [https://repology.org/project/gnuradio/badges this table]
|-
|-
| [[SuseInstall|Suse Linux]]
<!-- ======================================================================================================================================================================== -->
|
<!-- WINDOWS ========================= -->
<!-- ======================================================================================================================================================================== -->
|style="background-color:#eaecf0;"| [[File:Windows.png|32px|middle|link=]] '''Windows'''
||
Download and install [https://github.com/ryanvolz/radioconda Radioconda] by following the instructions at the link<br>
and launch "GNU Radio Companion" from the Start menu
| style="text-align: right;" rowspan=2 |v3.10.10.0
<!-- ======================================================================================================================================================================== -->
<!-- Mac OS ========================= -->
<!-- ======================================================================================================================================================================== -->
|-
|-
|style="background-color:#eaecf0;"| [[File:MacOS.png|32px|middle|link=]] '''macOS'''
| Download and install [https://github.com/ryanvolz/radioconda Radioconda] by following the instructions at the link
|}
|}


On other distributions, simply use the appropriate package management command to install the <code>gnuradio</code> package and then please add it to this list. If you need newer versions or have a different platform please contact the package maintainer of your distribution or raise your issue on the mailing list.
= Other Installation Methods =
 
=== Ubuntu PPA Installation ===
For Ubuntu, the latest builds (both released and pulled from master branch) are maintained as PPAs on [https://launchpad.net/~gnuradio/+archive/ubuntu/gnuradio-master launchpad].  Be sure to uninstall any previously installed versions of gnuradio first.
 
To access the latest from the master branch, add the gnuradio/gnuradio-master ppa (removing other gnuradio ppas if already configured)
 
<pre>$ sudo add-apt-repository ppa:gnuradio/gnuradio-master</pre>
 
To access the 3.7 released version (legacy), add the gnuradio/gnuradio-releases-3.7 ppa (removing other gnuradio ppas if already configured)
 
<pre>$ sudo add-apt-repository ppa:gnuradio/gnuradio-releases-3.7</pre>
 
To access the 3.8 released version, add the gnuradio/gnuradio-releases-3.8 ppa (removing other gnuradio ppas if already configured)
 
<pre>$ sudo add-apt-repository ppa:gnuradio/gnuradio-releases-3.8</pre>
 
Then, update the apt sources, and install gnuradio
<pre>$ sudo apt-get update</pre>
<pre>$ sudo apt install gnuradio</pre>
 
==== Modtool on Ubuntu ====
NOTE: On released builds for Ubuntu 18 (bionic), there is an issue using gr_modtool after GNU Radio has been installed from the PPA.  This is due to byte-compiled code that remains in the modtool templates after installation.  To workaround this issue:
 
<pre>$ cd /usr/share/gnuradio/modtool/templates/gr-newmod
$ sudo py3clean .</pre>
 
This issue does not appear for Ubuntu 19 and later packages
 
=== Fedora COPR Installation ===
 
Packages are available for Fedora 29,30,31 hosted under COPR:
 
https://copr.fedorainfracloud.org/coprs/gnuradio/
 
1. Add the repository:
 
-- For the latest released version:
<pre>$ sudo dnf copr enable gnuradio/gnuradio-releases </pre>
-- For the latest pull from git master:
<pre>$ sudo dnf copr enable gnuradio/gnuradio-master </pre>
 
2. Install GNU Radio
<pre>$ sudo dnf install gnuradio </pre>
 
== Windows ==
 
Binary installers are now available for GNU Radio 3.7 and 3.8, download them [http://www.gcndevelopment.com/gnuradio/index.htm here].<br />
Conda packages are an alternative for installing binaries for GNU Radio 3.8+. See the [[CondaInstall|conda install guide]].<br />
If you need to install GNU Radio from source refer to the [[WindowsInstall|Windows install guide]].
 
Note: We do not officially support Windows. We do our best to provide installation instructions and work out build bugs on Windows when they are reported and patches received. As new versions of GNU Radio, its dependencies, and Windows itself come out, however, keeping all of them working together is beyond the scope of what the project currently supports. User updates to the above wiki installation instructions are very welcome.
 
== Mac OS X ==
 
Refer to the [[MacInstall|Mac OS X install guide page]].
 
= From Source =
 
Binary installation should be sufficient for most users, and certainly for anyone who is new to GNU Radio. However, if you have special requirements, want the latest version, or the binary packages are not working for you, you may want to install GNU Radio from source.
 
=== Notes ===
 
* By default GNU Radio will be installed in the /usr/local directory.  See notes about -DCMAKE_INSTALL_PREFIX to install it elsewhere.
* Running and developing out-of-tree modules does not require GNU Radio to be installed from source.
* If you are using Ubuntu, see [[UbuntuInstall#Install_the_Pre-Requisites]] for installing dependencies / pre-requisites.
* If you want to use GNU Radio with a USRP, you <b>FIRST</b> must clone and install UHD. See [[https://kb.ettus.com/Building_and_Installing_the_USRP_Open-Source_Toolchain_(UHD_and_GNU_Radio)_on_Linux UHD Installation Page]] for more info.
* To install on a Raspberry Pi, see [[InstallingGRFromSource on Raspberry Pi]].
* To build from source from within a conda environment, see [[CondaInstall#Building GNU Radio from source within a conda environment|the conda install guide]].
 
=== For the GNU Radio Master Branch ===
 
Since Volk is no longer considered as a submodule of GNU Radio (GNU Radio commit #80c04479da962d048d41165081b026aafdaa0316 ),<br> you <b>MUST FIRST</b> install Volk, and then install GNU Radio.
 
The basic idea is the same, but instead of building Volk along with GNU Radio, you need to clone and build it separately. For this example, we will start in the home directory. You can, of course, use any directory you wish and the results will be the same.
 
==== Step 1: Installing Dependencies ====
 
Refer to [[InstallingGR#Linux|this page for your specific Linux distro]] to find how to install dependencies.  For example, on Ubuntu 20.04 [[UbuntuInstall#Focal Fossa (20.04)|use this command]].
 
==== Step 2: Installing Volk ====
 
* <code>cd</code>
* <code>git clone --recursive https://github.com/gnuradio/volk.git</code>
* <code>cd volk</code>
* <code>mkdir build</code>
* <code>cd build</code>
* <code>cmake -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=/usr/bin/python3 ../</code>
* <code>make</code>
* <code>make test</code>
* <code>sudo make install</code>
 
If you're running Linux, then always remember to do the following command after installing any library:
* <code>sudo ldconfig</code>
 
==== Step 3: Installing GNU Radio ====
* <code>cd</code>
* <code>git clone https://github.com/gnuradio/gnuradio.git</code>
* <code>cd gnuradio</code>
* <code>mkdir build</code>
* <code>cd build</code>
* <code>cmake -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=/usr/bin/python3 ../</code>
* <code>make</code>
 
<b>Note:</b> In the following command, it is very possible that not all tests pass. Generally any error is a sign of a missing dependency such as the Python interface to ZMQ or NumPy or SciPy, none of which are required for building GNU Radio but are required for testing.
 
* <code>make test</code>
* <code>sudo make install</code>
 
Again, if you're running Linux, then always remember to do the following command after installing any library:
* <code>sudo ldconfig</code>
 
If you encounter "Cannot import gnuradio" error, then go to [[ModuleNotFoundError#B._Finding_the_Python_library|Finding the Python library]] to set your PYTHONPATH and LD_LIBRARY_PATH.<br><b>After setting these environment variables, you need to do</b> <code>sudo ldconfig</code> <b>again</b> for the Linux dynamic library loader to find the just-installed GNU Radio libraries.
 
=== For GNU Radio 3.8 or Earlier ===
For this example, we will start in the home directory; you can, of course, use any directory you wish and the results will be the same.
 
* <code>cd</code>
* <code>git clone https://github.com/gnuradio/gnuradio.git</code>
* <code>cd gnuradio</code>
 
<b>Note:</b> In the following command, change <code>maint-3.8</code> to some other branch or tag if you want to build a different version of GNU Radio; see [https://github.com/gnuradio/gnuradio/tags tags] for tagged releases including pre-releases ("rc"). For  [https://github.com/gnuradio/gnuradio/branches branches], it's generally wise to stick with "master" (the default after cloning), and, currently: <code>maint-3.7</code> or <code>maint-3.8</code>. Here we checkout the <code>maint-3.8</code> branch, which contains the latest 3.8 release plus any fixes or augmentations to it that will be in the next 3.8 release.
 
* <code>git checkout maint-3.8</code>
* <code>git submodule update --init --recursive</code>
* <code>mkdir build</code>
* <code>cd build</code>
 
<b>Note:</b> In the following command, you can use <code>-DCMAKE_INSTALL_PREFIX=XXX</code> to install GNU Radio into the PREFIX <code>XXX</code>; if not specified, then the PREFIX is <code>/usr/local</code>. See other CMake options in [[#Common_cmake_flags|Common cmake flags]].<br>
 
* <code>cmake -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=/usr/bin/python3 ../</code>
* <code>make -j3</code> (e.g. if you want to use 3 CPU cores during the build.  To use 8 do -j8, to use 1 leave out the -j flag.)
* <code>sudo make install</code>
 
If you're running Linux, then always remember to do the following command after installing any library:
* <code>sudo ldconfig</code>
 
Go to [[ModuleNotFoundError#B._Finding_the_Python_library|Finding the Python library]] to set your PYTHONPATH and LD_LIBRARY_PATH.<br><b>After setting these environment variables, you need to do</b> <code>sudo ldconfig</code> <b>again</b> for the Linux dynamic library loader to find the just-installed GNU Radio libraries.
 
==== For Ubuntu 18.04 ====
 
An easy way to install GNU Radio 3.8 on many Ubuntu systems is to use the following commands (note that this skips the setup for UHD hardware):
 
* <code>sudo apt install git cmake g++ libboost-all-dev libgmp-dev swig python3-numpy python3-mako python3-sphinx python3-lxml doxygen libfftw3-dev libsdl1.2-dev libgsl-dev libqwt-qt5-dev libqt5opengl5-dev python3-pyqt5 liblog4cpp5-dev libzmq3-dev python3-yaml python3-click python3-click-plugins python3-zmq python3-scipy python3-pip python3-gi-cairo</code>
* <code>pip3 install git+https://github.com/pyqtgraph/pyqtgraph@develop</code>
* <code>pip3 install numpy scipy</code>
* <code>echo 'export PYTHONPATH=/usr/local/lib/python3/dist-packages:usr/local/lib/python2.7/site-packages:$PYTHONPATH' >> ~/.bashrc</code>
* <code>echo 'export LD_LIBRARY_PATH=/user/local/lib:$LD_LIBRARY_PATH' >> ~/.bashrc</code>
* <code>echo 'export PYTHONPATH=/usr/local/lib/python3/dist-packages:usr/local/lib/python2.7/site-packages:$PYTHONPATH' >> ~/.profile</code>
* <code>echo 'export LD_LIBRARY_PATH=/user/local/lib:$LD_LIBRARY_PATH' >> ~/.profile</code>
* <code>cd ~/</code>
* <code>git clone --recursive https://github.com/gnuradio/gnuradio</code>
* <code>cd gnuradio</code>
* <code>git checkout maint-3.8</code>
* <code>mkdir build</code>
* <code>cd build</code>
* <code>git pull --recurse-submodules=on</code>
* <code>git submodule update --init</code>
* <code>cmake -DENABLE_GR_UHD=OFF ..</code>
* <code>make -j $(nproc --all)</code>
* <code>sudo make install</code>
* <code>sudo ldconfig</code>
 
Once this is done, reboot your computer and GNU Radio should be all set for you.


== Common cmake flags ==
== Platform-specific guides ==


* <code>-DENABLE_GR_XXX=ON</code> This enables (or disables for =OFF) the GNU Radio component named XXX. You might not need all of them, and this way, you can compile quicker.
* [[LinuxInstall|Linux install guide]]
* <code>-DCMAKE_INSTALL_PREFIX=XXX</code> Install your stuff to XXX.
* [[WindowsInstall|Windows install guide]]
* <code>-DCMAKE_BUILD_TYPE=Debug</code> This causes gcc to add debug symbols to all binaries. Useful for debugging (otherwise, it decreases efficiency!)
* [[MacInstall|Mac OS X install guide]]
* <code>-DPYTHON_EXECUTABLE=/usr/bin/python{2,3}</code> This selects the Python version and executable to be used during build time and will determine which Python libraries will be used for building the Python bindings.
<p>For a list of additional cmake flags, as well as minimum versions of dependencies, see [https://www.gnuradio.org/doc/doxygen/build_guide.html]</p>


= Using PyBOMBS =
== Cross-platform guides ==


PyBOMBS is good at building GNU Radio, UHD, and various Out of Tree (OOT) modules from source and then installing into a specified user directory rather than in the system files. PyBOMBS detects the user's Operating System and loads all of the prerequisites in the first stage of the build.
* [[CondaInstall|Conda install guide]]
* [https://github.com/gnuradio/pybombs#pybombs PyBOMBS] - Note: We are no longer including PyBOMBS as a recommended method of installing GNU Radio, unless you want to play around with old versions (e.g. GR 3.7, 3.8, and OOTs of matching version)


The PyBOMBS documentation is in the PyBOMBS [https://github.com/gnuradio/pybombs#pybombs README].
== VMs and Live Images ==
Over the years a number of Live Images and VMs have been created.  There are currently no official versions but here are some current options:
*[https://github.com/bastibl/instant-gnuradio Instant GNU Radio] A customizable, programmatically generated VM and live environment for GNU Radio.
*[[UbuntuVM]] An Ubuntu 20.04 virtual machine image with GNU Radio 3.8.2.0, Fosphor, GQRX, and several other useful pieces of software. (Created using Instant GNU Radio)


= OK, it's installed, what now? =
= OK, it's installed, what now? =

Latest revision as of 22:37, 29 May 2024

Beginner Tutorials

Introducing GNU Radio

  1. What is GNU Radio?
  2. Installing GNU Radio
  3. Your First Flowgraph

Flowgraph Fundamentals

  1. Python Variables in GRC
  2. Variables in Flowgraphs
  3. Runtime Updating Variables
  4. Signal Data Types
  5. Converting Data Types
  6. Packing Bits
  7. Streams and Vectors
  8. Hier Blocks and Parameters

Creating and Modifying Python Blocks

  1. Creating Your First Block
  2. Python Block With Vectors
  3. Python Block Message Passing
  4. Python Block Tags

DSP Blocks

  1. Low Pass Filter Example
  2. Designing Filter Taps
  3. Sample Rate Change
  4. Frequency Shifting
  5. Reading and Writing Binary Files

SDR Hardware

  1. RTL-SDR FM Receiver
  2. B200-B205mini FM Receiver

Quick Start

Platform Method GNU Radio version
Debian.png Debian ≥12
Ubuntu.png Ubuntu ≥22.04
LinuxMint.png Linux Mint ≥21.1
RaspberryPi.pngRaspberry Pi OS64-bit ≥2021-10-30
sudo apt-get install gnuradio
Ubuntu 24.04:
v3.10.9.2
Ubuntu 22.04:
v3.10.1.1
Debian 12:
v3.10.5.1
Fedora.png Fedora ≥39
sudo dnf install gnuradio
Fedora 39:
v3.10.6.0
Fedora 40:
v3.10.9.2
Ubuntu.png Ubuntu 20.04
Consider upgrading your Ubuntu

Ubuntu.png Ubuntu 22.04
sudo add-apt-repository ppa:gnuradio/gnuradio-releases
sudo apt-get update
sudo apt-get install gnuradio python3-packaging
v3.10.7.0
Tux.png Other Linux Distros
sudo {apt,dnf,yay,emerge,…} install gnuradio
See this table
Windows.png Windows

Download and install Radioconda by following the instructions at the link
and launch "GNU Radio Companion" from the Start menu

v3.10.10.0
MacOS.png macOS Download and install Radioconda by following the instructions at the link

Other Installation Methods

Platform-specific guides

Cross-platform guides

  • Conda install guide
  • PyBOMBS - Note: We are no longer including PyBOMBS as a recommended method of installing GNU Radio, unless you want to play around with old versions (e.g. GR 3.7, 3.8, and OOTs of matching version)

VMs and Live Images

Over the years a number of Live Images and VMs have been created. There are currently no official versions but here are some current options:

  • Instant GNU Radio A customizable, programmatically generated VM and live environment for GNU Radio.
  • UbuntuVM An Ubuntu 20.04 virtual machine image with GNU Radio 3.8.2.0, Fosphor, GQRX, and several other useful pieces of software. (Created using Instant GNU Radio)

OK, it's installed, what now?

If the installation worked without any trouble, you're ready to use GNU Radio! If you have no idea how to do that, the best place to start is with the Tutorials.

Optionally, you may run volk_profile on your terminal to help libvolk to determine the optimal kernels (may speed up GNU Radio).