Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (6.1k points)
edited by

I am trying to run a Django app on my VPS running on Debian 5. When I'm running a demo app, it results with this below error:

File "/usr/local/lib/python2.5/site-packages/django/utils/importlib.py", line 35, in     import_module
    __import__(name)

  File "/usr/local/lib/python2.5/site-packages/django/db/backends/sqlite3/base.py", line 30, in <module>
    raise ImproperlyConfigured, "Error loading %s: %s" % (module, exc)

ImproperlyConfigured: Error loading either pysqlite2 or sqlite3 modules (tried in that     order): No module named _sqlite3

Looking at the Python install, it gives the same type of error: 

Python 2.5.2 (r252:60911, May 12 2009, 07:46:31) 
[GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.5/sqlite3/__init__.py", line 24, in <module>
    from dbapi2 import *
  File "/usr/local/lib/python2.5/sqlite3/dbapi2.py", line 27, in <module>
    from _sqlite3 import *
ImportError: No module named _sqlite3
>>>

Reading on the web, I learnt that Python 2.5 should come with all the necessary SQLite wrappers included. So now do I have to reinstall the Python, or is there another way to get this module up and running? 

1 Answer

0 votes
by (12.7k points)
edited by

I too had the same problem (building python2.5 from the source on Ubuntu Lucid), and import sqlite3 threw this same exception. I had installed libsqlite3-dev from the package manager, recompiled python2.5, and then the import worked.

If you want to learn more about SQL, Check out this SQL Certification by Intellipaat.

For more information visit :

Browse Categories

...