https://prefect.io logo
Title
n

Neil Natarajan

08/26/2022, 7:06 PM
I keep encountering the following Runtime error:
RuntimeError: Orion requires sqlite >= 3.24.0 but we found version 3.7.17
how do I go about fixing this error
1
1
j

Jeff Hale

08/26/2022, 7:11 PM
Looks like you need to upgrade your SQLite version. The easiest way to get this to work is to run in a conda environment. Are you on Windows.
:marvin-duck: 1
n

Neil Natarajan

08/26/2022, 7:14 PM
I am using a python virtual environment
venv
i am running on a linux machine
j

Jeff Hale

08/26/2022, 7:21 PM
Gotcha. You should just need to update SQLite. Here’s an SO answer on it. If that doesn’t work, I’d suggest using conda.
r

Ryan Peden

08/26/2022, 7:26 PM
Neil, out of curiosity, what Linux distro and version are you running?
n

Neil Natarajan

08/26/2022, 7:29 PM
centos 7
python version: Python 3.9.13
r

Ryan Peden

08/26/2022, 7:49 PM
ok, CentOS 7 was what I thought based on that Sqlite version. 3.7.17 is nearly 10 years old now. Last time I had to update Sqlite on CentOS 7, this worked for me: https://linuxhint.com/upgrade-to-latest-sqlite3-on-centos7/ But that only works on x86. When I did needed to do the same on on x64 I had to build Sqlite from source. As Jeff mentioned, an Anaconda environment would also solve this because it will install the right version of Sqlite for whichever Python version you add to the environment
n

Neil Natarajan

08/26/2022, 7:53 PM
Alternatively I do have an rds instance with a postgres db. I see there's some path for using postgres for orion backend instead of sqlite3
r

Ryan Peden

08/26/2022, 7:54 PM
yes - that would work as well
n

Neil Natarajan

08/26/2022, 7:55 PM
but I saw a line that said orion has to be run on same instance as postgres
since I have an rds instance separate from my ec2 where app/prefect code is being run would this still work
r

Ryan Peden

08/26/2022, 7:58 PM
The example Postgres connection string in the docs assumes you are running Postgres on localhost, but it should work fine if you specify a remote Postgres instance - as long as the RDS Postgres is reachable from the ec2 VM where you're running Orion
n

Neil Natarajan

08/26/2022, 8:00 PM
ok awesome, in that case I will quickly give that a shot
@Ryan Peden i tried setting the env var but i still got the same run time error for some reason
File "/opt/sfdc/python39/lib/python3.9/site-packages/prefect/orion/database/configurations.py", line 189, in engine
    raise RuntimeError(
RuntimeError: Orion requires sqlite >= 3.24.0 but we found version 3.7.17
r

Ryan Peden

08/26/2022, 10:08 PM
My apologies, Neil - I wasn't expecting that. It looks like perhaps an upgrade of the sqlite binary is the only way around this right now. I'm going to check a couple of things on my end to confirm.
n

Neil Natarajan

08/29/2022, 2:58 PM
Any advice is appreciated, thank you again for all your help!
r

Ryan Peden

08/29/2022, 3:29 PM
Hi Neil! I tried running Prefect Orion with Postgres on a machine that had an old version of Sqlite installed, and I didn't get the error. When I switched the database to SQLite, I did get the error, so using Postgres instead should have worked. I suggest double-checking to make sure your environment variable setting looks like
PREFECT_ORION_DATABASE_CONNECTION_URL="<postgresql+asyncpg://your_postgres_user:your_postgres_password@your_postgres_host:5432/orion>"
I know you've probably done that already, but I'm not sure what else might be causing what you are seeing
n

Neil Natarajan

08/29/2022, 4:14 PM
quick one, for the connection string I don't have the
+asyncpg
is that portion necessary
r

Ryan Peden

08/29/2022, 4:25 PM
yes, because Prefect 2 uses asyncpg to connect to Postgres
n

Neil Natarajan

08/29/2022, 4:44 PM
gotcha, I will put that in the connection string and try again
I unfortunately got the same error
in your case is the postgres instance on the same local as your orion/prefect execution
Is there a way with the environment variable/connection string to specify ssl arguments like cert parth
r

Ryan Peden

08/29/2022, 9:14 PM
Hi Neil, sorry for the slow reply. I ran it using two separate containers for Prefect and Postgres so it had to connect to Postgres over the network As for the connection string, I'm not sure if there is a way to specify SSL arguments. I will ask my colleagues as one of them might know more.
However, I believe you can add the certificate to your system's trust store if you want Postgres to use it without needing to explicitly specify the path
n

Neil Natarajan

08/31/2022, 5:01 PM
I was able to manually build sqlite from source but I am still getting errors on app start up for orion
File "/opt/sfdc/python39/lib/python3.9/site-packages/aiosqlite/core.py", line 397, in connector
    return sqlite3.connect(loc, **kwargs)
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) unable to open database file
(Background on this error at: <https://sqlalche.me/e/14/e3q8>)
sh-4.2$ prefect config view --show-sources
PREFECT_PROFILE='default'
PREFECT_HOME='/my/path' (from env)
PREFECT_ORION_DATABASE_CONNECTION_URL='sqlite+aiosqlite:///my/path/orion.db' (from env)
I however cannot start prefect orion successfully due to the above error
@Ryan Peden
r

Ryan Peden

08/31/2022, 5:14 PM
I am going to try a couple of things on Centos. Just to confirm, the user account you are running Prefect with has read/write access to the Prefect home directory?
:thank-you: 1
n

Neil Natarajan

08/31/2022, 5:18 PM
correct
if you're free to join a huddle to go over my env that would be really appreciated as well
r

Ryan Peden

08/31/2022, 6:14 PM
Hi Neil, it looks like you are missing a slash in your database connect URL. There should be four
/
characters after
sqlite+aiosqlite
, so
PREFECT_ORION_DATABASE_CONNECTION_URL='sqlite+aiosqlite:////my/path/orion.db'
I got the same error as you with your previous connection string, but it worked after adding the extra slash