ModuleNotFoundError: Difference between revisions

From GNU Radio
Jump to navigation Jump to search
(add MacOSX / macOS section)
(revise Finding the Python library and Store the commands)
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
These instructions apply to installations for [[InstallingGR#To_install_system_wide|To install system wide]] and for [https://github.com/gnuradio/pybombs#pybombs PyBOMBS]
__NOTOC__
 
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:
When you start gnuradio-companion, if you get this, or a similar, error message:  
<br><br>
 
[[File:ModNotFound.png|300px]]
[[File:ModNotFound.png|300px]]
<br><br>


then put the following 'export' commands in your <code>~/.bashrc</code> or <code>~/.profile</code> or <code>~/.bash_aliases</code> file and restart your terminal.<br>
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].


= Determine your installation prefix =
== A. Determine the GNU Radio install prefix ==


If you don't know or remember your installation prefix, perform the following step:
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>
*  on a terminal screen, enter <code>gnuradio-config-info --prefix</code>
then use that prefix in place of <code>{prefix}</code> in the following commands
then use that prefix <b>in place of</b> <code>{your-prefix}</code> in the following commands.


= Linux-based systems =
== B. Finding the Python library ==
-  For <b>ALL</b> 32-bit systems and <b>ALL</b> Debian / Ubuntu (and derivative) systems, use:
 
Using a terminal, enter the following command, substituting the prefix you found above <b>in place of</b> <code>{your-prefix}</code>:
<pre>
<pre>
export PYTHONPATH={prefix}/lib/python3/dist-packages:{prefix}/lib/python3/site-packages:$PYTHONPATH
find {your-prefix} -name gnuradio | grep "packages"
export LD_LIBRARY_PATH={prefix}/lib:$LD_LIBRARY_PATH
</pre>
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:
<pre>
export PYTHONPATH={your-prefix}/lib/{Py-version}/dist-packages:{your-prefix}/lib/{Py-version}/site-packages:$PYTHONPATH
</pre>
 
-  For other 64-bit systems, the paths will look like this:
<pre>
export PYTHONPATH={your-prefix}/lib64/{Py-version}/site-packages:$PYTHONPATH
</pre>
 
== D. Setting LD_LIBRARY_PATH ==
 
-  For almost all Debian / Ubuntu (and derivative) systems, and most other 32-bit Unix/Linux systems, use:
<pre>
export LD_LIBRARY_PATH={your-prefix}/lib:$LD_LIBRARY_PATH
</pre>
</pre>


-  For other 64-bit systems, use:
-  For other 64-bit systems, use:
<pre>
<pre>
export PYTHONPATH={prefix}/lib64/python3/site-packages:$PYTHONPATH
export LD_LIBRARY_PATH={your-prefix}/lib64:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH={prefix}/lib64:$LD_LIBRARY_PATH
</pre>
</pre>


= MacOSX / macOS =
== E. Store the commands in a Bash start-up file ==
On MacOSX / macOS, the library search path is set primarily by the environment variable DYLD_LIBRARY_PATH. Because of the way the OSX dynamic library loader works, this variable works differently than on Linux. It's primary purpose is in finding libraries in a local path, such as when testing software before installing it, or inside an application. <b>We strongly recommend against setting this variable globally.</b>
 
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. On your terminal enter <code>exit</code>. Then start a new terminal.<br>
As an example, your entries might be:
<pre>
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
</pre>

Revision as of 17:43, 14 February 2020

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:

ModNotFound.png

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 MacInstall guide.

A. Determine the GNU Radio install prefix

If you don't know or remember your installation prefix, perform the following step:

  • on a terminal screen, enter gnuradio-config-info --prefix

then use that prefix in place of {your-prefix} in the following commands.

B. Finding the Python library

Using a terminal, enter the following command, substituting the prefix you found above in place of {your-prefix}:

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 :

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:

export PYTHONPATH={your-prefix}/lib64/{Py-version}/site-packages:$PYTHONPATH

D. Setting LD_LIBRARY_PATH

- For almost all Debian / Ubuntu (and derivative) systems, and most other 32-bit Unix/Linux systems, use:

export LD_LIBRARY_PATH={your-prefix}/lib:$LD_LIBRARY_PATH

- For other 64-bit systems, use:

export LD_LIBRARY_PATH={your-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 ~/.bash_aliases or ~/.bashrc or ~/.profile file. Save the file. On your terminal enter exit. Then start a new terminal.
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