I keep encountering the following Runtime error: `...
# ask-community
n
I keep encountering the following Runtime error:
Copy code
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
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
I am using a python virtual environment
venv
i am running on a linux machine
j
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
Neil, out of curiosity, what Linux distro and version are you running?
n
centos 7
python version: Python 3.9.13
r
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
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
yes - that would work as well
n
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
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
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
Copy code
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
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
Any advice is appreciated, thank you again for all your help!
r
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
Copy code
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
quick one, for the connection string I don't have the
+asyncpg
is that portion necessary
r
yes, because Prefect 2 uses asyncpg to connect to Postgres
n
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
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
I was able to manually build sqlite from source but I am still getting errors on app start up for orion
Copy code
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>)
Copy code
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
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?
🙏 1
n
correct
if you're free to join a huddle to go over my env that would be really appreciated as well
r
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