Fresh install of trac 1.4.3 can't find module _sqlite when running trac-admin initenv

13 views
Skip to first unread message

Rick Macdonald

unread,
Mar 19, 2023, 1:31:28 AM3/19/23
to Trac Users
I've been running Trac for 12 years, but stopped upgrading it at 1.0.3. It recently stopped working. Attempts to upgrade it in place failed with the same error as the installed instance (package  'six' not found).  So I backed it up, moved it out of the way, and started fresh installing v1.4.3.

I'm just about there, but after installing the prerequisites and Trac,  now trac-admin initenv fails. I'm stumped!

$ trac-admin $TRAC_ENV  initenv
Traceback (most recent call last):
  File "/home/user/opt/python-2.7.18/bin/trac-admin", line 5, in <module>
    from trac.admin.console import run
  File "/home/user/opt/python-2.7.18/lib/python2.7/site-packages/trac/admin/console.py", line 36, in <module>
    from trac.env import Environment
  File "/home/user/opt/python-2.7.18/lib/python2.7/site-packages/trac/env.py", line 42, in <module>
    from trac.db.convert import copy_tables
  File "/home/user/opt/python-2.7.18/lib/python2.7/site-packages/trac/db/convert.py", line 18, in <module>
    from trac.db import sqlite_backend
  File "/home/user/opt/python-2.7.18/lib/python2.7/site-packages/trac/db/sqlite_backend.py", line 39, in <module>
    import sqlite3 as sqlite
  File "/home/user/opt/python-2.7.18/lib/python2.7/sqlite3/__init__.py", line 24, in <module>
    from dbapi2 import *
  File "/home/user/opt/python-2.7.18/lib/python2.7/sqlite3/dbapi2.py", line 28, in <module>
    from _sqlite3 import *
ImportError: No module named _sqlite3

Rick

Jun Omae

unread,
Mar 19, 2023, 2:09:50 AM3/19/23
to trac-...@googlegroups.com
Your python installation is broken. The sqlite3 module in python 2.7 is typically available. You can verify with the following command:

/home/user/opt/python-2.7.18/bin/python -c "import sqlite3"
--
Jun Omae <jun...@gmail.com> (大前 潤)

Rick Macdonald

unread,
Mar 19, 2023, 2:50:06 AM3/19/23
to Trac Users
Same error. I just built this python today. Is there a configure option I needed to turn on?

$ /home/user/opt/python-2.7.18/bin/python -c "import sqlite3"

Traceback (most recent call last):
  File "<string>", line 1, in <module>

  File "/home/user/opt/python-2.7.18/lib/python2.7/sqlite3/__init__.py", line 24, in <module>
    from dbapi2 import *
  File "/home/user/opt/python-2.7.18/lib/python2.7/sqlite3/dbapi2.py", line 28, in <module>
    from _sqlite3 import *
ImportError: No module named _sqlite3

Jun Omae

unread,
Mar 19, 2023, 3:20:05 AM3/19/23
to trac-...@googlegroups.com
What kind of distribution are you using? How did you build the installed python? Unable to help due to less information.

On Sun, Mar 19, 2023 at 15:50 Rick Macdonald <sailo...@gmail.com> wrote:
Same error. I just built this python today. Is there a configure option I needed to turn on?

$ /home/user/opt/python-2.7.18/bin/python -c "import sqlite3"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/user/opt/python-2.7.18/lib/python2.7/sqlite3/__init__.py", line 24, in <module>
    from dbapi2 import *
  File "/home/user/opt/python-2.7.18/lib/python2.7/sqlite3/dbapi2.py", line 28, in <module>
    from _sqlite3 import *
ImportError: No module named _sqlite3
--

sailorickm

unread,
Mar 19, 2023, 3:20:51 AM3/19/23
to trac-...@googlegroups.com
I think configure would have included it if it found it. I don't  have root or sudo access on this host so maybe the only option is to build a local copy for configure to find?

Jun Omae

unread,
Mar 19, 2023, 7:17:06 AM3/19/23
to trac-...@googlegroups.com
Yes. Required libraries should be built in local (e.g. $HOME/lib) and be passed to configure options. I suggest to check warnings in build log of the python.

On Sun, Mar 19, 2023 at 16:20 sailorickm <sailo...@gmail.com> wrote:
I think configure would have included it if it found it. I don't  have root or sudo access on this host so maybe the only option is to build a local copy for configure to find?
--

Rick Macdonald

unread,
Mar 20, 2023, 9:07:37 PM3/20/23
to trac-...@googlegroups.com
Thanks! This finally got the build to include sqlite3:

CPPFLAGS=-I/home/wsiuser/.local/include ./configure --prefix=$HOME/opt/python-2.7.18 --with-ensurepip=install

--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/trac-users/CAEVLMahW-RC0mOma8yG5c06hdrLB7uBnNvE0Rg6Fm%2BoYK%3Dicug%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages