6π
At the django.db.backends.sqlite3, it tries to
try:
try:
from pysqlite2 import dbapi2 as Database
except ImportError:
from sqlite3 import dbapi2 as Database
except ImportError as exc:
from django.core.exceptions import ImproperlyConfigured
raise ImproperlyConfigured("Error loading either pysqlite2 or sqlite3 modules (tried in that order): %s" % exc)
So one of the modules named sqlite3 or pysqlite2 is not installed.
Try to install them
$ pip install sqlite3 # or pysqlite2
Update
sqlite3
and pysqlite2
are part of Python, therefore these two packages are not in PyPi anymore.
25π
You may also have compiled python by hand with no sqlite development library installed
So, do
sudo apt-get install libsqlite3-dev libsqlite3
Then, re-install python
test by entering
python
>>> import sqlite3
- [Django]-Specifying limit and offset in Django QuerySet wont work
- [Django]-How to pass django rest framework response to html?
- [Django]-Django-taggit β how do I display the tags related to each record
5π
I got very similar error message when I tried to run the Django development server:
ImproperlyConfigured: Error loading either pysqlite2 or sqlite3 modules (tried in that order): dlopen(/Users/Rubinous/Projects/Jiiri2/jiiri_venv/lib/python2.7/lib-dynload/_sqlite3.so, 2): Library not loaded: /usr/local/opt/sqlite/lib/libsqlite3.0.8.6.dylib
Referenced from: /Users/Rubinous/Projects/Jiiri2/jiiri_venv/lib/python2.7/lib-dynload/_sqlite3.so
Reason: image not found
I solved this by installing pysqlite
Python module with pip install pysqlite
.
- [Django]-Python 3 list(dictionary.keys()) raises error. What am I doing wrong?
- [Django]-Annotate a queryset with the average date difference? (django)
- [Django]-Substring in a django template?
5π
On MacOSX 10.9 (Mavericks), I had to run this command:
CPPFLAGS=-I/usr/local/opt/sqlite/include; LDFLAGS=-L/usr/local/opt/sqlite/lib; pip install pysqlite
I used homebrew to install sqlite3.
brew update; brew install sqlite
- [Django]-Cannot access django app through ip address while accessing it through localhost
- [Django]-Rendering a value as text instead of field inside a Django Form
- [Django]-Sending post data from angularjs to django as JSON and not as raw content
4π
This is what I did to get it to work.
I am using pythonbrew(which is using pip) with python 2.7.5 installed.
I first did what Zubair(above) said and ran this command:
sudo apt-get install libsqlite3-dev
Then I ran this command:
pip install pysqlite
This fixed the database problem and I got confirmation of this when I ran:
python manager.py syncdb
- [Django]-Django models avoid duplicates
- [Django]-Passing STATIC_URL to file javascript with django
- [Django]-Nginx doesn't serve static
3π
sqlite3 is part of the Python from versions 2.5 onwards. Install this lib:
sudo apt-get install libsqlite3-dev
Or you can also try installing the Python-dev package.
- [Django]-How to test auto_now_add in django
- [Django]-Django character set with MySQL weirdness
- [Django]-Django Multiple Authentication Backend for one project
1π
I had the same problem with python 2.6.8 built from source on Red Hat (but this probably holds for other versions on other OS).
My problem was solved by installing sqlite-devel (Red Hat) before configuring and building python (or do config.status --recheck
in your build directory, followed by make
and make install
.
- [Django]-Substring in a django template?
- [Django]-Removing 'Sites' from Django admin page
- [Django]-Negating a boolean in Django template
- [Django]-How to pass django rest framework response to html?
- [Django]-How to get getting base_url in django template
- [Django]-PyCharm: DJANGO_SETTINGS_MODULE is undefined
0π
MordicusEtCubitusβs answer is correct. Canβt upvote you yet as am a newbie.
Just to add to your answer, on fedora(23) run the following command to install instead.
sudo dnf install libsqlite3x-devel libsqlite3x
- [Django]-PHP Frameworks (CodeIgniter, Yii, CakePHP) vs. Django
- [Django]-Django 1.7 β App 'your_app_name' does not have migrations
- [Django]-Suddenly when running tests I get "TypeError: 'NoneType' object is not iterable