Re: [pysqlite] failed installation

Gerhard Häring <[email protected]> Thu, 22 Jan 2009 09:31:43 +0100
Newsgroups gmane.comp.python.db.pysqlite.user
Message-ID <[email protected]>
Michael P. Soulier wrote:
> On 21/01/09 Gerhard H?ring said:
> 
>> Yep. Apparently your *SQLite* was compiled with nonstandard settings. 
>> pysqlite doesn't like that - it assumes SQLite was not compiled with any 
>> --disable-this-feature or --disable-that-feature.
> 
> Yeah, that's Gentoo for you.
> 
> I suppose I could build my own sqlite with default options and build pysqlite
> against that...
> 
>> A quick solution is that you open src/connection.c and remove these lines:
>>
>> #if SQLITE_VERSION_NUMBER >= 3003008
>> #define HAVE_LOAD_EXTENSION
>> #endif
>>
>> This will lead to HAVE_LOAD_EXTENSION not being defined and the 
>> extension loading code of pysqlite not being compiled.
> 
> Trying that now. 
> 
> This is ugly...

What's ugly is that SQLite3 doesn't include any sqlite3_config.h from
sqlite3.h that sets flags so that client applications can know what's
there and what isn't.

> msoulier@anton:...mp/pysqlite-2.5.1$ ~/work/msl8/bin/python setup.py install
> running install
> running build
> running build_py
> running build_ext
> running install_lib
> copying build/lib.linux-i686-2.3/pysqlite2/_sqlite.so ->
> /home/msoulier/work/msl8/lib/python2.3/site-packages/pysqlite2
> byte-compiling
> /home/msoulier/work/msl8/lib/python2.3/site-packages/pysqlite2/test/py25tests.py
> to py25tests.pyc
>   File
> "/home/msoulier/work/msl8/lib/python2.3/site-packages/pysqlite2/test/py25tests.py",
> line 48
>     with self.con:
>             ^
> SyntaxError: invalid syntax
> running install_data
> 
> Shouldn't py25tests only run on python 2.5+?

distutils is just byte-compilinga all .py files here. The py25tests
won't be run with Python < 2.5.

> Hmm. Doesn't seem to help my problem.
> 
> msoulier@anton:...mp/pysqlite-2.5.1$ ~/work/msl8/bin/python                 
> Python 2.3.7 (#1, Jan 19 2009, 22:14:23) 
> [GCC 4.1.2 (Gentoo 4.1.2 p1.1)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> from pysqlite2 import dbapi2 as sqlite
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
>   File "pysqlite2/dbapi2.py", line 27, in ?
>     from pysqlite2._sqlite import *
> ImportError: No module named _sqlite

Hmm. There's another one: In setup.cfg, remove

define=HAVE_LOAD_EXTENSION

Now it should work. Unless Gentoo has disabled other features like
authorizers etc., too. In which case, the fun will continue.

-- Gerhard