Search code examples
pythonpython-3.xgnuradiortl-sdr

ModuleNotFoundError on GNU Radio right after installation


I am trying to install GNU Radio manually on my Ubuntu 19.10 by following official instructions( https://wiki.gnuradio.org/index.php/InstallingGR)

When I try to run GNU Radio, this error pops up:

Is the python path environment variable set correctly? All OS: PYTHONPATH

Is the library path environment variable set correctly? Linux: LD_LIBRARY_PATH Windows: PATH MacOSX: DYLD_LIBRARY_PATH

No module named 'gnuradio'

I have checked similar posts on this issue on Stackoverflow, but still could not manage to fix.

How can I correctly set variables based on following current parameters?

galib@galib-Lenovo-Y50-70:~$ python --version

Python 3.7.5


galib@galib-Lenovo-Y50-70:~$ echo $PYTHONPATH

:/lib/python3.7/dist-packages


galib@galib-Lenovo-Y50-70:~$ echo $LD_LIBRARY_PATH

/opt/qt/lib:/usr/local/lib::/home/galib/miniconda3/envs/dsp/lib


galib@galib-Lenovo-Y50-70:~$ which python

/usr/bin/python


galib@galib-Lenovo-Y50-70:~$ gnuradio-config-info -v
3.8.1.0
galib@galib-Lenovo-Y50-70:~$ gnuradio-config-info --prefix
/usr/local


galib@galib-Lenovo-Y50-70:~$ find /usr/local -name gnuradio | grep "packages"
/usr/local/lib/python3/dist-packages/gnuradio


galib@galib-Lenovo-Y50-70:~$ whereis python

python: /usr/bin/python3.7 /usr/bin/python3.7-config /usr/bin/python /usr/bin/python2.7-config /usr/bin/python2.7 /usr/bin/python3.7m-config /usr/bin/python3.7m /usr/lib/python3.7 /usr/lib/python3.6 /usr/lib/python3.8 /usr/lib/python2.7 /etc/python3.7 /etc/python /etc/python2.7 /usr/local/lib/python3.7 /usr/local/lib/python2.7 /usr/include/python3.7 /usr/include/python2.7 /usr/include/python3.7m /usr/share/python /usr/share/man/man1/python.1.gz

Solution

  • galib@galib-Lenovo-Y50-70:~$ find /usr/local -name gnuradio | grep "packages"
    /usr/local/lib/python3/dist-packages/gnuradio
    

    You need to add /usr/local/lib/python3/dist-packages to PYTHONPATH environment variable as this directory is not in the default python search paths (sys.path)

    Open a new terminal and execute the following

    export PYTHONPATH=/usr/local/lib/python3/dist-packages:$PYTHONPATH
    gnuradio-companion
    

    to make this change permanent you can add the export line to ~/.profile file. See also Module Not Found Error.