pgadmin-org / pgadmin4

pgAdmin is the most popular and feature rich Open Source administration and development platform for PostgreSQL, the most advanced Open Source database in the world.
https://www.pgadmin.org
Other
2.4k stars 632 forks source link

pgAdmin requires a manual running of a setup.py script after reinstallation to a higher version on Ubuntu 24.04 #7849

Open mxchist opened 2 weeks ago

mxchist commented 2 weeks ago

pgAdmin requires a manual running of a setup.py script after reinstallation to a higher version The default pgAdmin4 web configuration is based on a standard Ubuntu Apache2 reverse proxy. After pgAdmin4 was reinstalled, and after the apache2 service was restarted, the Apache server requires to manually run /usr/pgadmin4/web/setup.py script.

To Reproduce

Steps to reproduce the behavior:

  1. Install pgadmin4-server, pgadmin4-web on Ubuntu 23.10 mantic
  2. Upgrade Linux to 24.04
  3. Update pgadmin to 8.9
  4. Change https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/mantic pgadmin4 main to https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/noble pgadmin4 main in a /etc/apt/sources.list.d/
  5. Make sudo apt update
  6. Re-install pgadmin: sudo apt reinstall pgadmin4 pgadmin4-server pgadmin4-web
  7. Restart the apache2 service: sudo service apache2 restart

pgAdmin packages before re-installation:

$ sudo dpkg -l *pgadmin*
ii  pgadmin4-server 8.9           amd64 
ii  pgadmin4-web    8.9           all
ii  phppgadmin      7.14.7+dfsg-1 all

pgAdmin packages after re-installation:

$ sudo dpkg -l *pgadmin*
ii  pgadmin4         8.11          all 
ii  pgadmin4-desktop 8.11          amd64
ii  pgadmin4-server  8.11          amd64 
ii  pgadmin4-web     8.11          all 
ii  phppgadmin       7.14.7+dfsg-1 all 

Expected behavior The web address http://127.0.0.1/pgadmin4 opens a pgAdmin web interface

Error message

In my browser:

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at webmaster@localhost to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.
Apache/2.4.58 (Ubuntu) Server at 127.0.0.1 Port 80

In Apache logs:

[Sun Aug 25 19:01:52.175218 2024] [wsgi:error] [pid 833172] [remote 127.0.0.1:59714] mod_wsgi (pid=833172): Failed to exec Python script file '/usr/pgadmin4/web/pgAdmin4.wsgi'.
[Sun Aug 25 19:01:52.175343 2024] [wsgi:error] [pid 833172] [remote 127.0.0.1:59714] mod_wsgi (pid=833172): Exception occurred processing WSGI script '/usr/pgadmin4/web/pgAdmin4.wsgi'.
[Sun Aug 25 19:01:52.175727 2024] [wsgi:error] [pid 833172] [remote 127.0.0.1:59714] Traceback (most recent call last):
[Sun Aug 25 19:01:52.175882 2024] [wsgi:error] [pid 833172] [remote 127.0.0.1:59714]   File "/usr/pgadmin4/web/pgAdmin4.wsgi", line 30, in <module>
[Sun Aug 25 19:01:52.175920 2024] [wsgi:error] [pid 833172] [remote 127.0.0.1:59714]     raise Exception(
[Sun Aug 25 19:01:52.175986 2024] [wsgi:error] [pid 833172] [remote 127.0.0.1:59714] Exception: 
[Sun Aug 25 19:01:52.176015 2024] [wsgi:error] [pid 833172] [remote 127.0.0.1:59714] Required configuration file is not present!
[Sun Aug 25 19:01:52.176031 2024] [wsgi:error] [pid 833172] [remote 127.0.0.1:59714] Please run setup.py first!

Desktop (please complete the following information):

Additional context However, the pgAdmin as it stands, works well on 127.0.0.1:5050 if you follow two steps:

  1. Go to /usr/pgadmin4/
  2. source venv
  3. Run python web/pgAdmin.py
mxchist commented 2 weeks ago

I think a few additional points should be mentioned:

  1. Before the installation, there is an old python interpreter in /var/pgadmin/venv. It was configured when the current Ubuntu release was 3.11.6. After the Ubuntu upgrade, the default interpreter became a 3.12, but /usr/pgadmin4/venv/bin/python was still 3.11.6. The wsgi_mod of Apache also used python 3.12 .
  2. The reinstallation aimed to fix this gap between the interpreters versions.
  3. When reinstalled, it is not only reinstall the pgAdmin version; it also upgraded the python version in /usr/pgadmin
yogeshmahajan-1903 commented 2 weeks ago

I think a few additional points should be mentioned:

  1. Before the installation, there is an old python interpreter in /var/pgadmin/venv. It was configured when the current Ubuntu release was 3.11.6. After the Ubuntu upgrade, the default interpreter became a 3.12, but /usr/pgadmin4/venv/bin/python was still 3.11.6. The wsgi_mod of Apache also used python 3.12 . python venv is shipped along with installer. If the python version is changed, then it breaks pgadmin. Hence python version with which pgadmin is installed it marked as dependency and it will be kept.
  2. The reinstallation aimed to fix this gap between the interpreters versions. You can try uninstall and then install again.
  3. When reinstalled, it is not only reinstall the pgAdmin version; it also upgraded the python version in /usr/pgadmin
mxchist commented 2 weeks ago

If the python version is changed, then it breaks pgadmin. Hence python version with which pgadmin is installed it marked as dependency and it will be kept

As I see, the default Python interpreter is 3.12 in Ubuntu Noble. If I correctly understood, it is not possible to upgrade Ubuntu from 23 to 24 without upgrading the default CPython version

georgel-pop-lr commented 1 day ago

For me, it helped to install sudo apt install python3.8 for web version on 24.04, but desktop version of pgadmin still doesn't open after upgrade.