Sqlite3 in a passenger app

I have developed a passenger app to display user’s usage, quota and other information. The app run well in the past. Recently, we have upgraded our system and the app has stopped working.

When I run the app through Open Ondemand interface, it gives a long error message. “in set_regexp dbapi_connection.create_function( sqlalchemy.exc.NotSupportedError: (sqlite3.NotSupportedError) deterministic=True requires SQLite 3.8.3 or higher” This seems to be the root cause.

The app is calling a python 3.9 function. We have installed a self-consistent python 3.9 environment. On the open ondemand machine, “SQLite version 3.41.2 2023-03-22 11:56:21”. If I logon open ondemand machine, I can execute the script so the proper version of sqlite3 is available. Does passenger app use its own environment? Where does this lower version of sqlite3 come from?

Yes, the app will have a different environment than say your bash session, but I don’t see any sqlite3 related environment variables when I just checked.

I would inspect the python libraries that you’ve installed. Did they install a sqlite3 binary? which -a sqlite3 will print all the binaries it finds in the PATH - though you may need to update the environment as I’ve done below (plus adding the apps path as well.

[~()]  source /opt/ood/ondemand/enable 
[~()]  which -a sqlite3

Additionally this error message - SQLite 3.8.3 or higher could be misleading. Often times with interpretive languages a package like sqlite3 in python gets compiled against a specific version (whatever version you have) when you built the package.

That is - did you reinstall all the dependent packages after you upgraded your system? Or did you just copy them from the old system? If you just copied them, they’re likely compiled against a different sqlite3 version, so I’d ask if you reinstalled (recompiled) the dependencies or if you just copied the folder. If you just copied the folder - I’d suggest reinstalling.

Thank you for your reply. In my original post, the word “update” is confusing. To clarify, we have not updated Open Ondemand. We have only updated the python library associated with wrapper functions used in the passenger app.

From the bash session, I can run the wrapper function.
[fangping@ondemand ~]$ which crc-usage

| sam Proposal Information |
| Proposal End Date: | 04/26/2024 | |

The wrapper function has installed its own environment.

cat /ihome/crc/pipx/bin/crc-usage

-- coding: utf-8 --

import re
import sys
from apps.crc_usage import CrcUsage
if name == ‘main’:
sys.argv[0] = re.sub(r’(-script.pyw|.exe)?$', ‘’, sys.argv[0])

Based on your comments, it seems that this problem is not related to sqlite3.

" the app will have a different environment ". Is it possible to run my wrapper function from this environment so that I can debug the problems?

What’s the error page that you see?

If I boot an app in development mode (note I’m saying development mode here - I’m not suggesting you do this for the production application) - I can remove all my dependencies and get an error page like so:

If you navigate through that page you’ll see tabs that show you the environment the app is booting up in.

Since you’re using a venv - I’d check that venv for the errant sqlite3 package. Maybe there’s a /ihome/crc/pipx/opt/venvs/crc-wrappers/bin/sqlite3?

venvs/crc-wrappers/bin/sqlite3 does not exist. I believe that I had found the root cause of this problem. We are using sqlalchemy and the python 3.9 sqlalchemy installed sqlite3 3.7.17. The venv itself works fine. We are running Open Ondemand 2.0.31, and the passenger app environment requires sqlite3 > 3.8.3. This problem should appear after we upgrade open ondemand from 2.0.30? to 2.0.31. However, we do not notice it because no user has reported this problem.

I do not find an easy method to resolve this issue. I will wait till our system administrators upgrade the wrappers to python 3.10, and I believe that the problem will be resolved automatically.