Score:0

Pgadmin4 failed to start UBUNTU 22.04

cn flag

So bascically I wanted to install postgresql and pgadmin4 gui to cooperate. Postgres was easy instead of pgadmin4 - which is nightmare for me. That's why I'm asking for help. I'm interested in specific opnion which is pgadmin4-desktop. That's why I have installed it using apt package manager. Of course in version 7.1 and python 3.10 it wasn't working at the begining. Quick googling related problems and sollution mentioned were overall like:

  1. reinstall pgadmin
  2. downgrade python to 3.9 or 3.8

I went with second option and it worked! However another problem pop up - my terminal after system restart was not able to run terminal any more:) Don't ask me why. Ok , then simple restore system from timeshift snapshot and I were on the begining on that uneven battle. This time installed according to: instruction. That lead me to error:

Total spawn time to start the pgAdmin4 server: 0.018 Sec  
Traceback (most recent call last):       
File "/usr/pgadmin4/web/pgAdmin4.py", line 47, in <module>
import config      File "/usr/pgadmin4/web/config.py", line 25, in <module>
from pgadmin.utils import env, IS_WIN, fs_short_path       File "/usr/pgadmin4/web/pgadmin/__init__.py", line 24, in <module>
from flask import Flask, abort, request, current_app, session, url_for     ModuleNotFoundError: No module named 'flask'

Ok. Then I installed one by one packages which pgadmin complained about like:

pip install eventlet flask flask_babel flask_socketio flask_mail flask_login flask_paranoid flask_security email_validator  flask_sqlalchemy python-dateutil flask_migrate

Unfortunatelly it didn't help neighter. Result was as bellow:

Total spawn time to start the pgAdmin4 server: 0.018 Sec Traceback (most recent call last): File "/usr/pgadmin4/web/pgAdmin4.py", line 47, in import config File "/usr/pgadmin4/web/config.py", line 25, in from pgadmin.utils import env, IS_WIN, fs_short_path File "/usr/pgadmin4/web/pgadmin/init.py", line 49, in from pgadmin import authenticate File "/usr/pgadmin4/web/pgadmin/authenticate/init.py", line 91, in blueprint = AuthenticateModule(MODULE_NAME, name, static_url_path='') File "/usr/pgadmin4/web/pgadmin/utils/init.py", line 62, in init self.before_app_first_request(create_module_preference) AttributeError: 'AuthenticateModule' object has no attribute 'before_app_first_request'

Ok, looks for me like problem with python. So lets play around it and use pyenv tool. That's how I installed following:

zawier@Brix-Ubuntu:~$ pyenv versions
* system (set by PYENV_VERSION environment variable)
  3.8.16
  3.9.16
  3.10.11
  3.11.3

Checked all above versions with no luck. Either 1st or second problem is returned. One version (which is very interestiong) tells me that I don't have flask and other packages installed (which is incorrect because for all python versions I did that!).

How do I switch between python versions? Easly, like :

zawier@Brix-Ubuntu:~$ pyenv global 3.8.16
zawier@Brix-Ubuntu:~$ pyenv shell 3.8.16
zawier@Brix-Ubuntu:~$ source ~/.bashrc
zawier@Brix-Ubuntu:~$ pyenv versions
  system
* 3.8.16 (set by PYENV_VERSION environment variable)
  3.9.16
  3.10.11
  3.11.3
zawier@Brix-Ubuntu:~$ python3 --version
Python 3.8.16

And finally here I'm stucked in circular hell of repeating problems. Any idea how to solve that?

BTW: Pgadmin points on python link:

zawier@Brix-Ubuntu:~$ readlink /usr/pgadmin4/venv/bin/python3
/home/zawier/.pyenv/shims/python3

So I assume that's fine here - if somebody is wondering about pyenv impact. Of course I have changed my ~/.bashrc to work together with pyenv.

At that desperate situation I also tried play with venv environment - again with no luck so far..

I'm aware that there is also DBeaver soft which works out of the box like charm .. Working with postgres terminal - not a convinent option in case of large sql queries! But it just feel more natural to use pgadmin here ;)

Best regards

us flag
`downgrade python to 3.9 or 3.8` -- Don't try. It will kill many vital applications in Ubuntu.
zawier avatar
cn flag
As wrote: I have used pyenv..
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.