Question

I have followed instructions out lined here:

http://forums.nuand.com/forums/viewtopic.php?f=9&t=2804

and installed GNU Radio from GIT repo (scroll down to the section that says "Building GNURADIO from GIT". I used the ./build-gnuradio.sh script to do this and it took a while, but it appeared to build successfully, as per the instructions.

I am running on Ubuntu 12.04 LTS.

When I attempt to run the "./uhd_fft" function I get the following error message:

Traceback (most recent call last):
  File "./uhd_fft", line 23, in <module>
    from gnuradio import gr, gru
ImportError: No module named gnuradio

I have Googled this error message and most of the forums claim there is a problem with the PYTHONPATH.

When I do

echo $PYTHONPATH
/usr/bin/python2.7

But when I check the python2.7 directory I do not see gnuradio. So I guess it makes sense I'm getting an import error when it tries to import gnuradio. But the bigger question is why?

I installed GNU Radio (per instructions from nuand forum) using ./build-gnuradio.sh script. So I should have it installed.

I would appreciate if it python / GNU Radio experts from the community could weigh in.

Was it helpful?

Solution

There is a section later in the instructions with this boldface label:

Now for some voodoo to get the new program installed into system libraries and python paths and executable path.

Those instructions lead you through modifying your PYTHONPATH to pick up the gnuradio module, among other things. If you have followed those instructions, you will have to start a new shell to see any effect, or execute the .sh file by hand, since profile scripts only run when a new shell starts up or when they're run manually.

OTHER TIPS

One of the reason for this error is, when the default python is selected incorrectly. To see which python is selected type the following command in the Terminal:

      "sudo port select python"

it will display all the python available on your mac. like:

    python26

    python27-apple(Active)

    python27

For Gnuradio you need python27,if other python is active like in the example above you can change it by the following command:

    "sudo port select python python27" 

Now RUN your python code,it should work.If python27 is already active you may consider changing the path manually as suggested by others

Try this once the PATH variables have been set.

ln -sf /usr/lib/x86_64-linux-gnu/libvolk.so.1.3.1 /usr/lib/x86_64-linux-gnu/libvolk.so.1.3

On OSX 10.12.3 (16D32) this worked for me:

export PATH=/opt/local/bin:$PATH

python
> import gnuradio

For me python at the prompt was using Mac's python instead of the one in /opt/local/bin/python

The link you have provided also mentioned that you might need to add dist-packages and site-packages.

The following command solved the issue for me:

export export PYTHONPATH=/usr/local/lib/python3/dist-packages:/usr/local/lib/python3.6/dist-packages:\
/usr/local/lib/python3/site-packages:/usr/local/lib/python3.6/site-packages:$PYTHONPATH
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top