Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Trac error: upgrade of trac.db.api.DatabaseManager: Unsupported database type "postgres"

30 views
Skip to first unread message

Joost Kraaijeveld

unread,
Feb 19, 2025, 2:53:32 AMFeb 19
to trac-...@googlegroups.com
Hi,

Suddenly I get this message from Trac:

"Trac Error

TracError: Unable to check for upgrade of trac.db.api.DatabaseManager:
TracError: Unsupported database type "postgres"

The trac.log-file says:

2025-02-17 09:04:58,282 Trac[env] INFO: -------------------------------
- environment startup [Trac 1.6] --------------------------------
2025-02-17 09:04:58,589 Trac[postgres_backend] WARNING: Exception
caught while retrieving libpq's version
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/trac/db/postgres_backend.py",
line 299, in _client_version
lib = ctypes.CDLL(_libpq_pathname)
File "/usr/lib/python3.13/ctypes/__init__.py", line 353, in __init__
if name.endswith(".fwork"):
~~~~~~~~~~~~~^^^^^^^^^^
TypeError: endswith first arg must be bytes or a tuple of bytes, not
str

Anyone an idea about a solution?

TIA,

Gr

Joost

Jun Omae

unread,
Feb 19, 2025, 6:00:44 AMFeb 19
to trac-...@googlegroups.com
Hi,
The issue has been filed at https://trac.edgewall.org/ticket/13803.
I think that that is an issue of Python 3.13, but I've fixed it.

Please apply the changes of https://trac.edgewall.org/changeset/17863
to your Trac.

--
Jun Omae <jun...@gmail.com> (大前 潤)

Joost Kraaijeveld

unread,
Feb 22, 2025, 5:55:47 AMFeb 22
to trac-...@googlegroups.com
> The issue has been filed at https://trac.edgewall.org/ticket/13803.
> I think that that is an issue of Python 3.13, but I've fixed it.
>
> Please apply the changes of https://trac.edgewall.org/changeset/17863
> to your Trac.

Alas, that did not solve the problem. The for-mentioned exception is
gone but this error remains:

025-02-22 11:42:58,659 Trac[env] WARNING: Component <Component trac.db.api.DatabaseManager> failed with TracError: Unsupported database type "postgres"
2025-02-22 11:42:58,659 Trac[env] ERROR: Exception caught while checking for upgrade: TracError: Unable to check for upgrade of trac.db.api.DatabaseManager: TracError: Unsupported database type "postgres"

--
Groeten,

Joost Kraaijeveld

Jun Omae

unread,
Feb 22, 2025, 7:24:00 AMFeb 22
to trac-...@googlegroups.com
Please describe:

* How did you apply the changes?
* Share the stacktrace of the error, again (the lineno should be changed if the applying is correct)
* Share your environment information (OS, PostgreSQL version, ...)

That is unable to reproduce it. I believe what did you do have something wrong.


Jun Omae <jun...@gmail.com> (大前 潤)
--
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 visit https://groups.google.com/d/msgid/trac-users/efc12a7a0fe4c2647b385a1ea59077daf84bc0c7.camel%40Askesis.nl.

Joost Kraaijeveld

unread,
Feb 22, 2025, 10:00:07 AMFeb 22
to trac-...@googlegroups.com
On Sat, 2025-02-22 at 21:23 +0900, Jun Omae wrote:
> * How did you apply the changes?

I download the source version of Debian's Trac 1.6. I copied and pasted
the changes into postgres_backend manually. I compared it with the same
file from https://svn.edgewall.org/repos/trac/branches/1.6-stable .
They were identical. Than I created a Debian .deb file.

1 test failed during the build:
E: pybuild pybuild:389: test: plugin distutils failed with: exit
code=1: cd /opt/disks/datadisk1/home/jkr/src/debian/trac-
1.6/.pybuild/cpython3_3.13/build; python3.13 -m unittest discover -v

The installation (dpkg -i trac_1.6-3.1_all.deb) was succesfull.

> * Share the stacktrace of the error, again (the lineno should be
> changed if the applying is correct)
There is no stack trace, even if I set the logging to DEBUG. Full log
attached. 

The line saying "2025-02-22 15:49:44,797 Trac[loader] DEBUG: Skipping
"trac.db.postgres = trac.db.postgres_backend": DistributionNotFound:
The 'psycopg2>=2.0 or psycopg2-binary' distribution was not found and
is required by Trac" is wrong. I have psycopg2 2.9.10-1 installed

> * Share your environment information (OS, PostgreSQL version, ...)


Debian Trixie:

Kernel: Linux 6.12.12-amd64 (SMP w/32 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE,
TAINT_UNSIGNED_MODULE
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8),
LANGUAGE=en_GB:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages trac depends on:
ii libjs-excanvas 0.r4~git20200903.44ac99f-1
ii libjs-jquery 3.6.1+dfsg+~3.5.14-1
ii libjs-jquery-timepicker 1.6.3-6
ii libjs-jquery-ui 1.13.2+dfsg-1
ii python3 [python3-supported-max] 3.13.1-2
ii python3-jinja2 3.1.5-2
ii python3-multipart 1.2.1-2
ii python3-pkg-resources 75.6.0-1
ii python3-setuptools 75.6.0-1

Versions of packages trac recommends:
ii apache2 [httpd] 2.4.63-1
ii python3-babel 2.17.0-1
ii python3-docutils 0.21.2+dfsg-2
ii python3-pygments 2.18.0+dfsg-2
ii python3-subversion 1.14.5-2+b2
ii python3-tz 2025.1-3

Versions of packages trac suggests:
pn libapache2-mod-wsgi <none>
ii python3-psycopg2 2.9.10-1
ii python3-textile 1:4.0.2-2
ii trac-wikiprint 4.0.0+svn18614+really3.0.0+svn18295-1
ii trac-wysiwyg 0.12.0.7+svn18546-2
ii trac-xmlrpc 1.2.0+svn18521-2

Version of Postgresql: 17.3-3

--
Groeten,

Joost Kraaijeveld

trac.log

Jun Omae

unread,
Feb 22, 2025, 11:09:58 AMFeb 22
to trac-...@googlegroups.com
On 2025/02/22 23:59, 'Joost Kraaijeveld' via Trac Users wrote:
> The line saying "2025-02-22 15:49:44,797 Trac[loader] DEBUG: Skipping
> "trac.db.postgres = trac.db.postgres_backend": DistributionNotFound:
> The 'psycopg2>=2.0 or psycopg2-binary' distribution was not found and
> is required by Trac" is wrong. I have psycopg2 2.9.10-1 installed

Your created trac debian package is broken.
The error is not occurred with debian:trixie-slim image and python3-psycopg2.

# apt install -yqq subversion python3-psycopg2 python3.13-venv
# python3 -m venv --system-site-packages /tmp/venv
# /tmp/venv/bin/pip install svn+https://svn.edgewall.org/repos/trac/branches/1.6-stable
# /tmp/venv/bin/trac-admin /tmp/tracenv initenv 'My Project' 'postgres://tracuser:pass...@192.168.11.122/trac?schema=debian_trixie'
# /tmp/venv/bin/trac-admin /tmp/tracenv config set logging log_level DEBUG
# /tmp/venv/bin/trac-admin /tmp/tracenv config set logging log_type stderr
# /tmp/venv/bin/trac-admin /tmp/tracenv upgrade
15:57:41 Trac[env] INFO: -------------------------------- environment startup [Trac 1.6.1.dev0] --------------------------------
15:57:41 Trac[loader] DEBUG: Loading plugin "trac.about" from "/tmp/venv/lib/python3.13/site-packages"
15:57:41 Trac[loader] DEBUG: Loading plugin "trac.admin.console" from "/tmp/venv/lib/python3.13/site-packages"
15:57:41 Trac[loader] DEBUG: Loading plugin "trac.admin.web_ui" from "/tmp/venv/lib/python3.13/site-packages"
15:57:41 Trac[loader] DEBUG: Loading plugin "trac.attachment" from "/tmp/venv/lib/python3.13/site-packages"
15:57:41 Trac[loader] DEBUG: Loading plugin "trac.db.mysql" from "/tmp/venv/lib/python3.13/site-packages"
15:57:41 Trac[loader] DEBUG: Skipping "trac.db.mysql = trac.db.mysql_backend [mysql]": DistributionNotFound: The 'PyMySQL; extra == "mysql"' distribution was not found and is required by the application
15:57:41 Trac[loader] DEBUG: Loading plugin "trac.db.postgres" from "/tmp/venv/lib/python3.13/site-packages"
15:57:41 Trac[loader] DEBUG: Loading plugin "trac.db.sqlite" from "/tmp/venv/lib/python3.13/site-packages"
15:57:41 Trac[loader] DEBUG: Loading plugin "trac.mimeview.patch" from "/tmp/venv/lib/python3.13/site-packages"
15:57:41 Trac[loader] DEBUG: Loading plugin "trac.mimeview.pygments" from "/tmp/venv/lib/python3.13/site-packages"
15:57:41 Trac[loader] DEBUG: Loading plugin "trac.mimeview.rst" from "/tmp/venv/lib/python3.13/site-packages"
15:57:41 Trac[loader] DEBUG: Loading plugin "trac.mimeview.txtl" from "/tmp/venv/lib/python3.13/site-packages"
15:57:41 Trac[loader] DEBUG: Skipping "trac.mimeview.txtl = trac.mimeview.txtl [textile]": DistributionNotFound: The 'textile>=2.3; extra == "textile"' distribution was not found and is required by the application
15:57:41 Trac[loader] DEBUG: Loading plugin "trac.notification.api" from "/tmp/venv/lib/python3.13/site-packages"
15:57:41 Trac[loader] DEBUG: Loading plugin "trac.notification.mail" from "/tmp/venv/lib/python3.13/site-packages"
15:57:41 Trac[loader] DEBUG: Loading plugin "trac.notification.prefs" from "/tmp/venv/lib/python3.13/site-packages"
15:57:41 Trac[loader] DEBUG: Loading plugin "trac.prefs" from "/tmp/venv/lib/python3.13/site-packages"
15:57:41 Trac[loader] DEBUG: Loading plugin "trac.search" from "/tmp/venv/lib/python3.13/site-packages"
15:57:41 Trac[loader] DEBUG: Loading plugin "trac.ticket.admin" from "/tmp/venv/lib/python3.13/site-packages"
15:57:41 Trac[loader] DEBUG: Loading plugin "trac.ticket.batch" from "/tmp/venv/lib/python3.13/site-packages"
15:57:41 Trac[loader] DEBUG: Loading plugin "trac.ticket.notification" from "/tmp/venv/lib/python3.13/site-packages"
15:57:41 Trac[loader] DEBUG: Loading plugin "trac.ticket.query" from "/tmp/venv/lib/python3.13/site-packages"
15:57:41 Trac[loader] DEBUG: Loading plugin "trac.ticket.report" from "/tmp/venv/lib/python3.13/site-packages"
15:57:41 Trac[loader] DEBUG: Loading plugin "trac.ticket.roadmap" from "/tmp/venv/lib/python3.13/site-packages"
15:57:41 Trac[loader] DEBUG: Loading plugin "trac.ticket.web_ui" from "/tmp/venv/lib/python3.13/site-packages"
15:57:41 Trac[loader] DEBUG: Loading plugin "trac.timeline" from "/tmp/venv/lib/python3.13/site-packages"
15:57:41 Trac[loader] DEBUG: Loading plugin "trac.versioncontrol.admin" from "/tmp/venv/lib/python3.13/site-packages"
15:57:41 Trac[loader] DEBUG: Loading plugin "trac.versioncontrol.svn_authz" from "/tmp/venv/lib/python3.13/site-packages"
15:57:41 Trac[loader] DEBUG: Loading plugin "trac.versioncontrol.web_ui" from "/tmp/venv/lib/python3.13/site-packages"
15:57:41 Trac[loader] DEBUG: Loading plugin "trac.web.auth" from "/tmp/venv/lib/python3.13/site-packages"
15:57:41 Trac[loader] DEBUG: Loading plugin "trac.web.main" from "/tmp/venv/lib/python3.13/site-packages"
15:57:41 Trac[loader] DEBUG: Loading plugin "trac.web.session" from "/tmp/venv/lib/python3.13/site-packages"
15:57:41 Trac[loader] DEBUG: Loading plugin "trac.wiki.admin" from "/tmp/venv/lib/python3.13/site-packages"
15:57:41 Trac[loader] DEBUG: Loading plugin "trac.wiki.interwiki" from "/tmp/venv/lib/python3.13/site-packages"
15:57:41 Trac[loader] DEBUG: Loading plugin "trac.wiki.macros" from "/tmp/venv/lib/python3.13/site-packages"
15:57:41 Trac[loader] DEBUG: Loading plugin "trac.wiki.web_api" from "/tmp/venv/lib/python3.13/site-packages"
15:57:41 Trac[loader] DEBUG: Loading plugin "trac.wiki.web_ui" from "/tmp/venv/lib/python3.13/site-packages"
15:57:41 Trac[loader] DEBUG: Loading plugin "tracopt.perm.authz_policy" from "/tmp/venv/lib/python3.13/site-packages"
15:57:41 Trac[loader] DEBUG: Loading plugin "tracopt.perm.config_perm_provider" from "/tmp/venv/lib/python3.13/site-packages"
15:57:41 Trac[loader] DEBUG: Loading plugin "tracopt.ticket.clone" from "/tmp/venv/lib/python3.13/site-packages"
15:57:41 Trac[loader] DEBUG: Loading plugin "tracopt.ticket.commit_updater" from "/tmp/venv/lib/python3.13/site-packages"
15:57:41 Trac[loader] DEBUG: Loading plugin "tracopt.ticket.deleter" from "/tmp/venv/lib/python3.13/site-packages"
15:57:41 Trac[loader] DEBUG: Loading plugin "tracopt.versioncontrol.git.git_fs" from "/tmp/venv/lib/python3.13/site-packages"
15:57:41 Trac[loader] DEBUG: Loading plugin "tracopt.versioncontrol.svn.svn_fs" from "/tmp/venv/lib/python3.13/site-packages"
15:57:41 Trac[loader] DEBUG: Loading plugin "tracopt.versioncontrol.svn.svn_prop" from "/tmp/venv/lib/python3.13/site-packages"
15:57:41 Trac[default_workflow] DEBUG: Workflow actions at initialization: defaultdict(<class 'dict'>, {'accept': {'oldstates': ['new', 'assigned', 'accepted', 'reopened'], 'newstate': 'accepted', 'operations': ['set_owner_to_self'], 'permissions': ['TICKET_MODIFY'], 'label': 'accept', 'name': '', 'default': 0}, 'create': {'oldstates': [None], 'newstate': 'new', 'default': 1, 'label': 'create', 'name': '', 'operations': [], 'permissions': []}, 'create_and_assign': {'oldstates': [None], 'newstate': 'assigned', 'label': 'assign', 'operations': ['may_set_owner'], 'permissions': ['TICKET_MODIFY'], 'name': '', 'default': 0}, 'leave': {'oldstates': ['*'], 'newstate': '*', 'default': 1, 'operations': ['leave_status'], 'label': 'leave', 'name': '', 'permissions': []}, 'reassign': {'oldstates': ['new', 'assigned', 'accepted', 'reopened'], 'newstate': 'assigned', 'operations': ['set_owner'], 'permissions': ['TICKET_MODIFY'], 'label': 'reassign', 'name': '', 'default': 0}, 'reopen': {'oldstates': ['closed'], 'newstate': 'reopened', 'operations': ['del_resolution'], 'permissions': ['TICKET_CREATE'], 'label': 'reopen', 'name': '', 'default': 0}, 'resolve': {'oldstates': ['new', 'assigned', 'accepted', 'reopened'], 'newstate': 'closed', 'operations': ['set_resolution'], 'permissions': ['TICKET_MODIFY'], 'label': 'resolve', 'name': '', 'default': 0}, '_reset': {'default': 0, 'label': 'Reset', 'newstate': 'new', 'oldstates': [], 'operations': ['reset_workflow'], 'permissions': ['TICKET_ADMIN']}})

Database is up to date, no upgrade necessary.


--

Joost Kraaijeveld

unread,
Feb 22, 2025, 12:06:56 PMFeb 22
to trac-...@googlegroups.com
Thanks for looking into my problem.

I am a bit confused though. You "pip install" "1.6-stable" but the
environment startup says "1.6.1.dev0". 

Are they the same?

--
Groeten,

Joost Kraaijeveld

Jun Omae

unread,
Feb 22, 2025, 12:41:48 PMFeb 22
to trac-...@googlegroups.com
Same.


Jun Omae <jun...@gmail.com> (大前 潤)
--
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.
Reply all
Reply to author
Forward
0 new messages