ImportError: cannot import name blks2

Somewhat a NOOB to Python, USRP, GNURadio… and needing some help.

I am getting the error (below) when I try to execute a Python xxx.py
progam…
ImportError: cannot import name blks2

Here is what I am trying to do. I am trying to run an installed OSMOCOM
radio program xxx.py

With examination… in the OSMOCOM xxx.py file… line #17 is trying to
import a number of GNUradio and Python packages.

Line #17 looks like:
from gnuradio import gr, gru, eng_notation, blks2, optfir

I am running Ubuntu 14.04…
I have done the following…

  1. Installed the latest 3.7x GNUradio package
  2. I want to run with a N210 USRP SDR… Installed the UHD driver from
    Ettus.com
    (http://ettus-apps.sourcerepo.com/redmine/ettus/projects/uhd/wiki)
  3. Downloaded OSMOCOM code and built it from GitHub.

After a while of Googling for answers… I have wound up here to post
for help.

From previous threads out on the internet, I feel like I just have a
Python import problem… and really not a GNUradio, OSMOCOM, or USRP
problem. So I am not going to go list specifics at this time on the
***.py file and GNUradio specifiics…

From other threads my guess is that the problem lies in that I was
missing a $PYTHONPATH env variable.

The BLKS2 module is located in my
/usr/lib/python2.7/dist-packages/grc_gnuradio directory.

I tried adding this $PYTHONPATH env variable, and to point to the
specific directory… but the error still occurs.

I do have other Python versions on the Linux machine, but no other env
variable points to another version of Python.

Would I have a Python install problem? However it is a fresh load of
Ubuntu… so I would think this would have installed correctly in the
default load of the OS.

Should my $PYTHONPATH env variable contain more paths that just:

PYTHONPATH=/usr/lib/python2.7/dist-packages
                  or
PYTHONPATH=/usr/lib/python2.7/dist-packages/grc_gnuradio/blks2

Any help would be greatly appreciated!! Thanks in advance.

-kenhokie

Hi Ken,

It looks as though your message went down a black hole because it was
sent via the ruby-forum.com website and not the GNU Radio mailing list
at http://gnuradio.org/redmine/projects/gnuradio/wiki/MailingLists .

The message is not in the official GNU Radio mailing list archive so was
never sent to the actual list:

http://lists.gnu.org/archive/html/discuss-gnuradio/2014-07/index.html

I came across your post as I was getting the same error as you and
Googled it. I have just modified uhd-tetra_demod.py and cqpsk.py to
make the uhd version work and the commit is available in the branch
called ‘gr_3.7.4_compatibility’:

https://github.com/m0mik/osmo-tetra/tree/gr_3.7.4_compatibility

List of files changed:

https://github.com/m0mik/osmo-tetra/commit/5429a1e3abf3e5c1aeadc0253169233faee46cc8

Mike

Ken Smith wrote in post #1151491:

Somewhat a NOOB to Python, USRP, GNURadio… and needing some help.

I am getting the error (below) when I try to execute a Python xxx.py
progam…
ImportError: cannot import name blks2

Here is what I am trying to do. I am trying to run an installed OSMOCOM
radio program xxx.py

With examination… in the OSMOCOM xxx.py file… line #17 is trying to
import a number of GNUradio and Python packages.

Line #17 looks like:
from gnuradio import gr, gru, eng_notation, blks2, optfir

I am running Ubuntu 14.04…
I have done the following…

  1. Installed the latest 3.7x GNUradio package
  2. I want to run with a N210 USRP SDR… Installed the UHD driver from
    Ettus.com
    (http://ettus-apps.sourcerepo.com/redmine/ettus/projects/uhd/wiki)
  3. Downloaded OSMOCOM code and built it from GitHub.

After a while of Googling for answers… I have wound up here to post
for help.

From previous threads out on the internet, I feel like I just have a
Python import problem… and really not a GNUradio, OSMOCOM, or USRP
problem. So I am not going to go list specifics at this time on the
***.py file and GNUradio specifiics…

From other threads my guess is that the problem lies in that I was
missing a $PYTHONPATH env variable.

The BLKS2 module is located in my
/usr/lib/python2.7/dist-packages/grc_gnuradio directory.

I tried adding this $PYTHONPATH env variable, and to point to the
specific directory… but the error still occurs.

I do have other Python versions on the Linux machine, but no other env
variable points to another version of Python.

Would I have a Python install problem? However it is a fresh load of
Ubuntu… so I would think this would have installed correctly in the
default load of the OS.

Should my $PYTHONPATH env variable contain more paths that just:

PYTHONPATH=/usr/lib/python2.7/dist-packages
                  or
PYTHONPATH=/usr/lib/python2.7/dist-packages/grc_gnuradio/blks2

Any help would be greatly appreciated!! Thanks in advance.

-kenhokie