# No module named v20.ardupilotmega

**URL:** <https://discuss.bluerobotics.com/t/no-module-named-v20-ardupilotmega/12783>\
**Category:** Companion (Retired)\
**Created:** [August 20, 2022, 4:35am UTC](https://discuss.bluerobotics.com/t/no-module-named-v20-ardupilotmega/12783 "2022-08-20T04:35:16Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tautala](https://avatars.discourse-cdn.com/v4/letter/t/8c91f0/32.png) [@Tautala](https://discuss.bluerobotics.com/u/Tautala)\
**Post date:** [August 20, 2022, 4:35am UTC](https://discuss.bluerobotics.com/t/no-module-named-v20-ardupilotmega/12783/1 "2022-08-20T04:35:16Z")

</div>

I added my own mavlink messages. I ran

- pip uninstall pymavlink
- python setup.py install --user

That created/populated **~/.local/lib/python2.7/site-packages/pymavlink-2.3.7-py2.7-linux-armv7l.egg/pymavlink/dialects/v20** with **ardupilotmega.py** etc

It’s the same location as on my other linux machine where I test things.

when I run

```auto
mavproxy.py --master=/dev/autopilot,115200 --load-module='GPSInput,DepthOutput' --source-system=200 --cmd='set heartbeat 0' --cmd='param forceload /home/pi/companion/params/serial0.param' --logfile=/temp/telemetry.tlog --out udpin:localhost:9000 --out udpin:0.0.0.0:14660 --out udpcast:192.168.2.255:14550 --mav20 --streamrate 10 --default-modules=output,param

```

I get the following

```auto
Traceback (most recent call last):
  File "/usr/local/bin/mavproxy.py", line 4, in <module>
    __import__ ('pkg_resources').run_script('MAVProxy==1.6.1', 'mavproxy.py')
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 534, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1445, in run_script
    exec(script_code, namespace, namespace)
  File "/usr/local/lib/python2.7/dist-packages/MAVProxy-1.6.1-py2.7.egg/EGG-INFO/scripts/mavproxy.py", line 972, in <module>
    
  File "/home/pi/.local/lib/python2.7/site-packages/pymavlink-2.3.7-py2.7-linux-armv7l.egg/pymavlink/mavutil.py", line 110, in <module>
    set_dialect(os.environ['MAVLINK_DIALECT'])
  File "/home/pi/.local/lib/python2.7/site-packages/pymavlink-2.3.7-py2.7-linux-armv7l.egg/pymavlink/mavutil.py", line 102, in set_dialect
    mod = __import__ (modname)
ImportError: No module named v20.ardupilotmega

```

everything in pymavlink/dialects/v10 and pymavlink/dialects/v20 look fine.

Any clue?

Thanks

---

<div class="post-metadata">

**Author:** ![EliotBR](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/eliotbr/32/6937_2.png) [@EliotBR](https://discuss.bluerobotics.com/u/EliotBR)\
**Post date:** [August 22, 2022, 8:43am UTC](https://discuss.bluerobotics.com/t/no-module-named-v20-ardupilotmega/12783/2 "2022-08-22T08:43:48Z")

</div>

Hi @Tautala,

I haven’t personally created custom MAVLink messages before, but from a read of ArduPilot’s [Adding a New MAVLink Message](https://ardupilot.org/dev/docs/code-overview-adding-a-new-mavlink-message.html) docs my main thoughts/ideas are

1. Does it work to send and/or receive your custom message with plain Pymavlink, or even just import Pymavlink and receive some arbitrary messages from your vehicle?
2. Are you sure your message definition(s) use valid xml (e.g. is pymavlink able to build the ardupilotmega.py file successfully)?
3. Is it worth trying to update / re-install mavproxy?
4. Have you tried creating a mavproxy module, like discussed near the bottom of those docs?

If none of those are helpful I’d recommend asking for further advice from the general ArduPilot folks (via [their forum](https://discuss.ardupilot.org/tags/c/ground-control-software/mavlink/116/pymavlink) or [their discord](https://ardupilot.org/discord)), since they’re the primary Pymavlink and MAVProxy developers 🙂

---

<div class="post-metadata">

**Author:** ![Tautala](https://avatars.discourse-cdn.com/v4/letter/t/8c91f0/32.png) [@Tautala](https://discuss.bluerobotics.com/u/Tautala)\
**Post date:** [August 24, 2022, 11:21pm UTC](https://discuss.bluerobotics.com/t/no-module-named-v20-ardupilotmega/12783/3 "2022-08-24T23:21:44Z")

</div>

I appreciate the reply but my stuff works on other machines. I have a development virtual machine that has no problem. Everything worked just fine on our previous Pi before we went to blue OS on the companion.

---

<div class="post-metadata">

**Author:** ![EliotBR](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/eliotbr/32/6937_2.png) [@EliotBR](https://discuss.bluerobotics.com/u/EliotBR)\
**Post date:** [August 25, 2022, 9:21am UTC](https://discuss.bluerobotics.com/t/no-module-named-v20-ardupilotmega/12783/4 "2022-08-25T09:21:46Z")

</div>

Aha, I wasn’t aware you were using BlueOS on your onboard computer because the post was tagged as Companion (which I’ve now adjusted).

I’ll ask the software team if they have particular ideas, but it’s worth noting that

- BlueOS does not use mavproxy (it uses [mavlink-router](https://github.com/bluerobotics/BlueOS-docker/blob/1.0.1/core/tools/mavlink_router/bootstrap.sh#L8)), which may cause some resource fighting if you’re trying to use mavproxy at the same time
- The containerised nature of BlueOS means that installations you make in the main container (without using `red-pill` to operate on the pi itself, if you’re using the web terminal) will not be persistent across boots / container restarts
- Where pymavlink is used in BlueOS it’s using Python 3.9, so there may be additional strangeness going on if it’s also been installed for Python 2.7 (although that would generally be an issue with pymavlink’s convenience scripts overwriting each other, rather than when using the library directly).

So we can better understand (and potentially try to reproduce) your situation, can you specify

1. Your BlueOS version
2. How you’re accessing BlueOS
3. Where you’re running your `pip` commands

---

<div class="post-metadata">

**Author:** ![Tautala](https://avatars.discourse-cdn.com/v4/letter/t/8c91f0/32.png) [@Tautala](https://discuss.bluerobotics.com/u/Tautala)\
**Post date:** [August 25, 2022, 8:06pm UTC](https://discuss.bluerobotics.com/t/no-module-named-v20-ardupilotmega/12783/5 "2022-08-25T20:06:02Z")

</div>

I’ll make sure I get the right tag from now on, sorry for the miscommunication. In **dialects/v20** there is no ` __init__.py`. I would think that this would be created automatically since the entire tree below `~/.local/lib/python2.7/site-packages` is created by `python setup.py install --user`.

I created an empty ` __init__.py` and it works.

Two other installations did not have this problem.

> [@EliotBR](#):
>
> 1. Your BlueOS version
> 2. How you’re accessing BlueOS
> 3. Where you’re running your `pip` commands

1. uname -a shows  
`Linux raspberrypi 4.9.24-v7+ #993 SMP Wed Apr 26 18:01:23 BST 2017 armv7i GNU/Linu`x

The page at 192.168.2.2:2770 says **Companion Version 0.0.31**

1. I was using a terminal from 192.168.2.2:8088 but installed VNC and a desktop because I wanted to run emacs and other apps.

2. I don’t understand.

`192.168.2.2:2770/system` shows `mavproxy` as an active service. `ps -ef | grep mav` doesn’t show `mavlink-routerd` running.

For future reference, where are the **docs for mavlink-routerd**? Also, any pointers to Docker info (and red-pill?) as it applies to BlueOS?

Mahalo for taking the time to try to help me @EliotBR

---

<div class="post-metadata">

**Author:** ![EliotBR](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/eliotbr/32/6937_2.png) [@EliotBR](https://discuss.bluerobotics.com/u/EliotBR)\
**Post date:** [August 26, 2022, 6:41am UTC](https://discuss.bluerobotics.com/t/no-module-named-v20-ardupilotmega/12783/6 "2022-08-26T06:41:26Z")

</div>

> [@Tautala](#):
>
> I created an empty ` __init__.py` and it works.

Does this mean you managed to resolve your issue, and what remains is just confusion as to why that solution was necessary?

> [@Tautala](#):
>
> The page at 192.168.2.2:2770 says **Companion Version 0.0.31**

Haha, ok, you are in fact using our previous “Companion software” then (which is no longer being developed), not the new [BlueOS](https://discuss.bluerobotics.com/t/blueos-official-release/12024). I’ve changed the topic back, and the points in my previous comment do not apply.

> [@Tautala](#):
>
> For future reference, where are the **docs for mavlink-routerd**?

I’m not sure if there are any outside of the README of [the repository](https://github.com/patrickelectric/mavlink-router). From a quick look, the upstream repository does seem to have a more extensive README, but I’m unsure whether the additions are documentation of functionality that is present in both, or documentation of new features that are not currently in the repository BlueOS is using.

I believe we’re currently looking at changing to something else, because we’re wanting better performance and some additional features than it provides, even though it’s already quite a bit more performant (and less CPU-heavy) than mavproxy.

> [@Tautala](#):
>
> Also, any pointers to Docker info … as it applies to BlueOS?

We do not yet have introductory developer documentation for BlueOS, which is partly because we’re in the process of creating an [extensions system](https://discuss.bluerobotics.com/t/external-integrations-extensions/10912) that will mean most external development will be in separate containers rather than BlueOS core. You can learn about docker itself on [the official website](https://www.docker.com), but we will also be making some high level overview documentation about how docker and containerisation are related to and used in BlueOS, as well as some example extensions.

> [@Tautala](#):
>
> and red-pill?

[`red-pill`](https://github.com/bluerobotics/BlueOS-docker/blob/master/core/tools/scripts/red-pill) is a shell script in BlueOS that allows a terminal user to drop from inside the core docker container into the underlying operating system, which is the home of persistent file storage (for logs and the like), and lower level functionality (enabling features like restarting the core container without having to restart the Raspberry Pi itself).

The name is a reference to The Matrix, where the main character can choose to take a blue pill to stay in the controlled dream land of the matrix (our core Docker container), or take the red pill to be pulled out of the matrix and get to see the real world for what it is.

---

<div class="post-metadata">

**Author:** ![Tautala](https://avatars.discourse-cdn.com/v4/letter/t/8c91f0/32.png) [@Tautala](https://discuss.bluerobotics.com/u/Tautala)\
**Post date:** [August 26, 2022, 7:47pm UTC](https://discuss.bluerobotics.com/t/no-module-named-v20-ardupilotmega/12783/7 "2022-08-26T19:47:10Z")

</div>

Yes, my problem is resolved. The mystery of why no ` __init__.py` remains but life would be boring if there wasn’t a little mystery in it, right?

You’ve been a great help. Mahalo

I look forward to the new release.
