ImportError: No module named gnuradio

Hi All ,
I have just installed gnuradio and it was successful. But when i tried
to run the gnuradio-examples, i get the error message ‘ImportError: No
module named gnuradio’. I have changed the PYTHONPATH to the directory
where python is installed but it is not working. I have installed
gnuradio in a different folder i.e. /usr/Nett/users/fass/gnuradio
whereas the python directory is /usr/lib/python2.5/site-packages. Could
that be a problem ?
Here is the error …
[email protected]:~$ export PYTHONPATH=/usr/lib/python2.5/site-packages
[email protected]:~/gnuradio/gnuradio-examples/python/network$
./dial_tone_source.py
Traceback (most recent call last):
File “./dial_tone_source.py”, line 23, in
from gnuradio import gr
ImportError: No module named gnuradio

Regards,

Fasika

What distribution are you running?

  • George

I am using Ubuntu 7.10.

Hi,

When you installed gnuradio, did you do “sudo make install” ?

Firas

Fasika A. wrote:

http://lists.gnu.org/mailman/listinfo/discuss-gnuradio


View this message in context:
http://www.nabble.com/ImportError%3A-No-module-named-gnuradio-tp14215656p14235736.html
Sent from the GnuRadio mailing list archive at Nabble.com.

I am using a 64 bit machine and I have build the gnuradio from the
directory /usr/Nett/users/fass/gnuradio. There is a folder lib64 in
/usr directory but it doesnt contain the python packages.

and in the python sys.path is

path
[’’, ‘/usr/lib/python25.zip’, ‘/usr/lib/python2.5’,
‘/usr/lib/python2.5/plat-linux2’, ‘/usr/lib/python2.5/lib-tk’,
‘/usr/lib/python2.5/lib-dynload’,
‘/usr/local/lib/python2.5/site-packages’,
‘/usr/lib/python2.5/site-packages’,
‘/usr/lib/python2.5/site-packages/Numeric’,
‘/usr/lib/python2.5/site-packages/gst-0.10’,
‘/var/lib/python-support/python2.5’,
‘/usr/lib/python2.5/site-packages/gtk-2.0’,
‘/var/lib/python-support/python2.5/gtk-2.0’,
‘/usr/lib/python2.5/site-packages/wx-2.6-gtk2-unicode’]

[email protected]:~$ export PYTHONPATH=/usr/lib/python2.5/site-packages
[email protected]:~$ ls -lR $PYTHONPATH/gnuradio/gr
ls: /gnuradio/gr: No such file or directory
[email protected]:~$

Best ,

Fasika

Eric B. [email protected] wrote: On Fri, Dec 07, 2007 at 08:20:14AM
-0800, Fasika A. wrote:

Hi All ,

I have just installed gnuradio and it was successful. But when i
tried to run the gnuradio-examples, i get the error message
‘ImportError: No module named gnuradio’. I have changed the
PYTHONPATH to the directory where python is installed but it is not
working. I have installed gnuradio in a different folder
i.e. /usr/Nett/users/fass/gnuradio whereas the python directory is
/usr/lib/python2.5/site-packages. Could that be a problem ?

Regards,

Fasika

You need to set PYTHONPATH to reflect the prefix you used during
configuration (default /usr/local). What --prefix did you use?

Did you build from /usr/Nett/users/fass/gnuradio or did you install
into there?

Are you running on a 64-bit machine? If so your python path needs to
contain lib64, not lib.

If you type this command, do you get similar output?

$ ls -lR $PYTHONPATH/gnuradio/gr


/usr/local/lib/python2.5/site-packages/gnuradio/gr:
total 10332
-rw-r--r-- 1 eb wheel    9924 2007-11-29 11:51 basic_flow_graph.py
-rw-rw-r-- 1 eb wheel   12064 2007-11-29 11:51 basic_flow_graph.pyc
-rw-rw-r-- 1 eb wheel   12064 2007-11-29 11:51 basic_flow_graph.pyo
-rw-r--r-- 1 eb wheel     922 2007-11-29 11:51 exceptions.py
-rw-rw-r-- 1 eb wheel     648 2007-11-29 11:51 exceptions.pyc
-rw-rw-r-- 1 eb wheel     648 2007-11-29 11:51 exceptions.pyo
-rw-r--r-- 1 eb wheel    8376 2007-11-29 11:51 flow_graph.py
-rw-rw-r-- 1 eb wheel    8535 2007-11-29 11:51 flow_graph.pyc
-rw-rw-r-- 1 eb wheel    8535 2007-11-29 11:51 flow_graph.pyo
-rwxr-xr-x 1 eb wheel     995 2007-11-29 14:41 

_gnuradio_swig_py_filter.la
-rw-r–r-- 1 eb wheel 142581 2007-11-29 14:41
gnuradio_swig_py_filter.py
-rw-rw-r-- 1 eb wheel 234609 2007-11-29 14:41
gnuradio_swig_py_filter.pyc
-rw-rw-r-- 1 eb wheel 234609 2007-11-29 14:41
gnuradio_swig_py_filter.pyo
-rwxr-xr-x 1 eb wheel 769545 2007-11-29 14:41
_gnuradio_swig_py_filter.so
-rwxr-xr-x 1 eb wheel 1001 2007-11-29 14:41
_gnuradio_swig_py_general.la
-rw-r–r-- 1 eb wheel 415785 2007-11-29 14:41
gnuradio_swig_py_general.py
-rw-rw-r-- 1 eb wheel 696121 2007-11-29 14:41
gnuradio_swig_py_general.pyc
-rw-rw-r-- 1 eb wheel 696121 2007-11-29 14:41
gnuradio_swig_py_general.pyo
-rwxr-xr-x 1 eb wheel 2201772 2007-11-29 14:41
_gnuradio_swig_py_general.so
-rwxr-xr-x 1 eb wheel 995 2007-11-29 14:41
_gnuradio_swig_py_gengen.la
-rw-r–r-- 1 eb wheel 330184 2007-11-29 14:41
gnuradio_swig_py_gengen.py
-rw-rw-r-- 1 eb wheel 565143 2007-11-29 14:41
gnuradio_swig_py_gengen.pyc
-rw-rw-r-- 1 eb wheel 565143 2007-11-29 14:41
gnuradio_swig_py_gengen.pyo
-rwxr-xr-x 1 eb wheel 1732939 2007-11-29 14:41
_gnuradio_swig_py_gengen.so
-rwxr-xr-x 1 eb wheel 971 2007-11-29 14:41
_gnuradio_swig_py_io.la
-rw-r–r-- 1 eb wheel 45656 2007-11-29 14:41
gnuradio_swig_py_io.py
-rw-rw-r-- 1 eb wheel 79230 2007-11-29 14:41
gnuradio_swig_py_io.pyc
-rw-rw-r-- 1 eb wheel 79230 2007-11-29 14:41
gnuradio_swig_py_io.pyo
-rwxr-xr-x 1 eb wheel 259571 2007-11-29 14:41
_gnuradio_swig_py_io.so
-rwxr-xr-x 1 eb wheel 1001 2007-11-29 14:41
_gnuradio_swig_py_runtime.la
-rw-r–r-- 1 eb wheel 66203 2007-11-29 14:41
gnuradio_swig_py_runtime.py
-rw-rw-r-- 1 eb wheel 111334 2007-11-29 14:41
gnuradio_swig_py_runtime.pyc
-rw-rw-r-- 1 eb wheel 111334 2007-11-29 14:41
gnuradio_swig_py_runtime.pyo
-rw-r–r-- 1 eb wheel 1028 2007-11-29 14:41
gnuradio_swig_python.py
-rw-rw-r-- 1 eb wheel 373 2007-11-29 14:41
gnuradio_swig_python.pyc
-rw-rw-r-- 1 eb wheel 373 2007-11-29 14:41
gnuradio_swig_python.pyo
-rw-r–r-- 1 eb wheel 21922 2007-11-29 11:51 gr_threading_23.py
-rw-rw-r-- 1 eb wheel 26881 2007-11-29 11:51 gr_threading_23.pyc
-rw-rw-r-- 1 eb wheel 24171 2007-11-29 11:51 gr_threading_23.pyo
-rw-r–r-- 1 eb wheel 25507 2007-11-29 11:51 gr_threading_24.py
-rw-rw-r-- 1 eb wheel 27705 2007-11-29 11:51 gr_threading_24.pyc
-rw-rw-r-- 1 eb wheel 24995 2007-11-29 11:51 gr_threading_24.pyo
-rw-r–r-- 1 eb wheel 1225 2007-11-29 11:51 gr_threading.py
-rw-rw-r-- 1 eb wheel 430 2007-11-29 11:51 gr_threading.pyc
-rw-rw-r-- 1 eb wheel 430 2007-11-29 11:51 gr_threading.pyo
-rw-r–r-- 1 eb wheel 3340 2007-11-29 11:51 hier_block2.py
-rw-rw-r-- 1 eb wheel 3197 2007-11-29 11:51 hier_block2.pyc
-rw-rw-r-- 1 eb wheel 3197 2007-11-29 11:51 hier_block2.pyo
-rw-r–r-- 1 eb wheel 4330 2007-11-29 11:51 hier_block.py
-rw-rw-r-- 1 eb wheel 5309 2007-11-29 11:51 hier_block.pyc
-rw-rw-r-- 1 eb wheel 5309 2007-11-29 11:51 hier_block.pyo
-rw-r–r-- 1 eb wheel 1367 2007-11-29 11:51 init.py
-rw-rw-r-- 1 eb wheel 510 2007-11-29 11:51 init.pyc
-rw-rw-r-- 1 eb wheel 510 2007-11-29 11:51 init.pyo
-rw-r–r-- 1 eb wheel 3818 2007-11-29 11:51 prefs.py
-rw-rw-r-- 1 eb wheel 4407 2007-11-29 11:51 prefs.pyc
-rw-rw-r-- 1 eb wheel 4407 2007-11-29 11:51 prefs.pyo
-rw-r–r-- 1 eb wheel 2332 2007-11-29 11:51 scheduler.py
-rw-rw-r-- 1 eb wheel 2471 2007-11-29 11:51 scheduler.pyc
-rw-rw-r-- 1 eb wheel 2471 2007-11-29 11:51 scheduler.pyo
-rw-r–r-- 1 eb wheel 3893 2007-11-29 11:51 top_block.py
-rw-rw-r-- 1 eb wheel 3949 2007-11-29 11:51 top_block.pyc
-rw-rw-r-- 1 eb wheel 3949 2007-11-29 11:51 top_block.pyo

Eric

On Fri, Dec 07, 2007 at 08:20:14AM -0800, Fasika A. wrote:

Hi All ,

I have just installed gnuradio and it was successful. But when i
tried to run the gnuradio-examples, i get the error message
‘ImportError: No module named gnuradio’. I have changed the
PYTHONPATH to the directory where python is installed but it is not
working. I have installed gnuradio in a different folder
i.e. /usr/Nett/users/fass/gnuradio whereas the python directory is
/usr/lib/python2.5/site-packages. Could that be a problem ?

Regards,

Fasika

You need to set PYTHONPATH to reflect the prefix you used during
configuration (default /usr/local). What --prefix did you use?

Did you build from /usr/Nett/users/fass/gnuradio or did you install
into there?

Are you running on a 64-bit machine? If so your python path needs to
contain lib64, not lib.

If you type this command, do you get similar output?

$ ls -lR $PYTHONPATH/gnuradio/gr


/usr/local/lib/python2.5/site-packages/gnuradio/gr:
total 10332
-rw-r--r-- 1 eb wheel    9924 2007-11-29 11:51 basic_flow_graph.py
-rw-rw-r-- 1 eb wheel   12064 2007-11-29 11:51 basic_flow_graph.pyc
-rw-rw-r-- 1 eb wheel   12064 2007-11-29 11:51 basic_flow_graph.pyo
-rw-r--r-- 1 eb wheel     922 2007-11-29 11:51 exceptions.py
-rw-rw-r-- 1 eb wheel     648 2007-11-29 11:51 exceptions.pyc
-rw-rw-r-- 1 eb wheel     648 2007-11-29 11:51 exceptions.pyo
-rw-r--r-- 1 eb wheel    8376 2007-11-29 11:51 flow_graph.py
-rw-rw-r-- 1 eb wheel    8535 2007-11-29 11:51 flow_graph.pyc
-rw-rw-r-- 1 eb wheel    8535 2007-11-29 11:51 flow_graph.pyo
-rwxr-xr-x 1 eb wheel     995 2007-11-29 14:41 

_gnuradio_swig_py_filter.la
-rw-r–r-- 1 eb wheel 142581 2007-11-29 14:41
gnuradio_swig_py_filter.py
-rw-rw-r-- 1 eb wheel 234609 2007-11-29 14:41
gnuradio_swig_py_filter.pyc
-rw-rw-r-- 1 eb wheel 234609 2007-11-29 14:41
gnuradio_swig_py_filter.pyo
-rwxr-xr-x 1 eb wheel 769545 2007-11-29 14:41
_gnuradio_swig_py_filter.so
-rwxr-xr-x 1 eb wheel 1001 2007-11-29 14:41
_gnuradio_swig_py_general.la
-rw-r–r-- 1 eb wheel 415785 2007-11-29 14:41
gnuradio_swig_py_general.py
-rw-rw-r-- 1 eb wheel 696121 2007-11-29 14:41
gnuradio_swig_py_general.pyc
-rw-rw-r-- 1 eb wheel 696121 2007-11-29 14:41
gnuradio_swig_py_general.pyo
-rwxr-xr-x 1 eb wheel 2201772 2007-11-29 14:41
_gnuradio_swig_py_general.so
-rwxr-xr-x 1 eb wheel 995 2007-11-29 14:41
_gnuradio_swig_py_gengen.la
-rw-r–r-- 1 eb wheel 330184 2007-11-29 14:41
gnuradio_swig_py_gengen.py
-rw-rw-r-- 1 eb wheel 565143 2007-11-29 14:41
gnuradio_swig_py_gengen.pyc
-rw-rw-r-- 1 eb wheel 565143 2007-11-29 14:41
gnuradio_swig_py_gengen.pyo
-rwxr-xr-x 1 eb wheel 1732939 2007-11-29 14:41
_gnuradio_swig_py_gengen.so
-rwxr-xr-x 1 eb wheel 971 2007-11-29 14:41
_gnuradio_swig_py_io.la
-rw-r–r-- 1 eb wheel 45656 2007-11-29 14:41
gnuradio_swig_py_io.py
-rw-rw-r-- 1 eb wheel 79230 2007-11-29 14:41
gnuradio_swig_py_io.pyc
-rw-rw-r-- 1 eb wheel 79230 2007-11-29 14:41
gnuradio_swig_py_io.pyo
-rwxr-xr-x 1 eb wheel 259571 2007-11-29 14:41
_gnuradio_swig_py_io.so
-rwxr-xr-x 1 eb wheel 1001 2007-11-29 14:41
_gnuradio_swig_py_runtime.la
-rw-r–r-- 1 eb wheel 66203 2007-11-29 14:41
gnuradio_swig_py_runtime.py
-rw-rw-r-- 1 eb wheel 111334 2007-11-29 14:41
gnuradio_swig_py_runtime.pyc
-rw-rw-r-- 1 eb wheel 111334 2007-11-29 14:41
gnuradio_swig_py_runtime.pyo
-rw-r–r-- 1 eb wheel 1028 2007-11-29 14:41
gnuradio_swig_python.py
-rw-rw-r-- 1 eb wheel 373 2007-11-29 14:41
gnuradio_swig_python.pyc
-rw-rw-r-- 1 eb wheel 373 2007-11-29 14:41
gnuradio_swig_python.pyo
-rw-r–r-- 1 eb wheel 21922 2007-11-29 11:51 gr_threading_23.py
-rw-rw-r-- 1 eb wheel 26881 2007-11-29 11:51 gr_threading_23.pyc
-rw-rw-r-- 1 eb wheel 24171 2007-11-29 11:51 gr_threading_23.pyo
-rw-r–r-- 1 eb wheel 25507 2007-11-29 11:51 gr_threading_24.py
-rw-rw-r-- 1 eb wheel 27705 2007-11-29 11:51 gr_threading_24.pyc
-rw-rw-r-- 1 eb wheel 24995 2007-11-29 11:51 gr_threading_24.pyo
-rw-r–r-- 1 eb wheel 1225 2007-11-29 11:51 gr_threading.py
-rw-rw-r-- 1 eb wheel 430 2007-11-29 11:51 gr_threading.pyc
-rw-rw-r-- 1 eb wheel 430 2007-11-29 11:51 gr_threading.pyo
-rw-r–r-- 1 eb wheel 3340 2007-11-29 11:51 hier_block2.py
-rw-rw-r-- 1 eb wheel 3197 2007-11-29 11:51 hier_block2.pyc
-rw-rw-r-- 1 eb wheel 3197 2007-11-29 11:51 hier_block2.pyo
-rw-r–r-- 1 eb wheel 4330 2007-11-29 11:51 hier_block.py
-rw-rw-r-- 1 eb wheel 5309 2007-11-29 11:51 hier_block.pyc
-rw-rw-r-- 1 eb wheel 5309 2007-11-29 11:51 hier_block.pyo
-rw-r–r-- 1 eb wheel 1367 2007-11-29 11:51 init.py
-rw-rw-r-- 1 eb wheel 510 2007-11-29 11:51 init.pyc
-rw-rw-r-- 1 eb wheel 510 2007-11-29 11:51 init.pyo
-rw-r–r-- 1 eb wheel 3818 2007-11-29 11:51 prefs.py
-rw-rw-r-- 1 eb wheel 4407 2007-11-29 11:51 prefs.pyc
-rw-rw-r-- 1 eb wheel 4407 2007-11-29 11:51 prefs.pyo
-rw-r–r-- 1 eb wheel 2332 2007-11-29 11:51 scheduler.py
-rw-rw-r-- 1 eb wheel 2471 2007-11-29 11:51 scheduler.pyc
-rw-rw-r-- 1 eb wheel 2471 2007-11-29 11:51 scheduler.pyo
-rw-r–r-- 1 eb wheel 3893 2007-11-29 11:51 top_block.py
-rw-rw-r-- 1 eb wheel 3949 2007-11-29 11:51 top_block.pyc
-rw-rw-r-- 1 eb wheel 3949 2007-11-29 11:51 top_block.pyo

Eric

Hi Eric,

I also have got a similar situation. We are building a software defined
radio using GNU radio. We have a receiver front end to test and analyze
the performance of Wireless sensor nodes at 2.5GHz. The module is
similar with USRP but we are studying the differences inorder to
integrate the hardware with the gnuradio. I would really appreciate if I
can find any documentation about the details of the signal transfer
to/from the usrp and the usrp itself so that we can see the difference
between the USRP and our hardware.

Best ,
Fasika

On Mon, Dec 10, 2007 at 01:51:16AM -0800, Fasika A. wrote:

I am using a 64 bit machine and I have build the gnuradio from the directory /usr/Nett/users/fass/gnuradio. There is a folder lib64 in /usr directory but it doesnt contain the python packages.

and in the python sys.path is

path
[’’, ‘/usr/lib/python25.zip’, ‘/usr/lib/python2.5’, ‘/usr/lib/python2.5/plat-linux2’, ‘/usr/lib/python2.5/lib-tk’, ‘/usr/lib/python2.5/lib-dynload’, ‘/usr/local/lib/python2.5/site-packages’, ‘/usr/lib/python2.5/site-packages’, ‘/usr/lib/python2.5/site-packages/Numeric’, ‘/usr/lib/python2.5/site-packages/gst-0.10’, ‘/var/lib/python-support/python2.5’, ‘/usr/lib/python2.5/site-packages/gtk-2.0’, ‘/var/lib/python-support/python2.5/gtk-2.0’, ‘/usr/lib/python2.5/site-packages/wx-2.6-gtk2-unicode’]

[email protected]:~$ export PYTHONPATH=/usr/lib/python2.5/site-packages
[email protected]:~$ ls -lR $PYTHONPATH/gnuradio/gr
ls: /gnuradio/gr: No such file or directory
[email protected]:~$

Have you looked in /usr/local/lib64/python2.5/site-packages ?

On my 64-bit machine, that’s what I set PYTHONPATH to.

Eric

On Mon, Dec 10, 2007 at 01:28:38PM -0800, Fasika A. wrote:

Best ,
Fasika

There is no documentation outside of that in the code on this.

However, it’s pretty straight-forward. We talk to the USRP using 3
USB end points. EP0, the control endpoint, is used to load FX2
firmware and the FPGA .rbf file, low-level control of the
daughterboards, setting control registers in the FPGA, and other misc
operations. The list of operations and the arguments is in
usrp/firmware/include/usrp_commands.h

Received samples are sent from the FPGA via the FX2 over endpoint 6
using USB bulk transfers. Each USB packet is 512 bytes long, and the
data in each packet is interleaved 16-bit little-endian I & Q pairs.
I.e., I0, Q0, I1, Q1,…

Transmit samples are sent in the same format over endpoint 2 using
USB bulk tranfers.

The schematics of the USRP are available as PDFs and gscheme source
here: http://gnuradio.org/trac/browser/usrp-hw/trunk/USRP_REV_4_2

Eric

On Thu, Dec 13, 2007 at 12:48:24AM -0800, Fasika A. wrote:

Thanks for the reply ,

Fasika
Unless you device is identical to the USRP and uses exactly the same
FX2 code and FPGA RBF’s, you’ll probably have to do some work.

Have you looked at the source code for the host side of the interface
to the USRP? usrp/host/lib/legacy/*.{h,cc}

Do you have a specific question? “How do I get my new hardware that’s
sort of like a usrp to work with gnuradio” is a bit open ended.

Eric

Thanks for the reply ,

The connection of the hardware( lets say hw) with the radio is as usrp
does. Received samples are sent from the FPGA via the FX2 over endpoint
6 using USB bulk transfers. Endpoint 2 is not yet used since we are
testing the receiver only. The A/D or VCO are configured by the
FPGA(Spartan-3E-500) for the 2402 MHz channel @ 48 MHz sampling. The
decimation is 12x so the data from EP6 is 4 Ms/sec, each sample is 16
bit I and 16 bit Q as with the USRP. ad9863, fx2lp are used in the hw.

My question is whether i can use the gnuradio with some simple
modifications like the vendor id,device id and prodcut id for the hw,
seen by the gnuradio as usrp.

Best ,

Fasika
Eric B. [email protected] wrote: On Thu, Dec 13, 2007 at 12:48:24AM
-0800, Fasika A. wrote:

Thanks for the reply ,

Fasika
Unless you device is identical to the USRP and uses exactly the same
FX2 code and FPGA RBF’s, you’ll probably have to do some work.

Have you looked at the source code for the host side of the interface
to the USRP? usrp/host/lib/legacy/*.{h,cc}

Do you have a specific question? “How do I get my new hardware that’s
sort of like a usrp to work with gnuradio” is a bit open ended.

Eric

Thanks for the reply ,

The receiver front end is similar with the usrp. The data transfer to
and from the hardware using the usb endpoints is similar with that of
the usrp that you mentioned. But the problem is when i tried to contact
the hardware , the response is that there is “failed to find usrp[0]”.
The product id and the vendor id of the usrp and our hardware are
different. How can I solve this problem ? I read on the forum that I
should add the device and vendor id to the list in usrp_ids.h and get
the usrp developers to acknowledge it.

Best ,

Fasika

Eric B. [email protected] wrote: On Mon, Dec 10, 2007 at 01:28:38PM
-0800, Fasika A. wrote:

Best ,
Fasika

There is no documentation outside of that in the code on this.

However, it’s pretty straight-forward. We talk to the USRP using 3
USB end points. EP0, the control endpoint, is used to load FX2
firmware and the FPGA .rbf file, low-level control of the
daughterboards, setting control registers in the FPGA, and other misc
operations. The list of operations and the arguments is in
usrp/firmware/include/usrp_commands.h

Received samples are sent from the FPGA via the FX2 over endpoint 6
using USB bulk transfers. Each USB packet is 512 bytes long, and the
data in each packet is interleaved 16-bit little-endian I & Q pairs.
I.e., I0, Q0, I1, Q1,…

Transmit samples are sent in the same format over endpoint 2 using
USB bulk tranfers.

The schematics of the USRP are available as PDFs and gscheme source
here: http://gnuradio.org/trac/browser/usrp-hw/trunk/USRP_REV_4_2

Eric

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs