How to Solve Error Message Django cannot find Newer SQLite Version when Running Django Application

Posted on

Introduction

As the execution of the Django project or the Django application in the command line, there is an error appear. Since it is using sqlite3 database, it cannot find the newer SQLite version available in the operating system. Basically, it is because of python cannot look for the library of the newer SQLite version. The following is the attempt to search for the SQLite available in CentOS 7 :

[root@localhost bin]# ls -al | grep sqlite3
-rwxr-xr-x. 1 root root 1169124 Nov 18 09:15 sqlite3.36
-rwxr-xr-x. 1 root root 56264 Jan 28 2020 sqlite3.7
[root@localhost bin]# cd /usr/local/
[root@localhost local]# ls -al | grep sqlite3

The above output command searching for sqlite3 file available in /usr/bin is a success. Actually the original name is ‘sqlite3’. But for the sake of recognizing different versions of sqlite3, just rename it according to the version of it. There are two versions available above, the 3.36 and 3.7. The 3.36 version is added after where the 3.7 is the original version available along with the operating system. But apparently, python in the operating system cannot recognize the newer SQLite version.

Solution

Continue on the previous part, the introduction part is the solution part. Actually, the main goal is to make python to recognize the compiled library of other SQLite version which is going to be a new one compared to the existing SQLite version available. So, there is no binary file of the other SQLite3 version available which is newer in the ‘/usr/bin/’ folder. On the other hand, this article will try to use a compiled library of the newer version of the SQLite3 in ‘/usr/bin/lib’. Normally, the compiled version will be in ‘/usr/local/lib’ according to the article in this link. It is an article with the title of ‘django can’t find new sqlite version ? (SQLite 3.8.3 or later is required (found 3.7.17))’. But the location can be flexible according to the value of the –prefix parameter in the compiled process. The solution consists of two separe part which is the installation part and the testing part.

Installation of newer SQLite3

So, the following are the steps to get the compiled library of SQLite3 or installing a newer SQLite3 version :

  1. First of all, download the SQLite3 version for compiling process or the source code of SQLite3 version in this link. Check in the source code part. For an example, it is a link available on that part with the name of ‘sqlite-autoconf-3360000.zip’.

  2. After downloading it, just extract it.

  3. Start compiling the source code of SQLite 3.36 in this context. Before compiling further, do consider to place the compiled result in ‘/usr/local’ as it exist in the article in this link. Just type the command : ./configure –prefix=/usr/bin as follows :

    [root@localhost local]# cd /root/installer/sqlite-autoconf-3360000
    [root@localhost sqlite-autoconf-3360000]# ./configure--prefix=/usr/bin
    -bash: ./configure--prefix=/usr/bin: No such file or directory
    [root@localhost sqlite-autoconf-3360000]# ./configure --prefix=/usr/bin
    checking for a BSD-compatible install... /bin/install -c
    checking whether build environment is sane... yes
    checking for a thread-safe mkdir -p... /bin/mkdir -p
    checking for gawk... gawk
    checking whether make sets $(MAKE)... yes
    checking whether make supports nested variables... yes
    checking for style of include used by make... GNU
    checking for gcc... gcc
    checking whether the C compiler works... yes
    checking for C compiler default output file name... a.out
    checking for suffix of executables...
    checking whether we are cross compiling... no
    checking for suffix of object files... o
    checking whether we are using the GNU C compiler... yes
    checking whether gcc accepts -g... yes
    checking for gcc option to accept ISO C89... none needed
    checking whether gcc understands -c and -o together... yes
    checking dependency style of gcc... gcc3
    checking for special C compiler options needed for large files... no
    checking for _FILE_OFFSET_BITS value needed for large files... no
    checking for gcc... (cached) gcc
    checking whether we are using the GNU C compiler... (cached) yes
    checking whether gcc accepts -g... (cached) yes
    checking for gcc option to accept ISO C89... (cached) none needed
    checking whether gcc understands -c and -o together... (cached) yes
    checking dependency style of gcc... (cached) gcc3
    checking build system type... x86_64-pc-linux-gnu
    checking host system type... x86_64-pc-linux-gnu
    checking how to print strings... printf
    checking for a sed that does not truncate output... /bin/sed
    checking for grep that handles long lines and -e... /bin/grep
    checking for egrep... /bin/grep -E
    checking for fgrep... /bin/grep -F
    checking for ld used by gcc... /bin/ld
    checking if the linker (/bin/ld) is GNU ld... yes
    checking for BSD- or MS-compatible name lister (nm)... /bin/nm -B
    checking the name lister (/bin/nm -B) interface... BSD nm
    checking whether ln -s works... yes
    checking the maximum length of command line arguments... 1572864
    checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format... func_convert_file_noop
    checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
    checking for /bin/ld option to reload object files... -r
    checking for objdump... objdump
    checking how to recognize dependent libraries... pass_all
    checking for dlltool... no
    checking how to associate runtime and link libraries... printf %s\n
    checking for ar... ar
    checking for archiver @FILE support... @
    checking for strip... strip
    checking for ranlib... ranlib
    checking command to parse /bin/nm -B output from gcc object... ok
    checking for sysroot... no
    checking for a working dd... /bin/dd
    checking how to truncate binary pipes... /bin/dd bs=4096 count=1
    checking for mt... no
    checking if : is a manifest tool... no
    checking how to run the C preprocessor... gcc -E
    checking for ANSI C header files... yes
    checking for sys/types.h... yes
    checking for sys/stat.h... yes
    checking for stdlib.h... yes
    checking for string.h... yes
    checking for memory.h... yes
    checking for strings.h... yes
    checking for inttypes.h... yes
    checking for stdint.h... yes
    checking for unistd.h... yes
    checking for dlfcn.h... yes
    checking for objdir... .libs
    checking if gcc supports -fno-rtti -fno-exceptions... no
    checking for gcc option to produce PIC... -fPIC -DPIC
    checking if gcc PIC flag -fPIC -DPIC works... yes
    checking if gcc static flag -static works... no
    checking if gcc supports -c -o file.o... yes
    checking if gcc supports -c -o file.o... (cached) yes
    checking whether the gcc linker (/bin/ld -m elf_x86_64) supports shared libraries... yes
    checking whether -lc should be explicitly linked in... no
    checking dynamic linker characteristics... GNU/Linux ld.so
    checking how to hardcode library paths into programs... immediate
    checking whether stripping libraries is possible... yes
    checking if libtool supports shared libraries... yes
    checking whether to build shared libraries... yes
    checking whether to build static libraries... yes
    checking for fdatasync... yes
    checking for usleep... yes
    checking for fullfsync... no
    checking for localtime_r... yes
    checking for gmtime_r... yes
    checking whether strerror_r is declared... yes
    checking for strerror_r... yes
    checking whether strerror_r returns char *... no
    checking editline/readline.h usability... no
    checking editline/readline.h presence... no
    checking for editline/readline.h... no
    checking readline/readline.h usability... no
    checking readline/readline.h presence... no
    checking for readline/readline.h... no
    checking for library containing pthread_create... -lpthread
    checking for library containing pthread_mutexattr_init... none required
    checking for library containing dlopen... -ldl
    checking for whether to support dynamic extensions... yes
    checking SQL math functions... enabled
    checking for library containing ceil... -lm
    checking FTS4 extension... enabled
    checking FTS3 extension... disabled
    checking FTS5 extension... enabled
    checking for library containing log... none required
    checking JSON functions... enabled
    checking RTREE extension... enabled
    checking Session extension... disabled
    checking Build type... release
    checking for posix_fallocate... yes
    checking zlib.h usability... no
    checking zlib.h presence... no
    checking for zlib.h... no
    checking for library containing system... none required
    checking that generated files are newer than configure... done
    configure: creating ./config.status
    config.status: creating Makefile
    config.status: creating sqlite3.pc
    config.status: executing depfiles commands
    config.status: executing libtool commands
    [root@localhost sqlite-autoconf-3360000]#
    
  4. Then continue on the compile process by executing the following command :

    [root@localhost sqlite-autoconf-3360000]# make
    /bin/sh ./libtool --tag=CC --mode=compile gcc -DPACKAGE_NAME=\"sqlite\" -DPACKAGE_TARNAME=\"sqlite\" -DPACKAGE_VERSION=\"3.36.0\" -DPACKAGE_STRING=\"sqlite\ 3.36.0\" -DPACKAGE_BUGREPORT=\"http://www.sqlite.org\" -DPACKAGE_URL=\"\" -DPACKAGE=\"sqlite\" -DVERSION=\"3.36.0\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DHAVE_FDATASYNC=1 -DHAVE_USLEEP=1 -DHAVE_LOCALTIME_R=1 -DHAVE_GMTIME_R=1 -DHAVE_DECL_STRERROR_R=1 -DHAVE_STRERROR_R=1 -DHAVE_POSIX_FALLOCATE=1 -I. -D_REENTRANT=1 -DSQLITE_THREADSAFE=1 -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_GEOPOLY -g -O2 -MT sqlite3.lo -MD -MP -MF .deps/sqlite3.Tpo -c -o sqlite3.lo sqlite3.c
    libtool: compile: gcc -DPACKAGE_NAME=\"sqlite\" -DPACKAGE_TARNAME=\"sqlite\" -DPACKAGE_VERSION=\"3.36.0\" "-DPACKAGE_STRING=\"sqlite 3.36.0\"" -DPACKAGE_BUGREPORT=\"http://www.sqlite.org\" -DPACKAGE_URL=\"\" -DPACKAGE=\"sqlite\" -DVERSION=\"3.36.0\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DHAVE_FDATASYNC=1 -DHAVE_USLEEP=1 -DHAVE_LOCALTIME_R=1 -DHAVE_GMTIME_R=1 -DHAVE_DECL_STRERROR_R=1 -DHAVE_STRERROR_R=1 -DHAVE_POSIX_FALLOCATE=1 -I. -D_REENTRANT=1 -DSQLITE_THREADSAFE=1 -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_GEOPOLY -g -O2 -MT sqlite3.lo -MD -MP -MF .deps/sqlite3.Tpo -c sqlite3.c -fPIC -DPIC -o .libs/sqlite3.o
    libtool: compile: gcc -DPACKAGE_NAME=\"sqlite\" -DPACKAGE_TARNAME=\"sqlite\" -DPACKAGE_VERSION=\"3.36.0\" "-DPACKAGE_STRING=\"sqlite 3.36.0\"" -DPACKAGE_BUGREPORT=\"http://www.sqlite.org\" -DPACKAGE_URL=\"\" -DPACKAGE=\"sqlite\" -DVERSION=\"3.36.0\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DHAVE_FDATASYNC=1 -DHAVE_USLEEP=1 -DHAVE_LOCALTIME_R=1 -DHAVE_GMTIME_R=1 -DHAVE_DECL_STRERROR_R=1 -DHAVE_STRERROR_R=1 -DHAVE_POSIX_FALLOCATE=1 -I. -D_REENTRANT=1 -DSQLITE_THREADSAFE=1 -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_GEOPOLY -g -O2 -MT sqlite3.lo -MD -MP -MF .deps/sqlite3.Tpo -c sqlite3.c -o sqlite3.o >/dev/null 2>&1
    mv -f .deps/sqlite3.Tpo .deps/sqlite3.Plo
    /bin/sh ./libtool --tag=CC --mode=link gcc -D_REENTRANT=1 -DSQLITE_THREADSAFE=1 -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_GEOPOLY -g -O2 -no-undefined -version-info 8:6:8 -o libsqlite3.la -rpath /usr/bin/lib sqlite3.lo -lm -ldl -lpthread
    libtool: link: gcc -shared -fPIC -DPIC .libs/sqlite3.o -lm -ldl -lpthread -g -O2 -Wl,-soname -Wl,libsqlite3.so.0 -o .libs/libsqlite3.so.0.8.6
    libtool: link: (cd ".libs" && rm -f "libsqlite3.so.0" && ln -s "libsqlite3.so.0.8.6" "libsqlite3.so.0")
    libtool: link: (cd ".libs" && rm -f "libsqlite3.so" && ln -s "libsqlite3.so.0.8.6" "libsqlite3.so")
    libtool: link: ar cru .libs/libsqlite3.a sqlite3.o
    libtool: link: ranlib .libs/libsqlite3.a
    libtool: link: ( cd ".libs" && rm -f "libsqlite3.la" && ln -s "../libsqlite3.la" "libsqlite3.la" )
    gcc -DPACKAGE_NAME=\"sqlite\" -DPACKAGE_TARNAME=\"sqlite\" -DPACKAGE_VERSION=\"3.36.0\" -DPACKAGE_STRING=\"sqlite\ 3.36.0\" -DPACKAGE_BUGREPORT=\"http://www.sqlite.org\" -DPACKAGE_URL=\"\" -DPACKAGE=\"sqlite\" -DVERSION=\"3.36.0\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DHAVE_FDATASYNC=1 -DHAVE_USLEEP=1 -DHAVE_LOCALTIME_R=1 -DHAVE_GMTIME_R=1 -DHAVE_DECL_STRERROR_R=1 -DHAVE_STRERROR_R=1 -DHAVE_POSIX_FALLOCATE=1 -I. -D_REENTRANT=1 -DSQLITE_THREADSAFE=1 -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_DBPAGE_VTAB -DSQLITE_ENABLE_STMTVTAB -DSQLITE_ENABLE_DBSTAT_VTAB -g -O2 -MT sqlite3-shell.o -MD -MP -MF .deps/sqlite3-shell.Tpo -c -o sqlite3-shell.o `test -f 'shell.c' || echo './'`shell.c
    mv -f .deps/sqlite3-shell.Tpo .deps/sqlite3-shell.Po
    gcc -DPACKAGE_NAME=\"sqlite\" -DPACKAGE_TARNAME=\"sqlite\" -DPACKAGE_VERSION=\"3.36.0\" -DPACKAGE_STRING=\"sqlite\ 3.36.0\" -DPACKAGE_BUGREPORT=\"http://www.sqlite.org\" -DPACKAGE_URL=\"\" -DPACKAGE=\"sqlite\" -DVERSION=\"3.36.0\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DHAVE_FDATASYNC=1 -DHAVE_USLEEP=1 -DHAVE_LOCALTIME_R=1 -DHAVE_GMTIME_R=1 -DHAVE_DECL_STRERROR_R=1 -DHAVE_STRERROR_R=1 -DHAVE_POSIX_FALLOCATE=1 -I. -D_REENTRANT=1 -DSQLITE_THREADSAFE=1 -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_DBPAGE_VTAB -DSQLITE_ENABLE_STMTVTAB -DSQLITE_ENABLE_DBSTAT_VTAB -g -O2 -MT sqlite3-sqlite3.o -MD -MP -MF .deps/sqlite3-sqlite3.Tpo -c -o sqlite3-sqlite3.o `test -f 'sqlite3.c' || echo './'`sqlite3.c
    mv -f .deps/sqlite3-sqlite3.Tpo .deps/sqlite3-sqlite3.Po
    /bin/sh ./libtool --tag=CC --mode=link gcc -D_REENTRANT=1 -DSQLITE_THREADSAFE=1 -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_DBPAGE_VTAB -DSQLITE_ENABLE_STMTVTAB -DSQLITE_ENABLE_DBSTAT_VTAB -g -O2 -o sqlite3 sqlite3-shell.o sqlite3-sqlite3.o -lm -ldl -lpthread
    libtool: link: gcc -D_REENTRANT=1 -DSQLITE_THREADSAFE=1 -DSQLITE_ENABLE_MATH_FUNCTIONS -DSQLITE_ENABLE_FTS4 -DSQLITE_ENABLE_FTS5 -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_RTREE -DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_DBPAGE_VTAB -DSQLITE_ENABLE_STMTVTAB -DSQLITE_ENABLE_DBSTAT_VTAB -g -O2 -o sqlite3 sqlite3-shell.o sqlite3-sqlite3.o -lm -ldl -lpthread
    [root@localhost sqlite-autoconf-3360000]#
    
  5. Continue on from the previous command execution by executing the following command to compile the source code :

    [root@localhost sqlite-autoconf-3360000]# make install
    make[1]: Entering directory `/root/installer/sqlite-autoconf-3360000'
    /bin/mkdir -p '/usr/bin/lib'
    /bin/sh ./libtool --mode=install /bin/install -c libsqlite3.la '/usr/bin/lib'
    libtool: install: /bin/install -c .libs/libsqlite3.so.0.8.6 /usr/bin/lib/libsqlite3.so.0.8.6
    libtool: install: (cd /usr/bin/lib && { ln -s -f libsqlite3.so.0.8.6 libsqlite3.so.0 || { rm -f libsqlite3.so.0 && ln -s libsqlite3.so.0.8.6 libsqlite3.so.0; }; })
    libtool: install: (cd /usr/bin/lib && { ln -s -f libsqlite3.so.0.8.6 libsqlite3.so || { rm -f libsqlite3.so && ln -s libsqlite3.so.0.8.6 libsqlite3.so; }; })
    libtool: install: /bin/install -c .libs/libsqlite3.lai /usr/bin/lib/libsqlite3.la
    libtool: install: /bin/install -c .libs/libsqlite3.a /usr/bin/lib/libsqlite3.a
    libtool: install: chmod 644 /usr/bin/lib/libsqlite3.a
    libtool: install: ranlib /usr/bin/lib/libsqlite3.a
    libtool: finish: PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/sbin" ldconfig -n /usr/bin/lib
    ----------------------------------------------------------------------
    Libraries have been installed in:
    /usr/bin/lib
    
    If you ever happen to want to link against installed libraries
    in a given directory, LIBDIR, you must either use libtool, and
    specify the full pathname of the library, or use the '-LLIBDIR'
    flag during linking and do at least one of the following:
    - add LIBDIR to the 'LD_LIBRARY_PATH' environment variable
    during execution
    - add LIBDIR to the 'LD_RUN_PATH' environment variable
    during linking
    - use the '-Wl,-rpath -Wl,LIBDIR' linker flag
    - have your system administrator add LIBDIR to '/etc/ld.so.conf'
    
    See any operating system documentation about shared libraries for
    more information, such as the ld(1) and ld.so(8) manual pages.
    ----------------------------------------------------------------------
    /bin/mkdir -p '/usr/bin/bin'
    /bin/sh ./libtool --mode=install /bin/install -c sqlite3 '/usr/bin/bin'
    libtool: install: /bin/install -c sqlite3 /usr/bin/bin/sqlite3
    /bin/mkdir -p '/usr/bin/include'
    /bin/install -c -m 644 sqlite3.h sqlite3ext.h '/usr/bin/include'
    /bin/mkdir -p '/usr/bin/share/man/man1'
    /bin/install -c -m 644 sqlite3.1 '/usr/bin/share/man/man1'
    /bin/mkdir -p '/usr/bin/lib/pkgconfig'
    /bin/install -c -m 644 sqlite3.pc '/usr/bin/lib/pkgconfig'
    make[1]: Leaving directory `/root/installer/sqlite-autoconf-3360000'
    [root@localhost sqlite-autoconf-3360000]#
    

Testing the SQLite3

In this part, after successfully compiling the newer SQLite3 version as in the previous part, just test it as in the following details :

  1. After successfully compiling the source code, try to execute the ‘sqlite3’ command as follows :

    [root@localhost sqlite-autoconf-3360000]# sqlite3 --version
    -bash: /bin/sqlite3: No such file or directory
    [root@localhost sqlite-autoconf-3360000]# 
    

    Well, apparently the command is not working. It is obvious since it does not create any binary file sqlite3 for the version of 3.36. Instead of adding a new file, it is just compiling the source code into a library files which is actually sqlite3 library with the version of 3.36. It exist in the following output display :

    [root@localhost sqlite-autoconf-3360000]# cd /usr/bin/
    [root@localhost bin]# ls -al | grep sqlite3
    -rwxr-xr-x. 1 root root 1169124 Nov 18 09:15 sqlite3.36
    -rwxr-xr-x. 1 root root 56264 Jan 28 2020 sqlite3.7
    [root@localhost bin]# cd /usr/bin/lib
    [root@localhost lib]# ls
    libsqlite3.a libsqlite3.la libsqlite3.so libsqlite3.so.0 libsqlite3.so.0.8.6 pkgconfig
    [root@localhost lib]# cd pkgconfig/
    [root@localhost pkgconfig]# ls
    sqlite3.pc
    [root@localhost pkgconfig]# python3
    python3 python3.6 python3.6m
    [root@localhost pkgconfig]#
    

    Apparently, the operating system has several python version. Just try to execute it to be able to check the current SQLite3 version available by typing the following command :

    [root@localhost pkgconfig]# python3.6 -c "import sqlite3; print(sqlite3.sqlite_version)"
    3.7.17
    [root@localhost pkgconfig]#
    

    So, how can the python detect the newer version available from the compiled library of SQLite3 in the previous step ?. Just execute the following command to export the environment variable of ‘LD_LIBRARY_PATH’ with the value of the library path. In this context, it is ‘/usr/bin/lib’ as follows :

    [root@localhost pkgconfig]# export LD_LIBRARY_PATH=/usr/bin/lib
    [root@localhost pkgconfig]#
    

    Finally, try to execute it once more with the same command, the output will show the SQLite3 version with the different version which is the newer one as follows :

    [root@localhost pkgconfig]# python3.6 -c "import sqlite3; print(sqlite3.sqlite_version)"
    3.36.0
    [root@localhost pkgconfig]#
    

Leave a Reply