Manjaro

pgadmin4 啟動應用伺服器失敗

  • August 26, 2021

當我在 manjaro xfce 中打開 pgadmin4 時,彈出此錯誤消息說

初始化 pgadmin 4 伺服器時發生錯誤:無法啟動應用程序伺服器,伺服器執行緒正在退出。

錯誤資訊

我檢查了日誌

啟動日誌

2021-08-26 09:35:29: Checking for system tray...
2021-08-26 09:35:29: Starting pgAdmin4 server...
2021-08-26 09:35:29: Creating server object, port:42505, key:fdcf6315-03b8-4a0c-a4cc-c8e6efc3f38e, logfile:/home/thenujan/.local/share/pgadmin4.d41d8cd98f00b204e9800998ecf8427e.log
2021-08-26 09:35:29: Python Path: /usr/lib/python3.9:/usr/lib/python3.9/lib-dynload:/usr/lib/python3.9/site-packages
2021-08-26 09:35:29: Python Home: /usr/lib/python3.9
2021-08-26 09:35:29: Initializing Python...
2021-08-26 09:35:29: Python initialized.
2021-08-26 09:35:29: Adding new additional path elements
2021-08-26 09:35:29: Redirecting stderr...
2021-08-26 09:35:29: stderr redirected successfully.
2021-08-26 09:35:29: Initializing server...
2021-08-26 09:35:29: Webapp Path: /usr/lib/pgadmin4/web/pgAdmin4.py
2021-08-26 09:35:29: Server initialized, starting server thread...
2021-08-26 09:35:29: Open the application code and run it.
2021-08-26 09:35:29: Set the port number, key and force SERVER_MODE off
2021-08-26 09:35:29: PyRun_SimpleFile launching application server...
2021-08-26 09:35:30: Failed to launch the application server, server thread exiting.

伺服器日誌

Traceback (most recent call last):
 File "/usr/lib/pgadmin4/web/pgAdmin4.py", line 35, in <module>
   import config
 File "/usr/lib/pgadmin4/web/config.py", line 25, in <module>
   from pgadmin.utils import env, IS_WIN, fs_short_path
 File "/usr/lib/pgadmin4/web/pgadmin/__init__.py", line 28, in <module>
   from flask_security import Security, SQLAlchemyUserDatastore, current_user
 File "/usr/lib/python3.9/site-packages/flask_security/__init__.py", line 15, in <module>
   from .core import Security, RoleMixin, UserMixin, AnonymousUser, current_user
 File "/usr/lib/python3.9/site-packages/flask_security/core.py", line 48, in <module>
   from .mail_util import MailUtil
 File "/usr/lib/python3.9/site-packages/flask_security/mail_util.py", line 14, in <module>
   import email_validator
ModuleNotFoundError: No module named 'email_validator'

我確實嘗試安裝 email_validator

通過使用 pip pip install email_validator 但它仍然向我顯示相同的錯誤

和 pgadmin4 配置似乎正確 在此處輸入圖像描述

有時它奇怪地說無法打開系統預設的網路瀏覽器,並且錯誤消息在重新啟動後停止,然後在幾次嘗試打開 pgadmin4 後又回來了

並且只有當 pgadmin4 在後台執行時才會彈出此 Web 瀏覽器錯誤,如果我殺死 pgadmin4 然後無法啟動應用程序伺服器錯誤會在我打開它時彈出

在這裡找到解決方案https://stackoverflow.com/questions/67610220/pgadmin4-error-modulenotfounderror-no-module-named-email-validator

解決方案是降級 python-flask 和 python-flask-security-too。它們不能分別超過 2.0 和 4.0。

引用自:https://unix.stackexchange.com/questions/666312