"ImportError no module named gnuradio" when trying to execute ./uhd_fft

user1068636 picture user1068636 · Aug 9, 2013 · Viewed 17.6k times · Source

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.

Answer

Mark R. Wilkins picture Mark R. Wilkins · Aug 9, 2013

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.