"python2.5 manage.py syncdb" ...No module named _sqlite3

21 views
Skip to first unread message

George

unread,
Apr 7, 2009, 8:39:49 PM4/7/09
to Django users
Hi-

I'm pretty sure this shouldn't happen; but the error is no doubt my
fault. Maybe something about the doc doesn't apply to my system? I
have pkgsrc python2.5 and Django 1.0.2

# python2.5 manage.py syncdb
Traceback (most recent call last):
File "manage.py", line 11, in <module>
execute_manager(settings)
File "/usr/pkg/lib/python2.5/site-packages/django/core/management/
__init__.py", line 340, in execute_manager
utility.execute()
File "/usr/pkg/lib/python2.5/site-packages/django/core/management/
__init__.py", line 295, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/pkg/lib/python2.5/site-packages/django/core/management/
base.py", line 192, in run_from_argv
self.execute(*args, **options.__dict__)
File "/usr/pkg/lib/python2.5/site-packages/django/core/management/
base.py", line 218, in execute
self.validate()
File "/usr/pkg/lib/python2.5/site-packages/django/core/management/
base.py", line 246, in validate
num_errors = get_validation_errors(s, app)
File "/usr/pkg/lib/python2.5/site-packages/django/core/management/
validation.py", line 22, in get_validation_errors
from django.db import models, connection
File "/usr/pkg/lib/python2.5/site-packages/django/db/__init__.py",
line 34, in <module>
(settings.DATABASE_ENGINE, ", ".join(map(repr,
available_backends)), e_user)
django.core.exceptions.ImproperlyConfigured: 'sqlite3' isn't an
available database backend. Available options are: 'creation.pyo',
'dummy', 'postgresql', 'util.pyo'
Error was: No module named _sqlite3

# ls /usr/pkg/lib/python2.5/sqlite3/
dbapi2.py dbapi2.pyc dbapi2.pyo __init__.py __init__.pyc
__init__.pyo test

# which python2.5
/usr/pkg/bin/python2.5

# grep sqlite3 settings.py
DATABASE_ENGINE = 'sqlite3' # 'postgresql_psycopg2',
'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DATABASE_NAME = '/usr/local/dtest/dtest.db' # Or path to
database file if using sqlite3.
DATABASE_USER = '' # Not used with sqlite3.
DATABASE_PASSWORD = '' # Not used with sqlite3.
DATABASE_HOST = '' # Set to empty string for localhost.
Not used with sqlite3.
DATABASE_PORT = '' # Set to empty string for default. Not
used with sqlite3.

Karen Tracey

unread,
Apr 8, 2009, 5:33:34 AM4/8/09
to django...@googlegroups.com
On Tue, Apr 7, 2009 at 8:39 PM, George <geo...@galis.org> wrote:

Hi-

I'm pretty sure this shouldn't happen; but the error is no doubt my
fault. Maybe something about the doc doesn't apply to my system? I
have pkgsrc python2.5 and Django 1.0.2

What sort of a system is this?  I'm not familiar with pkgsrc but it seems to have provided you with an incomplete Python package, or your source build produced an incomplete result.
 

# python2.5 manage.py syncdb
Traceback (most recent call last):
[snip]

 File "/usr/pkg/lib/python2.5/site-packages/django/db/__init__.py",
line 34, in <module>
   (settings.DATABASE_ENGINE, ", ".join(map(repr,
available_backends)), e_user)
django.core.exceptions.ImproperlyConfigured: 'sqlite3' isn't an
available database backend. Available options are: 'creation.pyo',
'dummy', 'postgresql', 'util.pyo'
Error was: No module named _sqlite3

# ls /usr/pkg/lib/python2.5/sqlite3/
dbapi2.py  dbapi2.pyc  dbapi2.pyo  __init__.py  __init__.pyc
__init__.pyo  test

You've got the Python part of sqlite, but you're missing the _sqlite3.so dynamic library.  On my (Ubuntu) machine this is found in /usr/lib/python2.5/lib-dynload. This is generally provided/built as part of Python 2.5, so your Python build/installation seems to be a bit broken.

Karen

George

unread,
Apr 11, 2009, 2:33:32 PM4/11/09
to Django users
Hi Karen,

On Apr 8, 2:33 am, Karen Tracey <kmtra...@gmail.com> wrote:
> On Tue, Apr 7, 2009 at 8:39 PM, George <geo...@galis.org> wrote:
>
> > I'm pretty sure this shouldn't happen; but the error is no doubt my
> > fault. Maybe something about the doc doesn't apply to my system? I
> > have pkgsrc python2.5 and Django 1.0.2
>
> What sort of a system is this?  I'm not familiar with pkgsrc but it seems to
> have provided you with an incomplete Python package, or your source build
> produced an incomplete result.

Thanks for the confirmation, http://pkgsrc.org is a package manager
framework. It is native to NetBSD and designed for easy maintenance
and portability across all/most unix like environments.

It looks like sqlite is not enabled by default in pkgsrc python 2.5;
I'm looking into getting that option worked out. I'm sure to have more
questions after that :)

--George

George

unread,
Apr 11, 2009, 3:33:44 PM4/11/09
to Django users
There is an explanation below, having to do with management
dependencies and dates the versions and packages became available. But
for the record, the solution is to install the py-sqlite3 package in
addition to py-djangoi (with sqlite enabled).

--George

On Sat 11 Apr 2009 at 08:25:04 PM +0200, Joerg Sonnenberger wrote:
>On Sat, Apr 11, 2009 at 11:18:19AM -0700, George Georgalis wrote:
>> it seems sqlite is an option in pkgsrc py25-django, and
>> default upstream... I'm not suggesting it should be one way
>> or another, but why does the pkgsrc version have different
>> default options than the source?
>
>To have a sane dependency set. The errors for missing dependencies are
>even more mysterious. You are most likely hitten by the ironic situation
>of py-sqlite2 being newer than the py-sqlite3 (the builtin)...

On Sat 11 Apr 2009 at 09:07:43 PM +0200, Joerg Sonnenberger wrote:
>On Sat, Apr 11, 2009 at 11:55:24AM -0700, George Georgalis wrote:
>> ( cd /usr/pkgsrc/www/py-django/ && bmake deinstall clean )
>> ( cd /usr/pkgsrc/databases/py-sqlite2 && bmake deinstall clean )
>> ( cd /usr/pkgsrc/databases/py-sqlite3 && bmake install )
>> ( cd /usr/pkgsrc/www/py-django/ && bmake install PKG_OPTIONS.django=sqlite )
>>
>> but py-django still installs py-sqlite2:
>
>Yes, that is expected. The question is: does it work for you after you
>installed py-sqlite3?
Reply all
Reply to author
Forward
0 new messages