I've cloned a django project to a Centos 7 vps and I'm trying to run it now, but I get this error when trying to migrate
:
$ python manage.py migrate django.core.exceptions.ImproperlyConfigured: SQLite 3.8.3 or later is required (found 3.7.17).
When I checked the version for sqlite, it was 3.7.17, so I downloaded the newest version from sqlite website and replaced it with the old one, and now when I version it, it gives:
$ sqlite3 --version 3.27.2 2019-02-25 16:06:06 bd49a8271d650fa89e446b42e513b595a717b9212c91dd384aab871fc1d0f6d7
Still when I try to migrate the project, I get the exact same message as before which means the newer version is not found. I'm new to linux and would appreciate any help.
By default, the configuration uses SQLite. If you're new to databases, or you're just interested in trying Django, this is the easiest choice. SQLite is included in Python, so you won't need to install anything else to support your database.
In command prompt, if you type sqlite3 and hit enter, it will automatically give the version number at the very first.
I got the same error in CentOS 7.6 and Python 3.7.3 versions. I think you are using Django 2.2.* some version. In latest of Django 2.2, they changed the SQLIte version, that cause of your problem.
This is the release notes of Django 2.2 about SQLite.
The minimum supported version of SQLite is increased from 3.7.15 to 3.8.3.
So I found 3 steps to solve this problem,
So you can install latest version of Django 2.1 by using this command, which mean you're going to downgrade your Django
version.
pip install Django==2.1.*
or you can followup below steps as well to keep the latest version Django
. I directly get the steps from Upgrading SQLite on CentOS to 3.8.3 or Later article.
You can download the latest sqlite
version from here.
wget https://www.sqlite.org/2019/sqlite-autoconf-3280000.tar.gz tar zxvf sqlite-autoconf-3280000.tar.gz ./configure make sudo make install
We've installed to the latest version, but the problem is same. Here,
>>> import sqlite3 >>> sqlite3.sqlite_version '3.7.17'
In the article, they've mentioned about LD_RUN_PATH
and LD_LIBRARY_PATH
paths.
Then make sure to compile python again using the
LD_RUN_PATH
environment variable. It is better to use this variable overLD_LIBRARY_PATH
. UsingLD_LIBRARY_PATH
- whenever python is run it will look for linked libraries with that path. What we want is for the libraries to be cooked into python at link time - compile time.
So based on the article, we can do the similar thing,
cd /opt/Python-x.y.z LD_RUN_PATH=/usr/local/lib ./configure LD_RUN_PATH=/usr/local/lib make LD_RUN_PATH=/usr/local/lib make altinstall
Then try again,
>>> import sqlite3 >>> sqlite3.sqlite_version '3.31.1'
Here we go, one thing they've mentioned,
If you do not use LD_RUN_PATH, then you have to make sure that the LD_RUN_PATH environment variable is set to /usr/local/lib for every user that is going to run python - which can be really annoying to do.
This is same as the previous one and based on LD_LIBRARY_PATH
approach. Here is the steps from the article,
$ wget https://www.sqlite.org/2018/sqlite-autoconf-3240000.tar.gz $ tar zxvf sqlite-autoconf-3240000.tar.gz $ ./configure --prefix=/usr/local $ make $ sudo make install $ $ python3.6 -c "import sqlite3; print(sqlite3.sqlite_version)" 3.7.17 $ $ export LD_LIBRARY_PATH=/usr/local/lib $ python3.6 -c "import sqlite3; print(sqlite3.sqlite_version)" 3.24.0
If the last two steps didn't work, please comment below with the error you got and I'll find another solution for you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With