pythondjangosqlitepython-3.4pysqlite

Trying to run Django tests, get error loading either pysqlite2 or sqlite3?


I am trying to run tests on a project that is not mine when i python manage.py test, I get

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

I have installed the sqlite3 and pysqlite2 and all the dev-lib packages, it tells me the requirements are already satisfied. I installed them outside of the virtual env, I believe this is my problem, but I am afraid to use sudo apt-get remove because last time I used this command I deleted almost my entire Ubuntu. Any suggestions?


Solution

  • Since I am using Ubuntu I had installed python from the terminal, not from source. The installation I did must not have included sqlite3.

    Steps I took to solve issue:

    Download the source file of the Python version that you need, from source. Extract the folder somewhere, cd into the folder,

    ./configure
    make
    make install
    

    fixed my issue.