Issue
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
?
Solution
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 By - Rahul A Ranger
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.