weedb.OperationalError: no such function: RADIANS

209 views
Skip to first unread message

kac...@gmail.com

unread,
Oct 27, 2022, 5:10:01 AM10/27/22
to weewx-user
I upgraded to Weewx version 4.9.1 and now I'm seeing this error in logs:
weedb.OperationalError: no such function: RADIANS

I read some words in the latest topic in this group, but I don't understand what should I do. 
Any idea what is wrong?

A great kudos to authors of Weewx.

Tom Keffer

unread,
Oct 27, 2022, 7:37:05 AM10/27/22
to weewx...@googlegroups.com
Two things:

1. What do you get if you run this:

python -c "import sqlite3;print(sqlite3.sqlite_version)"

2. Post the log through the first reporting cycle. See the wiki article Posting to weewx-user for how to get a good log.


--
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 on the web visit https://groups.google.com/d/msgid/weewx-user/f43883c8-fbf7-4f22-86d9-c38595bb6b83n%40googlegroups.com.

Raffaello Galli

unread,
Oct 27, 2022, 7:38:18 AM10/27/22
to weewx...@googlegroups.com
Upgrading to 4.9.1 worked.

Thanks,
Raffaello

________
Raffaello Galli  
Direct: 917.683.1780  
Email:  raffael...@gmail.com





kac...@gmail.com

unread,
Oct 28, 2022, 12:47:58 AM10/28/22
to weewx-user
I don't see an error in today's log. Yesterday I upgraded to 4.9.1. As Raffaello said, maybe this was problem only in 4.9.0?

James Taylor

unread,
Oct 28, 2022, 5:13:39 AM10/28/22
to weewx-user
Correct.   V4.9.1 was released on the 25 October to cover the issue.

4.9.110/25/2022
Fix problem with `wind` for older versions of sqlite.

James

kac...@gmail.com

unread,
Oct 28, 2022, 5:34:56 AM10/28/22
to weewx-user
Tnx. I didn't know that this is connected :-)

Chris Nelson

unread,
Nov 24, 2022, 2:25:39 PM11/24/22
to weewx-user
Hum...  I still have the problem.  I've read the Version 4.9.0 available and  weedb.OperationalError: no such function: RADIANS threads, and the issue was to be fixed in 4.9.1.  I had updated from 4.8.0 to 4.9.1 on Nov 11 and have the problem since then.  Hints please.  Thank you.

The report generator seems to crash when generating the Month page.  Day and Week pages update as expected.  It appears that weewx is still trying to use the RADIANS function in sqlite3.

I'm on Centos 7 with weewx running the official (ancient) Python3 install, and running via systemd.

$ yum info weewx
...
Installed Packages
Name : weewx
Arch : noarch
Version : 4.9.1
Release : 1.el7
Size : 5.5 M
Repo : installed
From repo : weewx
Summary : weather software
URL : http://www.weewx.com

The webpage displays
About this station

Hardware

AcuRite 01035

Latitude

33° 16.92' N

Longitude

111° 44.39' W

Altitude

1285 feet

Server uptime

0 days, 0 hours, 28 minutes

WeeWX uptime

0 days, 0 hours, 28 minutes

WeeWX version

4.9.1

Skin

Seasons 4.9.1

The systemd unit file has...
[Service]
ExecStart=/usr/bin/python3 /usr/share/weewx/weewxd --daemon --pidfile=/var/run/weewx.pid /etc/weewx/weewx.conf

Python3 (ancient) version...
$ python3 -V
Python 3.6.8

The sqlite3 version is (ancient) per the base os...
$ python3 -c "import sqlite3; print(sqlite3.sqlite_version)"
3.7.17

Attached is the log...
weewx-mylog

Tom Keffer

unread,
Nov 24, 2022, 2:42:07 PM11/24/22
to weewx...@googlegroups.com
I've had the same problem on the Mac. Apparently, there are modern sqlite3 libraries out there that were not compiled with the DSQLITE_ENABLE_MATH_FUNCTIONS option.

To test, run this:

python -c "import sqlite3; sqlite3.connect(':memory:').execute('SELECT RADIANS(1.0)')"

If you get the error

sqlite3.OperationalError: no such function: RADIANS

then your library was not compiled with the flag.

I've changed to code to explicitly test for the math functions rather than rely on a version number. Replace your copy of weedb/sqlite.py (usually found in /usr/share/weewx/weedb/sqlite.py) with this one.






--
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.

Chris Nelson

unread,
Nov 24, 2022, 10:48:12 PM11/24/22
to weewx-user
Thanks Tom.

As you suspected...

$ python -c "import sqlite3; sqlite3.connect(':memory:').execute('SELECT RADIANS(1.0)')"
Traceback (most recent call last):
  File "<string>", line 1, in <module>

sqlite3.OperationalError: no such function: RADIANS
$ python3 -c "import sqlite3; sqlite3.connect(':memory:').execute('SELECT RADIANS(1.0)')"
Traceback (most recent call last):
  File "<string>", line 1, in <module>

sqlite3.OperationalError: no such function: RADIANS

I replaced sqlite.py with your modified one and all is well.  I also deleted the sqlite.pyc file at the same location and cleared the Firefox cache.

A beautiful day in Phoenix today...  https://cjnaz.duckdns.org/weewx/
Thank you,
cjn

Michael Waldor

unread,
Mar 9, 2023, 2:57:42 AM3/9/23
to weewx-user
I'm encountering the very same problem within weewx 4.10.2.

I've downloaded your modified sqlite.py, but it is identical to the released version.

If running wee_report I get the error
Generating as of last timestamp in the database.
Using configuration file /etc/weewx/weewx.conf
Traceback (most recent call last):
 File "/usr/share/weewx/weedb/sqlite.py", line 39, in guarded_fn
   return fn(*args, **kwargs)
 File "/usr/share/weewx/weedb/sqlite.py", line 233, in execute
   return sqlite3.Cursor.execute(self, *args, **kwargs)
sqlite3.OperationalError: no such function: RADIANS 

weewx is running on a raspberry pi3 using bullseye, i.e linux 5.10.78-7

Michael Waldor

unread,
Mar 9, 2023, 4:13:40 AM3/9/23
to weewx-user
Sorry, my fault: I've modified skin.conf for weekly created images. And I've used windDir instead of wind within weekwinddir - I've assumed aspelling error (naming the image ...winddir but using  wind as observation. Mysterious (to me) why that triggered failure of wee_report. After fixing my error wee_report runs fine.

jterr...@gmail.com

unread,
Mar 9, 2023, 4:49:36 AM3/9/23
to weewx-user
I observed the same "sqlite3 Operational Error' when using by mistake.  windDir.vecdir  instead of   wind.vecdir   
Reply all
Reply to author
Forward
0 new messages