1

I have created a GitHub Actions workflow. which is supposed to run a SQL query. It uses the arrow operators for JSON. This requires SQLite >= 3.38.0.

This worked for system with windows-latest and macos-latest, for which I could say SQLite installed in Python 3.11 was >= 3.38.

But there's a problem I faced in ubuntu-latest which has 3.37. I wanted to make sure Python uses the latest version.

I did try installing through sudo apt -y install sqlite3 libsqlite3-dev but it didn't replace the sqlite3 version in Python and I got this message:

libsqlite3-dev is already the newest version (3.37.2-2ubuntu0.3).
sqlite3 is already the newest version (3.37.2-2ubuntu0.3).

reference github workflow:

name: 'tests'
on:
 push:
 branches:
 - 'testing'
jobs:
 test:
 name: Test
 runs-on: ${{ matrix.os }}
 strategy:
 matrix:
 os: ['macos-latest', 'windows-latest', 'ubuntu-latest']
 steps:
 - uses: actions/checkout@v3
 - name: Install Latest sqlite3 version on non-windows platform
 if: ${{ matrix.os == 'ubuntu-latest' }}
 run: |
 bash ./.github/scripts/install-sqlite.sh
 - name: Set up Python 3.11
 uses: actions/setup-python@v3
 with:
 python-version: "3.11"
 - name: Install dependencies
 run: |
 python -m pip install --upgrade pip
 pip install poetry 
 poetry install
 - name: Smoke Test
 run: pytest __test__/test_smoke

I have even installed it from the source code, the version changed when I tried sqlite --version but it didn't change in Python.

How can I upgrade the sqlite3 version in Python from 3.37 to 3.38 in ubuntu-latest?

asked Jan 16, 2024 at 20:11
5
  • 1
    ubuntu-latest uses ubuntu-22.04 and sqlite 3.37 is the latest version available on the offical apt repos. Installing from source seems the way to go. You can look at stackoverflow.com/questions/62523183/… and other similar questions to see how to change the sqlite version used by python. Commented Jan 16, 2024 at 20:38
  • 1
    Since apparently the sqlite3 module is part of the Python standard library, maybe you can get the desired version via the setup-python action? Maybe you use that already, but you don't show your workflow. Commented Jan 16, 2024 at 21:04
  • have you considered downloading pre-built binaries? Commented Jan 16, 2024 at 21:14
  • @njzk2, I haven't tried through pre-built binaries, I have tried it through source code, will give it a go. Thank you Commented Jan 17, 2024 at 16:21
  • @Dhruv, I have tried the solution that was requested, max I still was only able to see 3.37 in python Commented Jan 17, 2024 at 16:22

1 Answer 1

1

This issue is resolved by uninstalling existing SQLite after building it from the source.

  • build the source code of sqlite
  • uninstall the existing version through apt-get remove -y --auto-remove sqlite3

you would find this in the bash script

# required to support: https://www.sqlite.org/json1.html#jptr
# installing build: 3.45.0
wget https://www.sqlite.org/2024/sqlite-autoconf-3450000.tar.gz
# unzipping build
tar -xvzf sqlite-autoconf-3450000.tar.gz
# below steps are for installing the build in /usr/local/bin
cd sqlite-autoconf-3450000 || exit
./configure
make
sudo make install
# remove the previous version
sudo apt-get remove -y --auto-remove sqlite3

Test Workflow:

name: 'server-build'
on:
 push:
 branches:
 - 'server-build'
jobs:
 build:
 name: Building Executable
 needs: pre
 if: ${{ needs.pre.outputs.exists == 'false' }}
 runs-on: ${{ matrix.os }}
 strategy:
 matrix:
 os: ['macos-latest', 'windows-latest', 'ubuntu-latest']
 steps:
 - uses: actions/checkout@v4
 - name: If in ubuntu, Install sqlite3 3.45.0
 if: ${{ matrix.os == 'ubuntu-latest' }}
 run: |
 bash ./build.sh 
 - name: Set up Python 3.11
 uses: actions/setup-python@v5
 with:
 python-version: "3.11"
 - name: check
 run: |
 python -c "import sqlite3; print(sqlite3.sqlite_version_info);"
answered Jan 18, 2024 at 19:01
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.