Notes and anecdotes

Techstuff rambling

No module named ‘_sqlite3’

TLDR: Try

sudo apt-get install python-dev
sudo apt-get install libsqlite3-dev

And recompile python (see own post)

Long version
So, I was starting a django app (1.7.1 with Python 3.4),

python manage.py migrate

when i encountered

django.core.exceptions.ImproperlyConfigured: Error loading either pysqlite2 or sqlite3 modules (tried in that order): No module named '_sqlite3'

Did not expect this.

I have heard rumers that sqlite3 has been included with python for quite some time. But OK. Let’s install it

pip3.4 install pysqlite

That should fix it, yep? Nope.

 File "/home/tomas/optimaltrener/env/build/pysqlite/setup.py", line 85

 print "Is sphinx installed? If not, try 'sudo easy_install sphinx'."

So the pysqlite does not support Python3+ (since its using that old syntax)? huh. Googling around said Python3+ (and earlier) should already be delivered with an appropriate sqlite3. But that didn’t seem to do it.
But i found this and this, which lead me to

sudo apt-get install libsqlite3-dev
sudo apt-get install python-dev

Followed by recompiling python3.4 (see own post), which fixed everything. Finally :D

djangopythonpython3sqlite

tomfa • 2014-12-08


Previous Post

Next Post