ModuleNotFoundError: No module named 'contact.__main__' #71

Closed
opened 2026-10-05 03:19:22 +02:00 by adam · 9 comments
Owner

I’m pretty sure it’s not a contact issue but an issue driven by my pool knowledge of python.
I had been running contact on a RPi 2 for quite some time and it all worked great until yesterday when I’ve decided to update it from 3.14 to 3.14.1
It started giving me errors about “match” and I’ve found out that “match” requires python 3.10 minimum (I was running 3.9 on my raspbian installation)
So I’ve downloaded and compiled Python 3.14 and I’ve set it as the default one via “alternatives”.
Then I’ve reinstalled contact with pip and now when I start it it gives me this error:
Traceback (most recent call last):
File "/home/radio/.local/bin/contact", line 3, in
from contact.main import main
ModuleNotFoundError: No module named 'contact.main'

Do you know what am I doing wrong?
Thank you.

I’m pretty sure it’s not a contact issue but an issue driven by my pool knowledge of python. I had been running contact on a RPi 2 for quite some time and it all worked great until yesterday when I’ve decided to update it from 3.14 to 3.14.1 It started giving me errors about “match” and I’ve found out that “match” requires python 3.10 minimum (I was running 3.9 on my raspbian installation) So I’ve downloaded and compiled Python 3.14 and I’ve set it as the default one via “alternatives”. Then I’ve reinstalled contact with pip and now when I start it it gives me this error: Traceback (most recent call last): File "/home/radio/.local/bin/contact", line 3, in <module> from contact.__main__ import main ModuleNotFoundError: No module named 'contact.__main__' Do you know what am I doing wrong? Thank you. <!-- github-sync-id:3506759402 -->
adam closed this issue 2026-10-05 03:19:22 +02:00
Author
Owner

hmm, maybe you've installed the package in a version of python that isn't the one that trying to run it? Are you running in a virtual environment? I'd try so if not.

python3 -m venv venv
source venv/bin/activate
pip install contact
contact
hmm, maybe you've installed the package in a version of python that isn't the one that trying to run it? Are you running in a virtual environment? I'd try so if not. ```bash python3 -m venv venv source venv/bin/activate pip install contact contact ``` <!-- github-comment-id:3395869636 -->
Author
Owner

thank you, I've tried but to no avail :(

(venv) radio@pi2radio:~ $ contact
Traceback (most recent call last):
  File "/home/radio/venv/bin/contact", line 3, in <module>
    from contact.__main__ import main
ModuleNotFoundError: No module named 'contact.__main__'
thank you, I've tried but to no avail :( ``` (venv) radio@pi2radio:~ $ contact Traceback (most recent call last): File "/home/radio/venv/bin/contact", line 3, in <module> from contact.__main__ import main ModuleNotFoundError: No module named 'contact.__main__' ``` <!-- github-comment-id:3396068065 -->
Author
Owner

I'm a little baffled. I wonder if there is a previous install of contact that is trying to run?
you could try which contact to check if there's a preferred install outside the venv.

I'm a little baffled. I wonder if there is a previous install of contact that is trying to run? you could try `which contact` to check if there's a preferred install outside the venv. <!-- github-comment-id:3397641383 -->
Author
Owner

This is from outside the venv: /home/radio/.local/bin/contact
And this is from inside the venv: /home/radio/venv/bin/contact
Apparently is launching the one in the venv as expected.
Oh man, if it wasn’t that this raspberry pi is up in the attic and it’s not that easy to access it I’d have it already formatted and reinstalled with the newest and latest release of raspbian or how they call it nowadays.
I could try maybe to run it from another user.

This is from outside the venv: /home/radio/.local/bin/contact And this is from inside the venv: /home/radio/venv/bin/contact Apparently is launching the one in the venv as expected. Oh man, if it wasn’t that this raspberry pi is up in the attic and it’s not that easy to access it I’d have it already formatted and reinstalled with the newest and latest release of raspbian or how they call it nowadays. I could try maybe to run it from another user. <!-- github-comment-id:3398406237 -->
Author
Owner

Same error from another user with a fresh local installation of contact.
I’m afraid I have to go up in the attic and take care of the reinstallation of the OS.

Same error from another user with a fresh local installation of contact. I’m afraid I have to go up in the attic and take care of the reinstallation of the OS. <!-- github-comment-id:3398462735 -->
Author
Owner

I've reinstalled the OS on the pi via PINN (lovely piece of software) and now I have python 3.13 from the official raspberry repositories.
then I've installed contact in the venv but it still doesn't work:

(venv) radio@raspberrypi:~ $ contact
Fatal error: 'NoneType' object has no attribute 'localNode'
Traceback (most recent call last):
File "/home/radio/venv/lib/python3.13/site-packages/contact/__main__.py", line 131, in start
curses.wrapper(main)
~~~~~~~~~~~~~~^^^^^^
File "/usr/lib/python3.13/curses/__init__.py", line 94, in wrapper
return func(stdscr, *args, **kwds)
File "/home/radio/venv/lib/python3.13/site-packages/contact/__main__.py", line 100, in main
if interface_state.interface.localNode.localConfig.lora.region == 0:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'localNode'

what's going on?

I've reinstalled the OS on the pi via PINN (lovely piece of software) and now I have python 3.13 from the official raspberry repositories. then I've installed contact in the venv but it still doesn't work: > (venv) radio@raspberrypi:~ $ contact Fatal error: 'NoneType' object has no attribute 'localNode' Traceback (most recent call last): File "/home/radio/venv/lib/python3.13/site-packages/contact/__main__.py", line 131, in start curses.wrapper(main) ~~~~~~~~~~~~~~^^^^^^ File "/usr/lib/python3.13/curses/__init__.py", line 94, in wrapper return func(stdscr, *args, **kwds) File "/home/radio/venv/lib/python3.13/site-packages/contact/__main__.py", line 100, in main if interface_state.interface.localNode.localConfig.lora.region == 0: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'localNode' what's going on? <!-- github-comment-id:3410422879 -->
Author
Owner

That error generally means it can't connect to the node. Either there isn't one connected, or the node's client API is in use by another connection.

Try any API command like mehstastic --info and you'll likely get an error in this situation.

That error generally means it can't connect to the node. Either there isn't one connected, or the node's client API is in use by another connection. Try any API command like `mehstastic --info` and you'll likely get an error in this situation. <!-- github-comment-id:3410868985 -->
Author
Owner

yeah, I've forgot to add my user to the dialout group.
now when I run mehstastic --info or when I start contact it freezes the ssh connection and makes the raspberry reboot after 5 minutes or so.
I'm afraid I have to go up in the attic and check what's wrong or maybe replace the raspberry, anyway it's not a contact issue.
thank you for your assistance.

yeah, I've forgot to add my user to the dialout group. now when I run `mehstastic --info` or when I start contact it freezes the ssh connection and makes the raspberry reboot after 5 minutes or so. I'm afraid I have to go up in the attic and check what's wrong or maybe replace the raspberry, anyway it's not a contact issue. thank you for your assistance. <!-- github-comment-id:3410933506 -->
Author
Owner

No problem, closing this issue for now. Holler if there's anything else!

No problem, closing this issue for now. Holler if there's anything else! <!-- github-comment-id:3411459417 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/contact#71