# ImportError: No module named

**URL:** <https://www.ruby-forum.com/t/importerror-no-module-named/231136>\
**Category:** GNU Radio\
**Created:** [July 23, 2014, 1:36pm UTC](https://www.ruby-forum.com/t/importerror-no-module-named/231136 "2014-07-23T13:36:31Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![addis\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c4cdca/32.png) [@addis\_a](https://www.ruby-forum.com/u/addis_a)\
**Post date:** [July 23, 2014, 1:36pm UTC](https://www.ruby-forum.com/t/importerror-no-module-named/231136/1 "2014-07-23T13:36:31Z")

</div>

Hi all,

I have created a new module called Tool\_NetworkCoding. During the  
installation, I did not get any error message, everything went well. But  
when I run a grc file to test some blocks inside this new module, it  
turned  
out an error message:

_Traceback (most recent call last): File  
“/home/van-ly/Downloads/top\_block.py”, line 16, in import  
Tool\_NetworkCodingImportError: No module named Tool\_NetworkCoding_

Please help me with this.  
Thank you in advance  
Van-Ly

Nguyen Van-Ly,  
Vietnam National University, Hanoi - VNU  
University of Engineering and Technology - UET  
Faculty of Electronics and Telecommunications - FET

Tel: +84 978 819 406

Standing on my own two feet !!!

---

<div class="post-metadata">

**Author:** ![NguySSSn\_VSSn\_LS\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/9fc29f/32.png) [@NguySSSn\_VSSn\_LS\_S](https://www.ruby-forum.com/u/NguySSSn_VSSn_LS_S)\
**Post date:** [July 23, 2014, 1:49pm UTC](https://www.ruby-forum.com/t/importerror-no-module-named/231136/2 "2014-07-23T13:49:36Z")

</div>

Hi Van-Ly,

if you installed everything correctly, Python should be able to find the  
module.  
You can verify this by looking at the install\_manifest.txt in your OOT’s  
build/ directory, in which there should be an entry for every file it  
copied.  
Find your python files (there always should be an **init**.py) and check  
if the target location is part of your $PYTHONPATH.

Greetings,  
Marcus

---

<div class="post-metadata">

**Author:** ![NguySSSn\_VSSn\_LS\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/9fc29f/32.png) [@NguySSSn\_VSSn\_LS\_S](https://www.ruby-forum.com/u/NguySSSn_VSSn_LS_S)\
**Post date:** [July 23, 2014, 4:33pm UTC](https://www.ruby-forum.com/t/importerror-no-module-named/231136/3 "2014-07-23T16:33:58Z")

</div>

Hi Marcus,

I’ve gotten a surprising thing and I couldn’t explain why.  
First, I type: sudo gnuradio-companion to open the GNUradio and test my  
own  
module. It turned out an error message as I described in the previous  
mail.  
(ImportError: No module named Tool\_NetworkCoding)  
However, when I just type: gnuradio-companion and also run the same grc  
file, the error message disappeared, and everything then seems to go  
well.  
So, is there any difference between _sudo gnuradio-companion_ and  
_gnuradio-companion_ ?

Thank you very much  
Van-Ly

Nguyen Van-Ly,  
Vietnam National University, Hanoi - VNU  
University of Engineering and Technology - UET  
Faculty of Electronics and Telecommunications - FET

Tel: +84 978 819 406

On Wed, Jul 23, 2014 at 6:47 PM, Marcus Müller  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![NguySSSn\_VSSn\_LS\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/9fc29f/32.png) [@NguySSSn\_VSSn\_LS\_S](https://www.ruby-forum.com/u/NguySSSn_VSSn_LS_S)\
**Post date:** [July 23, 2014, 4:41pm UTC](https://www.ruby-forum.com/t/importerror-no-module-named/231136/4 "2014-07-23T16:41:56Z")

</div>

On Wed, Jul 23, 2014 at 10:32 AM, Nguyễn Văn Lý  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Thank you very much  
> Van-Ly

Yes. Using sudo, you’re running as root with root’s environment that  
usually doesn’t know about things in /usr/local (PATH, PYTHONPATH,  
LD\_LIBRARY\_PATH, etc.). You should not be running gnuradio-companion as  
root, anyways. No need to sudo everything!

Tom

---

<div class="post-metadata">

**Author:** ![NguySSSn\_VSSn\_LS\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/9fc29f/32.png) [@NguySSSn\_VSSn\_LS\_S](https://www.ruby-forum.com/u/NguySSSn_VSSn_LS_S)\
**Post date:** [July 23, 2014, 4:44pm UTC](https://www.ruby-forum.com/t/importerror-no-module-named/231136/5 "2014-07-23T16:44:49Z")

</div>

Hi Van-Ly,

So, is there any difference between _sudo gnuradio-companion_ and  
_gnuradio-companion_ ?

Yes, the “sudo” part 😉  
sudo is used to make a program run under a different user, and in a  
different environment. For example, sudo gnuradio-companion runs  
gnuradio-companion as root. Why did you do that?

But that doesn’t set the PYTHONPATH environment, so python can’t find  
the modules you installed to your local python package prefix.

Greetings,  
Marcus

---

<div class="post-metadata">

**Author:** ![NguySSSn\_VSSn\_LS\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/9fc29f/32.png) [@NguySSSn\_VSSn\_LS\_S](https://www.ruby-forum.com/u/NguySSSn_VSSn_LS_S)\
**Post date:** [July 23, 2014, 4:52pm UTC](https://www.ruby-forum.com/t/importerror-no-module-named/231136/6 "2014-07-23T16:52:48Z")

</div>

Thanks Tom and Marcus,

So it’s not necessary to run sudo gnuradio-companion at all 🙂

Van-Ly  
p/s: I am new to almost everything that I’m working with, from ubuntu to  
gnuradio 🙂 just glad to talk to you 🙂

Nguyen Van-Ly,  
Vietnam National University, Hanoi - VNU  
University of Engineering and Technology - UET  
Faculty of Electronics and Telecommunications - FET

Tel: +84 978 819 406

On Wed, Jul 23, 2014 at 9:43 PM, Marcus Müller  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![NguySSSn\_VSSn\_LS\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/9fc29f/32.png) [@NguySSSn\_VSSn\_LS\_S](https://www.ruby-forum.com/u/NguySSSn_VSSn_LS_S)\
**Post date:** [July 23, 2014, 5:00pm UTC](https://www.ruby-forum.com/t/importerror-no-module-named/231136/7 "2014-07-23T17:00:05Z")

</div>

Glad to have you here, too!

Just a word of advice: this is not a linux support channel. We really  
like being helpful, so it’s ok to ask things related to GNU Radio and  
the system it runs on, but if you want linux help, you might want to go  
online in IRC and join the #ubuntu channel on [irc.freenode.org](http://irc.freenode.org) , using  
either a desktop client of your choice (e.g. Pidgin) or the web client  
at [http://webchat.freenode.net/](http://webchat.freenode.net/)

Greetings,  
Marcus

---

<div class="post-metadata">

**Author:** ![NguySSSn\_VSSn\_LS\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/9fc29f/32.png) [@NguySSSn\_VSSn\_LS\_S](https://www.ruby-forum.com/u/NguySSSn_VSSn_LS_S)\
**Post date:** [July 23, 2014, 5:05pm UTC](https://www.ruby-forum.com/t/importerror-no-module-named/231136/8 "2014-07-23T17:05:08Z")

</div>

Thanks a lot Marcus 🙂

Nguyen Van-Ly,  
Vietnam National University, Hanoi - VNU  
University of Engineering and Technology - UET  
Faculty of Electronics and Telecommunications - FET

Tel: +84 978 819 406

On Wed, Jul 23, 2014 at 9:58 PM, Marcus Müller  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
