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:
- reinstall pgadmin
- 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