1

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?

RPG
  • 198
  • 9

2 Answers2

1
  • Inside your virtual env:

    pip install pysqlite2
    

NOTE: sqlite3 module is included in the standard library (since Python 2.5).

EDIT: try this to install the following:

sudo apt-get update && sudo apt-get upgrade
sudo apt-get install libsqlite3-dev libsqlite3
Abijith Mg
  • 2,647
  • 21
  • 35
  • already tried this, i get the error: Could not find a version that satisfies the requirement pysqlite2 (from versions: ) No matching distribution found for pysqlite2 – RPG Jun 07 '17 at 08:49
  • I think the problem is that I have to reinstall python3.4 to update these installs, but how do I do that ? I am running Ubuntu 16, if I use apt-get remove I am afraid I might delete everything that contains *python* – RPG Jun 07 '17 at 08:52
  • I have tried almost everything I could find in SO, without reinstalling python. Only because i do not know how. – RPG Jun 07 '17 at 08:57
  • With your edit, i get: E: Unable to locate package libsqlite3 – RPG Jun 07 '17 at 08:58
  • Execute sudo apt-get update && sudo apt-get upgrade as per new edit then try. – Abijith Mg Jun 07 '17 at 09:03
  • I still get the same error as above, unable to locate package libsqlite3 :( – RPG Jun 07 '17 at 09:09
0

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.

RPG
  • 198
  • 9