[Baypiggies] Python & Django: No module named _sqlite3

Simeon Franklin simeonf at gmail.com
Mon Aug 16 20:31:48 CEST 2010


See http://stackoverflow.com/questions/233320/cannot-import-sqlite-with-python-2-6

It looks like there are problems building python from source with
sqlite3 support if the sqlite dev headers aren't installed. Can you
find the missing .so file ($ locate _sqlite3.so)? If so I would
symlink it into the python site-packages directory...

-regards
Simeon Franklin


On Mon, Aug 16, 2010 at 10:43 AM, Tom Simons <tom.simons at gmail.com> wrote:
> Python newbie here - I've been replacing our awk & ksh scripts for reports
> with it.  I liked the Django demo on Windows so much that I volunteered to
> implement our tiny website using Django on RHEL AS5 Linux boxes.
>
> Now I'm running into trouble getting Python, Django, & SQLite working on
> RHEL AS5.  I don't really require compiling from source, but I did so to get
> the latest versions (& I thought Python > 2.5 came with SQLite already
> installed).
>
> What am I missing in the installs below? The Django "manage.py syncdb" gets
> error "No module named _sqlite3".
>
> Does Django installation require more than the link to
> Python-2.7/lib/python2.7/site-packages?
>
> $ tar xf Python-2.7.tgz                      #Install Python 2.7
> $ cd Python-2.7
> $ mkdir           /apps/Python-2.7
> $ chown simonst   /apps/Python-2.7
> $ ./configure --prefix=/apps/Python-2.7
> $ make
> $ sudo make install
> $ export PATH=/apps/Python-2.7/bin:$PATH
> $ python -V
> Python 2.7
>
>
> $ tar xzf sqlite-amalgamation-3.7.0.1.tar.gz #Install sqlite 3.7.0.1
> $ cd sqlite-3.7.0.1
> $ ./configure --prefix=/apps/sqlite-3.7.0
> $ make
> $ sudo make install
> $ export PATH=/apps/sqlite-3.7.0/bin:$PATH
> $ sqlite3 -version
> 3.7.0.1
>
> $ sudo tar xzf Django-1.2.1.tar.gz -C /apps  #Install Django 1.2.1
> $ cd /apps/Django-1.2.1
> $ sudo ln -s /apps/Django-1.2.1/django
> /apps/Python-2.7/lib/python2.7/site-packages
> $ export PATH=/apps/Django-1.2.1/django/bin:$PATH
> $ django-admin.py --version
> 1.2.1
>
>  (see attachment for more detail)
>
> $ django-admin.py startproject mysite        #Start Django project
> $ cd mysite
> $ ./manage.py runserver                      #Show Django dev server is ok
> $ ./manage.py startapp blog                  #Start Django Blog app
> $ vi  blog/models.py
> $ vi settings.py
>
> $ ./manage.py syncdb                         #Build database
> Traceback (most recent call last):
>   File "./manage.py", line 11, in <module>
>   .  .  .  .  .
>   File
> "/apps/Python-2.7/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py",
> line 34, in <module>
>     raise ImproperlyConfigured("Error loading %s: %s" % (module, exc))
> django.core.exceptions.ImproperlyConfigured: Error loading either pysqlite2
> or sqlite3 modules (tried in that order): No module named _sqlite3
>
>
> _______________________________________________
> Baypiggies mailing list
> Baypiggies at python.org
> To change your subscription options or unsubscribe:
> http://mail.python.org/mailman/listinfo/baypiggies
>


More information about the Baypiggies mailing list