After Ubuntu Upgrade: No module named 'weewxd' for service weewx start

70 views
Skip to first unread message

Greg

unread,
Jan 7, 2026, 1:47:02 PM (3 days ago) Jan 7
to weewx-user
Hi, I'm getting an error when the service starts after upgrading to Ubuntu 24:

Jan 07 11:25:33 htpctemp weewxd[32126]:   File "/usr/local/bin/weewxd", line 5, in <module>
Jan 07 11:25:33 htpctemp weewxd[32126]:     from weewxd import main
Jan 07 11:25:33 htpctemp weewxd[32126]: ModuleNotFoundError: No module named 'weewxd'
Jan 07 11:25:33 htpctemp systemd[1]: weewx.service: Main process exited, code=exited, status=1/FAILURE
Jan 07 11:25:33 htpctemp systemd[1]: weewx.service: Failed with result 'exit-code'.


Any ideas? Did find anything searching via Google.

Thanks, Greg

Vince Skahan

unread,
Jan 7, 2026, 1:51:57 PM (3 days ago) Jan 7
to weewx-user
Need much more info.

Quick guess is your very unusual path of /usr/local/bin is where to start looking.

Greg

unread,
Jan 7, 2026, 2:18:27 PM (3 days ago) Jan 7
to weewx-user


I can run it on the command line "python3 /usr/share/weewx/weewxd.py"

I guess it is a path issue. 

Seems like the Linux service calls: /usr/local/bin/weewxd to start the service.

Which is trying to do an import of main from weewxd  ie line #5: "from weewxd import main"

I guess it can't find weewxd?

Is there a better way to start it as a service?





Vince Skahan

unread,
Jan 7, 2026, 2:26:03 PM (3 days ago) Jan 7
to weewx-user
If you refuse to actually describe your very unusual setup, you're not going to get a lot of help here too quickly.....

Greg

unread,
Jan 7, 2026, 3:39:48 PM (3 days ago) Jan 7
to weewx-user
Sorry, I didn't think it was a unusual setup. I used the installer apt in Ubuntu 20,. "apt install weewx" I thought that was the standard way to install? 
I updated to Ubuntu 22 and then 24 today when I now get that error. It's weewx version 5.2.0-1. I'm using a  Ecowitt gateway, driver = user.gw1000. It has been working fine for a while until the Ubuntu update.
It's Python 3.12.3. 
Static IP for the server. 

"weectl diag" gives me an error:

Traceback (most recent call last):
  File "/usr/local/bin/weectl", line 5, in <module>
    from weectl import main
ModuleNotFoundError: No module named 'weectl'


Thanks

Tom Keffer

unread,
Jan 7, 2026, 4:08:15 PM (3 days ago) Jan 7
to weewx...@googlegroups.com
In a Debian package install, the shims weewxd and weectl are shell scripts that are normally installed into /usr/bin. The files weewxd.py and weectl.py are Python code and are normally installed in /usr/share/weewx. The shell scripts load the Python scripts.

Your instance /usr/local/bin/weectl seems to be a Python script that is trying to import the main module. That's the way the pip install works, not the Debian install.

I suspect that you somehow got a pip install and a Debian package install scrambled together. You'll have to look around the usual places to figure out how to unscramble them. 

From the limited information, that's all I can come up with.

-tk



--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/weewx-user/f757f702-5bba-4ac1-9e9a-df16877401cen%40googlegroups.com.

Vince Skahan

unread,
Jan 7, 2026, 4:30:50 PM (3 days ago) Jan 7
to weewx-user
Agree.

Check to verify that you have a dpkg installation installed - it should look like this:

$ dpkg -l weewx
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version      Architecture Description
+++-==============-============-============-=================================
ii  weewx          5.2.0-1      all          weather software

And check to see what's where:

vagrant@weewx-dpkg:~$ ls -al /usr/bin/wee* /usr/local/bin/wee*
ls: cannot access '/usr/local/bin/wee*': No such file or directory
-rwxr-xr-x 1 root root 313 Oct  6 01:16  /usr/bin/weectl
-rwxr-xr-x 1 root root 313 Oct  6 01:16  /usr/bin/weewxd


Regardless, /usr/local/bin is definitely very very odd.

If you have stuff in both places for some reason, /usr/local/bin is going to win because that comes first in your $PATH.
vagrant@weewx-dpkg:~$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games


If so, you might try "/usr/bin/weectl" and "/usr/bin/weewxd" and give the full pathname to see if it magically works as a quick test.  That might help verify your dpkg installation (if one is there) is ok.

If you have both a dpkg and some old/other installation and you want to use the dpkg one:
  • at a minimum rename the wee* stuff in /usr/local/bin (so it's not found)
  • verify the contents of your weewx.service file 
    • which should be in /usr/lib/systemd/system 
    • and it should point to your weewx.conf in /etc/weewx
  • if the service file is messed up, the template to copy from is in /etc/weewx/systemd
  • and "sudo systemctl daemon-reload" if you mess with systemd service files
There is a more remote possibility that you might even have two weewx.service files installed.  The dpkg installs under /usr but you might have more old cruft under /etc which will take precedence unfortunately.  I've seen this happen to me ages ago with running some upgrade scenarios.   A clean dpkg installation would look like:

vagrant@weewx-dpkg:~$ ls -al /usr/lib/systemd/system/wee*service /etc/systemd/system/wee*
ls: cannot access '/etc/systemd/system/wee*': No such file or directory
-rw-r--r-- 1 root root 424 Jan  7 20:43  /usr/lib/systemd/system/weewx.service
-rw-r--r-- 1 root root 932 Jan  7 20:43  /usr/lib/systemd/system/weewx@.service

But if you have two installations in different places you'll have to pick one and clean up the other...

Greg

unread,
Jan 7, 2026, 5:10:48 PM (3 days ago) Jan 7
to weewx-user


I wonder when I first installed it years ago, I might have tried the pip method. I think I had issues (it would crash randomly) and found it via the Linux package installer and it worked fine so I must have I forgotten about it.  
I renamed those 2 files and put in the full path in the weewx.service file and it started OK. I guess that's OK to do that? Will there be issues with an update later? 

Is it OK/better to use the dpkg to install weewx vs pip?

Thanks for the help!

# dpkg -l weewx
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version      Architecture Description
+++-==============-============-============-=================================
ii  weewx          5.2.0-1      all          weather software


Vince Skahan

unread,
Jan 7, 2026, 5:30:54 PM (3 days ago) Jan 7
to weewx-user
You are good to go if you want to stick with the dpkg. Upgrades should be fine.

You probably didn’t need to put in the full pathname after renaming the /usr/local files but it won’t hurt anything. I guess clean the old junk out if you want, just so it doesn’t confuse you later, but if it works you could just let it stick there unused.

John Smith

unread,
Jan 7, 2026, 6:41:27 PM (3 days ago) Jan 7
to weewx...@googlegroups.com
I guess that's OK to do that?

Not on Debian based systems as dpkg/apt notice the missing files and may not attempt to install future versions of them.

Vince Skahan

unread,
Jan 7, 2026, 6:48:46 PM (3 days ago) Jan 7
to weewx-user
No, he’s cleaning up old junk ‘not’ controlled by dpkg and is not deleting anything that is dpkg controlled.

John Smith

unread,
Jan 7, 2026, 7:06:52 PM (3 days ago) Jan 7
to weewx...@googlegroups.com
Yes, and he said he did that after installing a package via dpkg...

--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.

Greg

unread,
Jan 7, 2026, 7:24:47 PM (3 days ago) Jan 7
to weewx-user
Those files renamed were from a pip install.  And I added the full path to the weewx.service file which I guess is OK. I have a couple of Spring Java applications that I wrote and run as services and I used full paths to the jar and JVM and work OK. I'm not familiar with python applications. 

John Smith

unread,
Jan 7, 2026, 7:55:43 PM (3 days ago) Jan 7
to weewx...@googlegroups.com
 I'm not familiar with python applications.
  
In terms of launching them from a command line it's not that different than bash scripts, still has a she bang at the top which then handles the rest of the file from there.

Reply all
Reply to author
Forward
0 new messages