dalibo / pg_activity

pg_activity is a top like application for PostgreSQL server activity monitoring.
PostgreSQL License
2.48k stars 179 forks source link

packaged pg-activity not running on ubuntu 20.04 #325

Closed b0n0r closed 1 year ago

b0n0r commented 1 year ago

installed from Postgresql.Org repo:

2022-11-14 09:25:16 status installed python3-wcwidth:all 0.1.8+dfsg1-3
2022-11-14 09:25:17 status installed python3-psycopg2:amd64 2.8.6-2~pgdg20.04+1
2022-11-14 09:25:17 status installed python3-humanize:all 1.0.0-1
2022-11-14 09:25:17 status installed python3-blessed:all 1.16.1-1
2022-11-14 09:25:17 status installed pg-activity:all 3.0.1-1.pgdg20.04+1
2022-11-14 09:25:18 status installed man-db:amd64 2.9.1-1

package is installed:

ii pg-activity 3.0.1-1.pgdg20.04+1 all Realtime PostgreSQL database server monitoring tool

however is unable to start:

$ pg_activity --help
Traceback (most recent call last):
  File "/usr/bin/pg_activity", line 11, in <module>
    load_entry_point('pg-activity==3.0.1', 'console_scripts', 'pg_activity')()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 490, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2854, in load_entry_point
    return ep.load()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2445, in load
    return self.resolve()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2451, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/lib/python3/dist-packages/pgactivity/cli.py", line 13, in <module>
    from . import __version__, data, types, ui
  File "/usr/lib/python3/dist-packages/pgactivity/data.py", line 24, in <module>
    from .types import (
  File "/usr/lib/python3/dist-packages/pgactivity/types.py", line 25, in <module>
    from . import compat, colors, utils
  File "/usr/lib/python3/dist-packages/pgactivity/colors.py", line 1, in <module>
    from . import utils
  File "/usr/lib/python3/dist-packages/pgactivity/utils.py", line 12, in <module>
    humanize.precisedelta,
AttributeError: module 'humanize' has no attribute 'precisedelta'

there is nothing specific or exotic about the environment, simple box that runs postgresql and sshd, that's about it.

dlax commented 1 year ago

That's a problem in the Debian packaging, nothing we can do on our side.

deric commented 1 year ago

@b0n0r A workaround is to update humanize package, which is outdated in Debian Buster (and derived distributions):

python3 -m pip install -U humanize
lanaparadinha commented 1 year ago

after updte humanize that error ocurred: postgres@xxxxxxx:~$ pg_activity

Traceback (most recent call last): File "/usr/bin/pg_activity", line 11, in load_entry_point('pg-activity==3.0.1', 'console_scripts', 'pg_activity')() File "/usr/lib/python3/dist-packages/pgactivity/cli.py", line 407, in main ui.main(term, dataobj, host, args) File "/usr/lib/python3/dist-packages/pgactivity/ui.py", line 205, in main pg_procs.set_items(data.pg_get_activities(ui.duration_mode)) File "/usr/lib/python3/dist-packages/pgactivity/data.py", line 438, in pg_get_activities "dbname_filter": self.filters.dbname, File "/var/lib/postgresql/.local/lib/python3.6/site-packages/psycopg2/extras.py", line 146, in execute return super().execute(query, vars) psycopg2.errors.SyntaxError: syntax error at or near "\" LINE 16: convert_from(replace(a.query, '\', '\')::bytea, coale... ^

dlax commented 1 year ago

psycopg2.errors.SyntaxError: syntax error at or near "" LINE 16: convert_from(replace(a.query, '', '\')::bytea, coale...

This particular problem got resolved in a later release (3.1.0) of pg_activity. Unfortunately, it's not available in Debian/Ubuntu (yet).