sqlite install, pysqlite installed, but trac-admin ... initenv fails

3 views
Skip to first unread message

kc5tja

unread,
Feb 19, 2007, 3:15:35 PM2/19/07
to Trac Users
This appears to be quite a common occurance, and so far each and every
instance I've found does not address the problem I'm facing. Although
not a problem with Trac as such, it might be a good idea to put up a
Wiki page with a check-list on diagnosing these kinds of errors,
including where files need to be located for Trac software to see
them.

Here is my particular case (Yes, I've searched through mailing list
archives and through the various web pages, but nothing relavent was
found):

$ trac-admin /v/trac initenv

...the interactive part removed for brevity...

Creating and Initializing Project
Failed to create environment. global name 'sqlite' is not defined
Traceback (most recent call last):
File "/usr/lib/python2.5/site-packages/trac/scripts/admin.py", line
613, in do_initenv
options=options)
File "/usr/lib/python2.5/site-packages/trac/env.py", line 124, in
__init__
self.create(options)
File "/usr/lib/python2.5/site-packages/trac/env.py", line 229, in
create
DatabaseManager(self).init_db()
File "/usr/lib/python2.5/site-packages/trac/db/api.py", line 69, in
init_db
connector.init_db(**args)
File "/usr/lib/python2.5/site-packages/trac/db/sqlite_backend.py",
line 121, in init_db
cnx = sqlite.connect(path, timeout=int(params.get('timeout',
10000)))
NameError: global name 'sqlite' is not defined

Now, this would suggest a problem with PySQLite in particular, to me
-- but I used PySQLite's own installer, and it produced no errors at
all. It even reports that it's placing the files in the correct
location:

bash-2.05b$ sudo python setup.py install
Password:
running install
running build
running build_py
running build_ext
running install_lib
running install_data
running install_egg_info
Removing /usr/lib/python2.5/site-packages/pysqlite-2.3.3-py2.5.egg-
info
Writing /usr/lib/python2.5/site-packages/pysqlite-2.3.3-py2.5.egg-info

I see that some files are placed in /v/trac now:

bash-2.05b$ ls -la /v/trac
total 40
drwxr-xr-x 8 kc5tja users 4096 2007-02-19 11:49 .
drwxr-xr-x 13 kc5tja users 4096 2007-02-19 11:49 ..
-rw-r--r-- 1 kc5tja users 98 2007-02-19 11:49 README
-rw-r--r-- 1 kc5tja users 27 2007-02-19 11:49 VERSION
drwxr-xr-x 2 kc5tja users 4096 2007-02-19 11:49 conf
drwxr-xr-x 2 kc5tja users 4096 2007-02-19 11:49 db
drwxr-xr-x 2 kc5tja users 4096 2007-02-19 11:49 htdocs
drwxr-xr-x 2 kc5tja users 4096 2007-02-19 11:49 log
drwxr-xr-x 2 kc5tja users 4096 2007-02-19 11:49 plugins
drwxr-xr-x 2 kc5tja users 4096 2007-02-19 11:49 wiki-macros

Just on the off-chance that something was created, I visited the
project page on the server:

( bash-2.05b$ tracd -p 13502 -e /v/trac :::: then visit localhost:
13502 )

Available Projects

* conf: Error
([Errno 2] No such file or directory: '/v/trac/conf/VERSION')
* db: Error
([Errno 2] No such file or directory: '/v/trac/db/VERSION')
* htdocs: Error
([Errno 2] No such file or directory: '/v/trac/htdocs/VERSION')
* log: Error
([Errno 2] No such file or directory: '/v/trac/log/VERSION')
* plugins: Error
([Errno 2] No such file or directory: '/v/trac/plugins/VERSION')
* wiki-macros: Error
([Errno 2] No such file or directory: '/v/trac/wiki-macros/
VERSION')

If anyone can offer any kind of advice on how to get this resolved,
I'd be most appreciative. Thanks in advance.

kc5tja

unread,
Feb 19, 2007, 3:35:31 PM2/19/07
to Trac Users
Just to follow up, the location of libsqlite3.so.0 (on which the
SQLite Python binding depends on) is here:

/usr/local/lib/libsqlite3.so.0


On Feb 19, 12:15 pm, "kc5tja" <sam.fa...@gmail.com> wrote:
> This appears to be quite a common occurance, and so far each and every
> instance I've found does not address the problem I'm facing. Although
> not a problem with Trac as such, it might be a good idea to put up a
> Wiki page with a check-list on diagnosing these kinds of errors,
> including where files need to be located for Trac software to see
> them.

...

Sorry for forgetting this important piece of info.

--
Samuel A. Falvo II

Emmanuel Blot

unread,
Feb 19, 2007, 4:10:27 PM2/19/07
to trac-...@googlegroups.com
You need to install Trac (the engine) in one location, and to create a
Trac environment (that is, the database and related files) in
*another* directory

A common scenario is to install Trac in the site-packages directory:
/usr/lib/python2.5/site-packages/trac

and to create a Trac environment in the /var tree:
trac-admin /var/trac/project initenv

It appears that you've installed the engine in /v/trac and that you
are attempting to create the environment in the very same directory

HTH,
Manu

Samuel A. Falvo II

unread,
Feb 19, 2007, 4:14:23 PM2/19/07
to trac-...@googlegroups.com
On 2/19/07, Emmanuel Blot <manu...@gmail.com> wrote:
> It appears that you've installed the engine in /v/trac and that you
> are attempting to create the environment in the very same directory

How are you coming to this conclusion?

Trac is installed in the system location (sudo python setup.py install).

Samuel A. Falvo II

unread,
Feb 19, 2007, 4:18:31 PM2/19/07
to trac-...@googlegroups.com
On 2/19/07, Samuel A. Falvo II <sam....@gmail.com> wrote:
> How are you coming to this conclusion?

Actually, you gave me an idea. The various files are located in their
respective system directories, but I never saw any invokation of
ldconfig. Let me try that and see what happens...

Christian Boos

unread,
Feb 19, 2007, 4:28:57 PM2/19/07
to trac-...@googlegroups.com
kc5tja wrote:
> ...

>
> ( bash-2.05b$ tracd -p 13502 -e /v/trac :::: then visit localhost:
>
^^^
-e is for specifying the "parent dir" option, i.e. a folder containing
many Trac environments, so it looks for each subfolder in /v/trac and
checks whether each if them is a Trac environment:

> 13502 )
>
> Available Projects
>
> * conf: Error
> ([Errno 2] No such file or directory: '/v/trac/conf/VERSION')
> * db: Error
> ([Errno 2] No such file or directory: '/v/trac/db/VERSION')
> * htdocs: Error
> ([Errno 2] No such file or directory: '/v/trac/htdocs/VERSION')
> * log: Error
> ([Errno 2] No such file or directory: '/v/trac/log/VERSION')
> * plugins: Error
> ([Errno 2] No such file or directory: '/v/trac/plugins/VERSION')
> * wiki-macros: Error
> ([Errno 2] No such file or directory: '/v/trac/wiki-macros/
> VERSION')
>
> If anyone can offer any kind of advice on how to get this resolved,
> I'd be most appreciative. Thanks in advance.
>
>

Simply omit the "-e" from the above command line.

-- Christian


Emmanuel Blot

unread,
Feb 19, 2007, 5:26:51 PM2/19/07
to trac-...@googlegroups.com
> How are you coming to this conclusion?

I mis-read the output of ls /v/trac ;-)
Sorry.

--
Manu

Samuel A. Falvo II

unread,
Feb 19, 2007, 5:36:57 PM2/19/07
to trac-...@googlegroups.com
On 2/19/07, Emmanuel Blot <manu...@gmail.com> wrote:

Well, I'm pleased to say that everything did install correctly -- it
was just that ldconfig hadn't been run -- I manually ran it, and
everything is groovy now.

Chalk this up to experience for the wiki pages too. :)

Samuel A. Falvo II

unread,
Feb 19, 2007, 5:37:41 PM2/19/07
to trac-...@googlegroups.com
On 2/19/07, Christian Boos <cb...@neuf.fr> wrote:
> Simply omit the "-e" from the above command line.

Yeah, this helped too. :) Thanks for the clarification!

Reply all
Reply to author
Forward
0 new messages