Bug 30373 - unable to install pgadmin4, missing dependencies
Summary: unable to install pgadmin4, missing dependencies
Status: RESOLVED OLD
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: Cauldron
Hardware: All Linux
Priority: Normal normal
Target Milestone: ---
Assignee: papoteur
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-04 17:30 CEST by Pierre Fortin
Modified: 2022-11-17 14:55 CET (History)
3 users (show)

See Also:
Source RPM: pgadmin4
CVE:
Status comment:


Attachments

Description Pierre Fortin 2022-05-04 17:30:59 CEST
Description of problem:  mcc: selecting pgadmin4 gives:

Sorry, the following package cannot be selected:

- pgadmin4-4.22-6.mga9.x86_64 (due to conflicts with python3-flask-babelex-0.9.4-4.mga9.noarch)

$ urpmi pgadmin4
A requested package cannot be installed:
python3-flask-babelex-0.9.4-4.mga9.noarch (due to unsatisfied python3.10dist(speaklater)[>= 1.2])

Then, I kept going down a rabbit hole...

$ urpmi python3-flask-babelex
A requested package cannot be installed:
python3-flask-babelex-0.9.4-4.mga9.noarch (due to unsatisfied python3.10dist(speaklater)[>= 1.2])

$ urpmi python3-speaklater
A requested package cannot be installed:
python3-speaklater-1.3-13.mga9.noarch (due to unsatisfied python(abi)[== 3.9])

Version-Release number of selected component (if applicable):


How reproducible:  always


Steps to Reproduce:
1. try to install pgadmin4
2.
3.
Comment 1 Lewis Smith 2022-05-04 21:41:30 CEST
Thank you for the report.

Trying this on Mageia 8 shows the installation would work.
 python3-flask-babelex
 python3-speaklater
are included.
 $ urpmq --requires python3-speaklater
 python(abi)[== 3.8]

This really belongs to joequant (CC'ing), but DavidG did the latest dependency correction, so assigning to you.

Assignee: bugsquad => geiger.david68210
Source RPM: (none) => pgadmin4
CC: (none) => joequant

Lewis Smith 2022-05-04 21:41:54 CEST

Summary: unable to install pgadmin4 => unable to install pgadmin4, missing dependencies

David Walser 2022-05-05 17:47:06 CEST

See Also: (none) => https://bugs.mageia.org/show_bug.cgi?id=30385

Comment 2 Pierre Fortin 2022-06-08 06:15:37 CEST
Any idea when this might be resolved? I will definitely install it as soon as it's available. Thanks.
Comment 3 Pierre Fortin 2022-07-02 09:08:37 CEST
The inability to install pgAdmin4 is starting to affect my schedule...  
It also won't install on my mga8 system (see bug 29066).

Trying again on Cauldron with info from 29066...

Sigh...  stuck at python(abi) -- what package is this?  Can't find it; not even at https://pkgs.org/download/python(abi)
Comment 4 sturmvogel 2022-07-02 10:53:51 CEST
(In reply to Pierre Fortin from comment #3)
> Sigh...  stuck at python(abi) -- what package is this?  Can't find it; not
> even at https://pkgs.org/download/python(abi)

python(abi) is just a virtual dependency Python interpreters provide, matching the major language version, such that other packages can require them in an abstract way, without depending on any package in particular. In cauldron python3-3.10.5-1 provides python(abi) = 3.10
Comment 5 Pierre Fortin 2022-07-02 14:27:15 CEST
After trying to resolve the dependencies; I'm now at:

$ urpmi pgadmin4
A requested package cannot be installed:
python3-flask-babelex-0.9.4-5.mga9.noarch (due to unsatisfied python3.10dist(speaklater)[>= 1.2])
Continue installation anyway? (Y/n) 
While some packages may have been installed, there were failures.
A requested package cannot be installed:
python3-flask-babelex-0.9.4-5.mga9.noarch (due to unsatisfied python3.10dist(speaklater)[>= 1.2])
Continue installation anyway?

Also, is the last question a flaw? It doesn't wait for a response.
Comment 6 sturmvogel 2022-07-02 19:08:46 CEST
On couldron python3-speaklater needs an rebuild for python 3.10. This seems to be the source of the conflicts...
David needs to take care about this...
Comment 7 sturmvogel 2022-07-02 19:21:48 CEST
Good news, papoteur pushed a new version of python3-speaklater-1.4-1 to our buildsystem. I didN#t find if it was rebuild against python 3.10...but lets hope for you...
The update should hit you when first servers refreshes...
Comment 8 sturmvogel 2022-07-02 19:32:15 CEST
You need some more patience Pierre. python3-speaklater-1.4-1 is now fixed but some other python3 packages which are needed for pgadmin4 failed to build in our buildsystem. But papoteur is hardly working to get them fixed...stay tuned!
Comment 9 Pierre Fortin 2022-07-02 19:45:47 CEST
I appreciate the effort...  hopefully we can get this one off the TODO list. :)
Comment 10 papoteur 2022-07-04 12:47:50 CEST
Hello,
I worked on dependencies in cauldron, thus this should be OK for the installation.
However, launching it give me only a splash screen and then a message that it can't connect to a server. Normal, I didn't configured any.

CC: (none) => yves.brungard_mageia

Comment 11 sturmvogel 2022-07-04 15:15:57 CEST
There are still packages which are not rebuilt for python 3.10 so the installation of pgadmin4 on a clean/fresh/virgin cauldron still fails without manual intervention.

# urpmi pgadmin4
A requested package cannot be installed:
python3-flask-migrate-2.5.3-2.mga9.noarch (due to unsatisfied python3.9dist(flask-sqlalchemy)[>= 1])
Continue installation anyway? (Y/n) n
Comment 12 sturmvogel 2022-07-04 15:40:14 CEST
Sorry, my issue was caused by an wonky virt-manager installation (now i remember again why i prefer more robust VirtualBox installations).

On a fresh/clean/virgin cauldron 64bit Plasma Virtualbox installation, pgadmin4 pulls in the required dpendencies now.
Comment 13 sturmvogel 2022-07-04 15:44:19 CEST
But please don't forget to add this deps additionally as Dave found missing for a properly working pgadmin4:
https://bugs.mageia.org/show_bug.cgi?id=29066#c16

"pgadmin4-4.22-3.mga8 has the following problems.
/var/lib/pgadmin/ and
/var/log/pgadmin/ must be created and
chown apache:apache /var/lib/pgadmin and
chown apache:apache /var/log/pgadmin

The following packages need to be installed. They should be added to the
list of packages required by pgadmin4 ...
python3-psycopg2
python3-flask-gravatar
python3-sqlparse
"
Comment 14 papoteur 2022-07-04 16:37:12 CEST
New release 4.30 is building with fixes for ownership, directories creation and requires.
papoteur 2022-07-04 16:37:42 CEST

Assignee: geiger.david68210 => yves.brungard_mageia

Comment 15 Pierre Fortin 2022-07-04 23:19:09 CEST
Sorry to report that while it installs; I get this error dialog:

  Fatal Error
  An error occurred initialising the application server:
  Failed to launch the application server, server thread exiting.

Found contents of .config/pgadmin//pgadmin4.conf pointed to python3.6; changed to 3.10...

Was missing /var/log/pgadmin; created and chown'ed to apache.
/var/lib/pgadmin/{sessions,storage} existed & owned by pgadmin; chown'ed to apache.  Still get above error...

Since I can't find any error logs, looks like the only way to get to the issue is to manually run:
 /usr/lib/python3.10/site-packages/pgadmin4-web/pgAdmin4.py 

Exception: Install 'email_validator' for email validation support.

Installed:
- python3-dnspython-2.1.0-4.mga9.noarch
- python3-email-validator-1.1.3-3.mga9.noarch

Now, I get:
$ python /usr/lib/python3.10/site-packages/pgadmin4-web/pgAdmin4.py
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pgadmin4-web/pgAdmin4.py", line 92, in <module>
    app = create_app()
  File "/usr/lib/python3.10/site-packages/pgadmin4-web/pgadmin/__init__.py", line 600, in create_app
    app.register_blueprint(module)
  File "/usr/lib/python3.10/site-packages/flask/scaffold.py", line 57, in wrapper_func
    return f(self, *args, **kwargs)
  File "/usr/lib/python3.10/site-packages/flask/app.py", line 1028, in register_blueprint
    blueprint.register(self, options)
  File "/usr/lib/python3.10/site-packages/pgadmin4-web/pgadmin/utils/__init__.py", line 65, in register
    super(PgAdminModule, self).register(app, options, first_registration)
TypeError: Blueprint.register() takes 3 positional arguments but 4 were given

============ Just now noticed pgAdmin4 updates have arrived ===============

Applied updates....

Still getting above error...  Python backtrace too...  (line numbers indicate changes in python code)
$ python /usr/lib/python3.10/site-packages/pgadmin4-web/pgAdmin4.py
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pgadmin4-web/pgAdmin4.py", line 94, in <module>
    app = create_app()
  File "/usr/lib/python3.10/site-packages/pgadmin4-web/pgadmin/__init__.py", line 630, in create_app
    app.register_blueprint(module)
  File "/usr/lib/python3.10/site-packages/flask/scaffold.py", line 57, in wrapper_func
    return f(self, *args, **kwargs)
  File "/usr/lib/python3.10/site-packages/flask/app.py", line 1028, in register_blueprint
    blueprint.register(self, options)
  File "/usr/lib/python3.10/site-packages/pgadmin4-web/pgadmin/utils/__init__.py", line 66, in register
    super(PgAdminModule, self).register(app, options, first_registration)
TypeError: Blueprint.register() takes 3 positional arguments but 4 were given

The failing code is:
58:    def register(self, app, options, first_registration=False):
59:        """
60:        Override the default register function to automagically register
61:        sub-modules at once.
62:        """
63:        if first_registration:
64:            self.submodules = list(app.find_submodules(self.import_name))
65:
66:        super(PgAdminModule, self).register(app, options, first_registration)
67:
68:        for module in self.submodules:
69:            if first_registration:
70:                module.parentmodules.append(self)
71:            app.register_blueprint(module)
72:            app.register_logout_hook(module)

The failing logic starts with "app = create_app()" (line 94 of pgAdmin4.py); but super() is beyond my current python skills...
Comment 16 Pierre Fortin 2022-07-04 23:27:43 CEST
Trying to start pgAdmin4 (after updates) now gives:
$ pgAdmin4
QCoreApplication::applicationFilePath: Please instantiate the QApplication object first
QCoreApplication::applicationFilePath: Please instantiate the QApplication object first
Comment 17 Dave Hodgins 2022-07-05 00:41:21 CEST
Do not try run run pgAdmin4 as a regular user. That's not the way it's meant to
be run. As root run "systemctl start pgadmin4.service" and then
"systemctl status pgadmin4.service" to see if there are any error messages.

Also, found another missing requires. python3-flask-security and permission
problems. See https://bugs.mageia.org/show_bug.cgi?id=30385#c3

CC: (none) => davidwhodgins

Comment 18 Pierre Fortin 2022-07-05 02:12:29 CEST
Thanks Dave.  Trying to learn pgAdmin4; but gotta get it installed first. :)

# systemctl status pgadmin4.service
× pgadmin4.service - pgAdmin4
     Loaded: loaded (/usr/lib/systemd/system/pgadmin4.service; enabled; vendor preset: disabled)
     Active: failed (Result: exit-code) since Mon 2022-07-04 19:47:33 EDT; 14s ago
   Duration: 364ms
    Process: 1294193 ExecStart=/usr/bin/python3 /usr/lib/python3.10/site-packages/pgadmin4-web/pgAdmin4.py (code=exited, status=1/FAILURE)
   Main PID: 1294193 (code=exited, status=1/FAILURE)
        CPU: 364ms

Jul 04 19:47:33 pf.pfortin.com python3[1294193]: HINT   : You may need to manually set the permissions on
Jul 04 19:47:33 pf.pfortin.com python3[1294193]:          /var/lib/pgadmin to allow apache to write to it.
Jul 04 19:47:33 pf.pfortin.com python3[1294193]: ERROR  : Failed to create the directory /var/lib/pgadmin/sessions:
Jul 04 19:47:33 pf.pfortin.com python3[1294193]:            [Errno 13] Permission denied: '/var/lib/pgadmin/sessions'
Jul 04 19:47:33 pf.pfortin.com python3[1294193]: HINT   : Create the directory /var/lib/pgadmin/sessions, ensure it is writeable by
Jul 04 19:47:33 pf.pfortin.com python3[1294193]:          'apache', and try again, or, create a config_local.py file
Jul 04 19:47:33 pf.pfortin.com python3[1294193]:          and override the SESSION_DB_PATH setting per
Jul 04 19:47:33 pf.pfortin.com python3[1294193]:          https://www.pgadmin.org/docs/pgadmin4/4.30/config_py.html
Jul 04 19:47:33 pf.pfortin.com systemd[1]: pgadmin4.service: Main process exited, code=exited, status=1/FAILURE
Jul 04 19:47:33 pf.pfortin.com systemd[1]: pgadmin4.service: Failed with result 'exit-code'.

Looks like the update changes ownership, then complains about it...  

I verified via history that I did:
 chown apache.apache /var/{log,lib}/pgadmin

yet, after the update:

# ll /var/lib/pgadmin
total 164
-rw------- 1 pgadmin pgadmin 155648 Jul  4 16:56 pgadmin4.db
drwx------ 2 pgadmin pgadmin   4096 Jul  4 10:30 sessions/
drwxr-xr-x 2 pgadmin pgadmin   4096 Jul  4 10:30 storage/
# ll /var/lib/pgadmin -d
drwx------ 4 pgadmin pgadmin 4096 Jul  4 16:56 /var/lib/pgadmin/

# chown -R apache.apache /var/lib/pgadmin

"app = create_app()" again...  :]

# systemctl status pgadmin4.service
× pgadmin4.service - pgAdmin4
     Loaded: loaded (/usr/lib/systemd/system/pgadmin4.service; enabled; vendor preset: disabled)
     Active: failed (Result: exit-code) since Mon 2022-07-04 20:05:55 EDT; 3s ago
   Duration: 368ms
    Process: 1298110 ExecStart=/usr/bin/python3 /usr/lib/python3.10/site-packages/pgadmin4-web/pgAdmin4.py (code=exited, status=1/FAILURE)
   Main PID: 1298110 (code=exited, status=1/FAILURE)
        CPU: 368ms

Jul 04 20:05:55 pf.pfortin.com python3[1298110]:     app = create_app()
Jul 04 20:05:55 pf.pfortin.com python3[1298110]:   File "/usr/lib/python3.10/site-packages/pgadmin4-web/pgadmin/__init__.py", line 259, in create_app
Jul 04 20:05:55 pf.pfortin.com python3[1298110]:     fh = logging.FileHandler(config.LOG_FILE, encoding='utf-8')
Jul 04 20:05:55 pf.pfortin.com python3[1298110]:   File "/usr/lib64/python3.10/logging/__init__.py", line 1169, in __init__
Jul 04 20:05:55 pf.pfortin.com python3[1298110]:     StreamHandler.__init__(self, self._open())
Jul 04 20:05:55 pf.pfortin.com python3[1298110]:   File "/usr/lib64/python3.10/logging/__init__.py", line 1201, in _open
Jul 04 20:05:55 pf.pfortin.com python3[1298110]:     return open_func(self.baseFilename, self.mode,
Jul 04 20:05:55 pf.pfortin.com python3[1298110]: PermissionError: [Errno 13] Permission denied: '/var/log/pgadmin/pgadmin4.log'
Jul 04 20:05:55 pf.pfortin.com systemd[1]: pgadmin4.service: Main process exited, code=exited, status=1/FAILURE
Jul 04 20:05:55 pf.pfortin.com systemd[1]: pgadmin4.service: Failed with result 'exit-code'.
Comment 19 Dave Hodgins 2022-07-05 02:33:13 CEST
Both directories /var/lib/pgadmin and /var/log/pgadmin must be owned by apache.
Comment 20 Pierre Fortin 2022-07-05 02:49:38 CEST
My point was that they _were_ both owned by apache; but the install/update changed /var/lib/pgadmin to owned by pgadmin.pgadmen...  At least, trying to start pgAdmin4 after fixing that (again) didn't change it back; but start still fails (bottom of comment 18).
Comment 21 Pierre Fortin 2022-07-05 03:02:11 CEST
Just noticed that it creates /var/log/pgadmin/pgadmin4.log owned by root, then complains about it...   ;/

This is getting weird... Deleted /var/log/pgadmin/pgadmin4.log, restarted and now get yet another error; but /var/log/pgadmin/pgadmin4.log was created, and likely managed to change ownership to apache this time. Yet, now seeing the same python error as I saw when starting the script directly as a normal user.:
TypeError: Blueprint.register() takes 3 positional arguments but 4 were given
Comment 22 Pierre Fortin 2022-07-05 03:29:52 CEST
On a lark, went back to mcc install, intending to re-install. Discovered 4.30.1 installed and 4.30.2 available...

Ok, remove .1, install .2...  Try again:
# ll -d /var/lib/pgadmin/sessions
drwx------ 2 pgadmin pgadmin 4096 Jul  4 16:39 /var/lib/pgadmin/sessions/
# chown apache.apache /var/lib/pgadmin/sessions
# ll -d /var/lib/pgadmin/sessions
drwx------ 2 apache apache 4096 Jul  4 16:39 /var/lib/pgadmin/sessions/
# systemctl start pgadmin4.service
# systemctl status pgadmin4.service
× pgadmin4.service - pgAdmin4
     Loaded: loaded (/usr/lib/systemd/system/pgadmin4.service; disabled; vendor preset: disabled)
     Active: failed (Result: exit-code) since Mon 2022-07-04 21:12:02 EDT; 23s ago
   Duration: 373ms
    Process: 1312633 ExecStart=/usr/bin/python3 /usr/lib/python3.10/site-packages/pgadmin4-web/pgAdmin4.py (code=exited, status=1/FAILURE)
   Main PID: 1312633 (code=exited, status=1/FAILURE)
        CPU: 373ms

Jul 04 21:12:02 pf.pfortin.com python3[1312633]:   File "/usr/lib64/python3.10/site-packages/sqlalchemy/pool/base.py", line 656, in __connect
Jul 04 21:12:02 pf.pfortin.com python3[1312633]:     connection = pool._invoke_creator(self)
Jul 04 21:12:02 pf.pfortin.com python3[1312633]:   File "/usr/lib64/python3.10/site-packages/sqlalchemy/engine/strategies.py", line 114, in connect
Jul 04 21:12:02 pf.pfortin.com python3[1312633]:     return dialect.connect(*cargs, **cparams)
Jul 04 21:12:02 pf.pfortin.com python3[1312633]:   File "/usr/lib64/python3.10/site-packages/sqlalchemy/engine/default.py", line 508, in connect
Jul 04 21:12:02 pf.pfortin.com python3[1312633]:     return self.dbapi.connect(*cargs, **cparams)
Jul 04 21:12:02 pf.pfortin.com python3[1312633]: sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) unable to open database file
Jul 04 21:12:02 pf.pfortin.com python3[1312633]: (Background on this error at: http://sqlalche.me/e/13/e3q8)
Jul 04 21:12:02 pf.pfortin.com systemd[1]: pgadmin4.service: Main process exited, code=exited, status=1/FAILURE
Jul 04 21:12:02 pf.pfortin.com systemd[1]: pgadmin4.service: Failed with result 'exit-code'.

Now to figure out what DB it can't open...  Only clue I see is sqlite3.
Comment 23 papoteur 2022-07-05 09:32:50 CEST
Hi Dave and Pierre,
Thanks for your work on trying to get this application working.
I can add python-flask-security and change the ownership to apache.
I see that indeed in a script in pkg/linux/setup-web.sh
this script launch also:
# Run setup script first:
echo "Creating configuration database..."
/usr/pgadmin4/venv/bin/python3 /usr/pgadmin4/web/setup.py
However, setup.py is located elsewhere. The command should be:
python3 /usr/lib/python3.10/site-packages/pgadmin4-web/setup.py
 
I didn't see indication that your tried that.
When I try it in cauldron, I get the same error you reported. I presume that this is because we have Flask in 2.0.

The script says also that apache should configured with wsgi.

On another side, there is the web part which should be accessible through 
http://127.0.0.1/pgadmin4
Do you get something here?
Comment 24 Pierre Fortin 2022-07-05 15:00:04 CEST
Nothing at http://127.0.0.1/pgadmin4 because, as reported in comment 22:
"sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) unable to open database file (Background on this error at: http://sqlalche.me/e/13/e3q8)"; so pgAdmin4 fails to start. This link provides no clue as to which DB it's trying to communicate with... Only that's it's an SQL DB...  Doh!  :) Since it's [pg]Admin4, stands to reason it's postgres; but that only has the virgin default and empty tables (postgres, template0, template1) according to webmin   HTH
# ps aux | grep -i sql
postgres   10370  0.0  0.0 171596 22208 ?        Ss   Jun27   0:06 /usr/bin/postgres -D /var/lib/pgsql/data -p 5432
Comment 25 Pierre Fortin 2022-11-06 10:35:07 CET
For the past approx 2 months, have been loading tons of data into postgresql which is now over 2.3TB...  

Have removed Mageia pgadmin4 packages and installed via pip. This worked initially; but after much debugging, I need to clean up that install.

Issue discovered that may have contributed:

python psycopg2 looks in /var/run instead of /tmp for the socket:
$ ll /tmp/.s.PGSQL.5432
srwxrwxrwx 1 postgres postgres 0 Nov  6 04:04 /tmp/.s.PGSQL.5432=

Resolution: (none) => OLD
Status: NEW => RESOLVED

Comment 26 Pierre Fortin 2022-11-17 14:55:16 CET
For the record:  I completely gave up on pgadmin4 and went looking for alternatives.  Found several; but the most amazing one is: 
  SQL-workbench/J  https://www.sql-workbench.eu (no connection to Oracle) 
That tool, while light on eye-candy; it is more complete, logical, etc.  It has support for many database types. There are many output options, including keeping data and the SQL query used, together in the same spreadsheet (separate tabs/sheets) = automatic documentation; no more searching for the query that produced the output.  Every pgadmin4 user in our team who's seen it, switched...  
Mageia: the license is not compatible with the distro; but it is for our use. :)

Note You need to log in before you can comment on or make changes to this bug.