Editing ModuleNotFoundError

Jump to navigation Jump to search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 1: Line 1:
= Module Not Found Error =
When you start gnuradio-companion or execute grcc, if the system isn't configured properly for GRC to find the GNU Radio Python scripts and/or libraries, then you will see an error message similar to this one:

If you get this error message and you're running Linux, try the instructions on this page to see if any of them fix the issue. For issues and settings for OSX, see the [https://wiki.gnuradio.org/index.php/MacInstall#Typical_Errors_and_Warnings MacInstall guide].
These instructions apply to installations for https://wiki.gnuradio.org/index.php/InstallingGR#To_install_system_wide and for https://github.com/gnuradio/pybombs#pybombs

== A. Determine the GNU Radio install prefix ==
When you start gnuradio-companion, if you get this error message:

If you don't know or remember your installation prefix, perform the following step:
*  on a terminal screen, enter <code>gnuradio-config-info --prefix</code>
then use that prefix <b>in place of</b> <code>{your-prefix}</code> in the following commands.
== B. Finding the Python library ==
Using a terminal, enter the following command, substituting the prefix you found above <b>in place of</b> <code>{your-prefix}</code>:
find {your-prefix} -name gnuradio | grep "packages"
Put the appropriate paths it found into the export commands below. Note that the paths are separated by colons <code>: </code>
== C. Setting PYTHONPATH ==
-  For almost all Debian / Ubuntu (and derivative) systems, and most other 32-bit Unix/Linux systems, the paths will look like this:
export PYTHONPATH={your-prefix}/lib/{Py-version}/dist-packages:{your-prefix}/lib/{Py-version}/site-packages:$PYTHONPATH

-  For other 64-bit systems, the paths will look like this:
then put the following 'export' commands in your <code>.bashrc</code> or <code>.bash_aliases</code> file and restart your terminal.<br>
export PYTHONPATH={your-prefix}/lib64/{Py-version}/site-packages:$PYTHONPATH

== D. Setting LD_LIBRARY_PATH ==
== Determine your installation prefix ==
#  on a terminal screen, enter <code>gnuradio-config-info --prefix</code>
#  use that prefix in place of <code>{prefix}</code> in the following commands

-  For almost all Debian / Ubuntu (and derivative) systems, and most other 32-bit Unix/Linux systems, use:
== Linux-based systems including OSX ==
-  For <b>ALL</b> 32-bit systems and <b>ALL</b> Debian / Ubuntu (and derivative) systems, use:
export LD_LIBRARY_PATH={your-prefix}/lib:$LD_LIBRARY_PATH
export PYTHONPATH={prefix}/lib/python3/dist-packages:{prefix}/lib/python3/site-packages:$PYTHONPATH
export LD_LIBRARY_PATH={prefix}/lib:$LD_LIBRARY_PATH

-  For other 64-bit systems, use:
-  For other 64-bit systems, use:
export LD_LIBRARY_PATH={your-prefix}/lib64:$LD_LIBRARY_PATH
export PYTHONPATH={prefix}/lib64/python3/site-packages:$PYTHONPATH
export LD_LIBRARY_PATH={prefix}/lib64:$LD_LIBRARY_PATH
== E. Store the commands in a Bash start-up file ==
Once you have determined the correct two export commands to use, open your text editor and put them in your <code>~/.bash_aliases</code> or <code>~/.bashrc</code> or <code>~/.profile</code> file. Save the file. There are three ways for these changes to take effect.<br>
1. On your terminal enter <code>exit</code>. Then start a new terminal.<br>
2. Type <code>source NAME_OF_FILE_EDITED</code> (e.g. <code>source ~/.profile</code> ).<br>
3. Reboot your computer.<br>
As an example, your entries might be:
export PYTHONPATH=/usr/local/lib/python3/dist-packages:/usr/local/lib/python3.6/dist-packages:$PYTHONPATH
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
== F. Starting GNU Radio from GUI ==
If you get the ModuleNotFoundError error while starting GNU Radio from GUI, but can start GNU Radio using the terminal, it is because the environment variables are set for the terminal, but not for your graphical environment. Try one of the listed solutions below.
1. Store the export commands stated in Part E in <code>~/.profile</code>. Log out and back in for the changes to take effect.<br>
2. Store the export commands stated in Part E in a new shell script (with any name of your choice) in <code>/etc/profile.d/</code>. Restart your computer thereafter.<br>

Please note that all contributions to GNU Radio are considered to be released under the Creative Commons Attribution-ShareAlike (see GNU Radio:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To edit this page, please answer the question that appears below (more info):

Cancel Editing help (opens in new window)