Hub Error about SQLite3 Version

Hi, there,

I rebuild Hub docker image based on amazon linux2. When I tried to run it locally, I got error:
For the sqlite version error: sqlalchemy.exc.NotSupportedError: (sqlite3.NotSupportedError) deterministic=True requires SQLite 3.8.3 or higher

The default SQLite coming with amazon linux2 is 3.7.17. However, I have upgrade it to the latest version (3.40.x). I have deleted old sqlite from /usr/bin and create symbol link to /usr/local/bin (where the new version is installed). However, I still get above error.

I don’t know from where the JupyterHub picks up the SQLite version? And how to fix?

Thanks for any help!

This is much more a question about linux distribution and packaging than it is z2jh.

In the other discussion you said you had a policy to use Amazon Linux. My first question is could you use Amazon Linux 2022 that’s based off Fedora rather than the very dated Centos 7

In your Dockerfile use

FROM amazonlinux:2022

Doing the below shows the much more modern python and sqlite which should make things easier

docker pull amazonlinux:2022
docker run -it --rm amazonlinux:2022 rpm -q sqlite-libs pyt

In response to your original question, there is a difference between sqlite binary and a library - the python sqlite bindings are compiled against the system sqlite when python is built (ie at rpmbuild). Thus your python doesn’t use /usr/bin/sqlite3 but the library as can be seen via ldd of the _sqlite3 module.

amazon-linux-extras install python3.8
rpm -ql python38-libs | grep _sqlite
ldd /usr/lib64/python3.8/lib-dynload/ (0x00007ffc6b3fa000) => /lib64/ (0x00007f5d37918000) => /lib64/ (0x00007f5d376fa000) => /lib64/ (0x00007f5d3734d000) => /lib64/ (0x00007f5d37149000)
	/lib64/ (0x00007f5d37de0000)

To get a working python with newer sqlite3 you will need to do the work to build/install or package yourself. You probably don’t want to replace the sqlite as that’ll break the OS image, so would need to install in a different location (or prefix) and build python for that

There are many ways of managing your OS python to support more recent versions, such as building your own RPMS using an alternate prefix (eg /opt or /usr/local), using a python version management tool such a pyenv, or other tools.

One (untested by me) way is to look at how folks running centos are doing this to get an idea of how to setup manually, Amazon Linux 2 is related to CentOS 7

Like your previous question, this far exceeds what the Jupyter community can support - z2jh provides containers that are known to work, if you need to build your own due to policies there is only limited support that can be given.

1 Like

@pnasrat Thank you so very much for the great help, Pris! You are the best : - )

I would also recommend looking at (which requires Ubuntu) instead if you are just trying to set up a single node JupyterHub :slight_smile:

@yuvipanda Thanks for the information, Yuvi! I will take a look : - )