pgAdmin4 在 OpenSUSE Leap 15.2 上不显示服务器连接

Posted

技术标签:

【中文标题】pgAdmin4 在 OpenSUSE Leap 15.2 上不显示服务器连接【英文标题】:pgAdmin4 doesn't show server connections on OpenSUSE Leap 15.2 【发布时间】:2021-02-09 18:22:18 【问题描述】:

我已经安装了官方包:

Information for package pgadmin4:
---------------------------------
Repository     : openSUSE-Leap-15.2-1
Name           : pgadmin4
Version        : 4.1-lp152.2.9
Arch           : x86_64
Vendor         : openSUSE
...

它启动正常,打开一个浏览器选项卡。

但是,当我尝试添加服务器连接时,没有任何反应。 “服务器”下没有任何内容。

在某些时候,在卸载、重新启动和再次安装后,连接会短暂显示,但随后又消失了。

在我的主目录中,我看到两个隐藏的日志文件。 .pgAdmin4.startup.log 不包含任何有趣的内容,只是报告一切都已成功启动。另一位有以下说法:

2021-02-09 19:00:22,138: ERROR  werkzeug:   Error on request:
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/werkzeug/serving.py", line 271, in run_wsgi
    execute(self.server.app)
  File "/usr/lib/python3.6/site-packages/werkzeug/serving.py", line 259, in execute
    application_iter = app(environ, start_response)
  File "/usr/lib/python3.6/site-packages/flask/app.py", line 2309, in __call__
    return self.wsgi_app(environ, start_response)
  File "/usr/lib/python3.6/site-packages/flask/app.py", line 2295, in wsgi_app
    response = self.handle_exception(e)
  File "/usr/lib/python3.6/site-packages/flask/app.py", line 1741, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/lib/python3.6/site-packages/flask/_compat.py", line 35, in reraise
    raise value
  File "/usr/lib/python3.6/site-packages/flask/app.py", line 2292, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/lib/python3.6/site-packages/flask/app.py", line 1815, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/lib/python3.6/site-packages/flask/app.py", line 1718, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/lib/python3.6/site-packages/flask/_compat.py", line 35, in reraise
    raise value
  File "/usr/lib/python3.6/site-packages/flask/app.py", line 1813, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/lib/python3.6/site-packages/flask/app.py", line 1799, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/lib/python3.6/site-packages/flask/views.py", line 88, in view
    return self.dispatch_request(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/pgadmin4-web/pgadmin/browser/utils.py", line 259, in dispatch_request
    return method(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/pgadmin4-web/pgadmin/browser/utils.py", line 309, in children
    children.extend(module.get_nodes(*args, **kwargs))
  File "/usr/lib/python3.6/site-packages/pgadmin4-web/pgadmin/browser/server_groups/servers/__init__.py", line 126, in get_nodes
    in_recovery, wal_paused = recovery_state(conn, manager.version)
  File "/usr/lib/python3.6/site-packages/pgadmin4-web/pgadmin/browser/server_groups/servers/__init__.py", line 51, in recovery_state
    status, result = connection.execute_dict(recovery_check_sql)
  File "/usr/lib/python3.6/site-packages/pgadmin4-web/pgadmin/utils/driver/psycopg2/connection.py", line 1199, in execute_dict
    desc.to_dict() for desc in cur.ordered_description()
  File "/usr/lib/python3.6/site-packages/pgadmin4-web/pgadmin/utils/driver/psycopg2/connection.py", line 1199, in <listcomp>
    desc.to_dict() for desc in cur.ordered_description()
  File "/usr/lib/python3.6/site-packages/pgadmin4-web/pgadmin/utils/driver/psycopg2/cursor.py", line 94, in to_dict
    ores = OrderedDict(self.orig_col._asdict())
AttributeError: 'psycopg2.extensions.Column' object has no attribute '_asdict'

psycopg2 存在于/usr/lib64/python3.6/site-packages

# pip show psycopg2
Name: psycopg2
Version: 2.8.5
Summary: psycopg2 - Python-PostgreSQL Database Adapter
Home-page: https://psycopg.org/
Author: Federico Di Gregorio
Author-email: fog@initd.org
License: LGPL with exceptions
Location: /usr/lib64/python3.6/site-packages
Requires: 
Required-by: 

PostgreSQL 服务器在 podman 容器中运行,但这与问题几乎没有关系。此外,我可以使用psql 连接。

有没有人遇到过类似的问题并解决了?

【问题讨论】:

【参考方案1】:

我发现了同样的问题。我发现了这个:pgadmin4 showing 500 (INTERNAL SERVER ERROR) 似乎 OpenSuse 更新了 psycopg2 的版本,但还没有更新 pgadmin4 的版本 :(

就我而言,最简单的解决方法是使用 Fedora 的 rpm 包安装旧(兼容)版本的 psycopg2:http://rpm.pbone.net/info_idpl_63870838_distro_redhat_el_7_com_python3-psycopg2-2.7.7-2.el7.x86_64.rpm.html

您可以使用--oldpackage 标志安装它,例如: sudo zypper install --oldpackage python3-psycopg2-2.7.7-2.el7.x86_64.rpm

【讨论】:

以上是关于pgAdmin4 在 OpenSUSE Leap 15.2 上不显示服务器连接的主要内容,如果未能解决你的问题,请参考以下文章

通过终端在 openSUSE Leap 中安装 Python

安装 openSUSE Leap 42.1 之后要做的 8 件事

openSUSE-Leap-15.1配置网络和防火墙

安装 openSUSE Leap 42.1 之后要做的 8 件事

「编程工具」openSUSE Leap 15.1 正式发布

如何在 openSUSE Leap 42.2 上安装 libXScrnSaver