summarized my approach here: https://askubuntu.com/questions/1370092/the-pgadmin-4-server-could-not-be-contacted-error
On Thu, Mar 3, 2022 at 12:22 AM Garrett Simpson <elgaric...@gmail.com> wrote: > Doing more research...CAME UP WITH A WORK AROUND! But I definitely think > that pgadmin4 just doesn't work with Ubuntu 21.10 out of the box. Dave, > can you confirm? > > TLDR: Need to install python 3.8 for pgadmin to work with Ubuntu 21.10. > Easiest way to do this is via the deadsnakes ppa and some temporary > changing of the main repos to point at bionic. > > > > The problem stems from the symlink being broken. If I check out the > directory housing the python3 symlink that the environment is using... > > ~$ cd /usr/pgadmin4/venv/bin > /usr/pgadmin4/venv/bin$ ls -l > > I see the following 2 symlinks are broken: > lrwxrwxrwx 1 root root 7 Feb 7 11:20 python -> python3 > lrwxrwxrwx 1 root root 18 Feb 7 11:20 python3 -> /usr/bin/python3.8 > > because when I run `$ which python3`, i get back > /usr/bin/python3 > > Follow this Unix stack exchange post, > https://unix.stackexchange.com/questions/151999/how-to-change-where-a-symlink-points, > I fix the symlink with the following command while in that same directory: > > /usr/pgadmin4/venv/bin$ sudo ln -sf /usr/bin/python3 python3 > > That seems to fix the symlink issue, but now I get a new error: > ************************* > Traceback (most recent call last): > File "/usr/pgadmin4/web/pgAdmin4.py", line 39, 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 23, in <module> > from flask import Flask, abort, request, current_app, session, url_for > ModuleNotFoundError: No module named 'flask' > ********************* > > After more digging I realize there seem to be broken symlinks everywhere ( > which you can see with $ cd /usr/pgadmin4/venv/lib/python3.8 && ls -l ) > > So I figure I should try and revert my "fixed" symlink, and install python > 3.8 from the deadsnakes ppa. To do this I'll have to change the deadsnakes > url in the sources.list.d directory to target bionic and focal, following > https://brennan.io/2021/06/21/deadsnakes-hirsute/ : > > $ cd /usr/pgadmin4/venv/bin && sudo ln -sf /usr/bin/python3.8 python3 > $ sudo add-apt-repository ppa:deadsnakes > $ sudo vim /etc/apt/sources.list.d/deadsnakes-ubuntu-ppa-impish.list > ---> change 'deb http://ppa.launchpad.net/deadsnakes/ppa/ubuntu/ > *impish* main' to 'deb http://ppa.launchpad.net/deadsnakes/ppa/ubuntu/ > *bionic* main' > $ sudo apt update && sudo apt install python3.8 > > This almost works, but it looks like I may be entering dependency hell...I > get the following message: > > ********************* > The following packages have unmet dependencies: > python3.8 : Depends: libpython3.8-stdlib (= 3.8.12-1+bionic3) but it is > not installable > E: Unable to correct problems, you have held broken packages. > ********************* > > So I try adding the bionic universe repo into my main sources.list: > $ sudo vim /etc/apt/sources.list > ---> add 'deb http://us.archive.ubuntu.com/ubuntu/ *bionic* > universe' under 'deb http://us.archive.ubuntu.com/ubuntu/ *impish* > universe' > > And try again > > $ sudo apt update && sudo apt install python3.8 > > hit with a keyring error: > > **************** > W: GPG error: http://us.archive.ubuntu.com/ubuntu bionic InRelease: The > following signatures couldn't be verified because the public key is not > available: NO_PUBKEY 3B4FE6ACC0B21F32 > E: The repository 'http://us.archive.ubuntu.com/ubuntu bionic InRelease' > is not signed. > N: Updating from such a repository can't be done securely, and is > therefore disabled by default. > N: See apt-secure(8) manpage for repository creation and user > configuration details. > **************** > > so following > https://askubuntu.com/questions/13065/how-do-i-fix-the-gpg-error-no-pubkey > , I add the key > $ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys > 3B4FE6ACC0B21F32 > > and try again....still doesn't work. > > *************** > python3.8 : Depends: libpython3.8-stdlib (= 3.8.12-1+bionic3) but it is > not installable > ***************** > > Hail mary, try to temporarily change all my main sources to focal and try > again, also delete that bionic line: > $ sudo sed -i 's/impish/focal/g' /etc/apt/sources.list > $ sudo apt update && sudo apt install python3.8 > > Still gives > *************** > python3.8 : Depends: libpython3.8-stdlib (= 3.8.12-1+bionic3) but it is > not installable > ***************** > > So I try again, but changing everything to bionic: > $ sudo sed -i 's/focal/bionic/g' /etc/apt/sources.list > $ sudo apt update && sudo apt install python3.8 > > > THIS WORKS! Python 3.8 officially installed where pgadmin is expecting it: > $ ls /usr/bin/ | grep python > --> > python3 > python3.8 > python3.9 > > > and running it works > > > On Wed, Mar 2, 2022 at 6:55 PM Garrett Simpson <elgaric...@gmail.com> > wrote: > >> Thanks so much Dave -- silly oversight on my part in retrospect. Humble >> request though to add the executable to the PATH upon installation so you >> get it for free. >> >> Also another question.... >> >> when trying to open pgadmin4, I see the window popup, and after waiting a >> while (seeing "This is taking longer than usual" and "Almost there"), >> another box comes up saying >> >> >> "The pgAdmin 4 server could not be contacted:" >> >> and it spits out the following environment information... >> any suggestions? I made sure postgres was running by doing >> $ sudo service postgresql start >> >> and still no luck... >> error says >> Failed to launch pgAdmin4. Error: >> Error: spawn /usr/pgadmin4/venv/bin/python3 ENOENT >> >> >> >> pgAdmin Runtime Environment >> -------------------------------------------------------- >> Python Path: "/usr/pgadmin4/venv/bin/python3" >> Runtime Config File: "/home/garrett/.config/pgadmin/runtime_config.json" >> pgAdmin Config File: "/usr/pgadmin4/web/config.py" >> Webapp Path: "/usr/pgadmin4/web/pgAdmin4.py" >> pgAdmin Command: "/usr/pgadmin4/venv/bin/python3 -s >> /usr/pgadmin4/web/pgAdmin4.py" >> Environment: >> - GJS_DEBUG_TOPICS: JS ERROR;JS LOG >> - USER: garrett >> - XDG_SESSION_TYPE: wayland >> - SHLVL: 0 >> - HOME: /home/garrett >> - DESKTOP_SESSION: ubuntu >> - GIO_LAUNCHED_DESKTOP_FILE: /usr/share/applications/pgadmin4.desktop >> - GTK_MODULES: gail:atk-bridge >> - GNOME_SHELL_SESSION_MODE: ubuntu >> - MANAGERPID: 1860 >> - SYSTEMD_EXEC_PID: 2012 >> - DBUS_SESSION_BUS_ADDRESS: unix:path=/run/user/1000/bus >> - GIO_LAUNCHED_DESKTOP_FILE_PID: 7732 >> - IM_CONFIG_PHASE: 1 >> - WAYLAND_DISPLAY: wayland-0 >> - LOGNAME: garrett >> - _: /usr/bin/gnome-session >> - JOURNAL_STREAM: 8:35085 >> - XDG_SESSION_CLASS: user >> - USERNAME: garrett >> - GNOME_DESKTOP_SESSION_ID: this-is-deprecated >> - PATH: >> /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin >> - SESSION_MANAGER: local/garrett-external:@ >> /tmp/.ICE-unix/1994,unix/garrett-external:/tmp/.ICE-unix/1994 >> - INVOCATION_ID: bfafbc8cf87c44b3a86bc5cc8f90c3db >> - XDG_RUNTIME_DIR: /run/user/1000 >> - XDG_MENU_PREFIX: gnome- >> - GNOME_SETUP_DISPLAY: :1 >> - DISPLAY: :0 >> - LANG: en_US.UTF-8 >> - XDG_CURRENT_DESKTOP: ubuntu:GNOME >> - XDG_SESSION_DESKTOP: ubuntu >> - XMODIFIERS: @im=ibus >> - XAUTHORITY: /run/user/1000/.mutter-Xwaylandauth.5AZ8H1 >> - SSH_AGENT_LAUNCHER: gnome-keyring >> - SSH_AUTH_SOCK: /run/user/1000/keyring/ssh >> - SHELL: /bin/bash >> - QT_ACCESSIBILITY: 1 >> - GDMSESSION: ubuntu >> - GJS_DEBUG_OUTPUT: stderr >> - QT_IM_MODULE: ibus >> - PWD: /home/garrett >> - XDG_DATA_DIRS: >> /usr/share/ubuntu:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop >> - XDG_CONFIG_DIRS: /etc/xdg/xdg-ubuntu:/etc/xdg >> - GDK_BACKEND: x11 >> - NO_AT_BRIDGE: 1 >> - PGADMIN_INT_PORT: 35873 >> - PGADMIN_INT_KEY: d59e0765-b67e-4cb0-b5f1-5c752517b6cc >> - PGADMIN_SERVER_MODE: OFF >> -------------------------------------------------------- >> >> Failed to launch pgAdmin4. Error: >> Error: spawn /usr/pgadmin4/venv/bin/python3 ENOENT >> >> On Wed, Mar 2, 2022 at 11:57 AM Dave Page <dp...@pgadmin.org> wrote: >> >>> Hi >>> >>> On Wed, 2 Mar 2022 at 14:37, Garrett Simpson <elgaric...@gmail.com> >>> wrote: >>> >>>> Hi there, >>>> >>>> I'd like to report what appears to be a bug in the installation process >>>> for pgadmin4 on Ubuntu 21.10 . Below is copy and pasted from my question on >>>> askubuntu, >>>> https://askubuntu.com/questions/1395499/cant-install-pgadmin4-on-ubuntu-21-10-impish-pgadmin4 >>>> >>>> I'm running Ubuntu 21.10 impish from an external ssd. Things are >>>> working well, trying to install pgadmin4 by following the guide here: >>>> >>>> https://www.pgadmin.org/download/pgadmin-4-apt/ >>>> >>>> namely, adding the extra the PPA , updating the apt repository, and >>>> then installing with apt: >>>> >>>> >>>> # Setup the repository >>>> # >>>> >>>> # Install the public key for the repository (if not done previously): >>>> sudo curl https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo >>>> apt-key add >>>> >>>> # Create the repository configuration file: >>>> sudo sh -c 'echo "deb >>>> https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/$(lsb_release -cs) >>>> pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list && apt update' >>>> >>>> # >>>> # Install pgAdmin >>>> # >>>> >>>> # Install for both desktop and web modes: >>>> sudo apt install pgadmin4 >>>> >>>> # Install for desktop mode only: >>>> sudo apt install pgadmin4-desktop >>>> >>>> # Install for web mode only: >>>> sudo apt install pgadmin4-web >>>> >>>> # Configure the webserver, if you installed pgadmin4-web: >>>> sudo /usr/pgadmin4/bin/setup-web.sh >>>> >>>> ^ note these are the official instructions from pgadmin.org, which >>>> says it has support for Ubuntu 21.10 (Impish, from v6.2) (I don't know >>>> what the v6.2 means, but whatever) >>>> >>>> It appears that everything installs, and then when I try running $ >>>> pgadmin4 , nothing happens >>>> >>>> I tried manually specifying amd64 architiecture and even switching to >>>> the LTS focal endpoint using $ sudo vim >>>> /etc/apt/sources.list.d/pgadmin4.list, changing >>>> >>>> deb https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/impish >>>> pgadmin4 main >>>> >>>> to >>>> >>>> deb [arch=amd64] >>>> https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/focal pgadmin4 >>>> main >>>> >>>> Still no joyy....what am I missing here? and Ideally, how would I do it >>>> all in an automated script? Setting up a new system, and wrestling with >>>> stuff like this is never enjoyable. >>>> >>> >>> If you just run 'pgadmin4', I would expect to see a command not found >>> error, e.g. >>> >>> dpage@ubuntu:~$ pgadmin4 >>> pgadmin4: command not found >>> >>> However, the full path should work, e.g. >>> >>> dpage@ubuntu:~$ /usr/pgadmin4/bin/pgadmin4 >>> [9496:9496:0302/085252.960815:ERROR:sandbox_linux.cc(379)] >>> InitializeSandbox() called with multiple threads in process gpu-process. >>> [9463:9491:0302/085255.439901:ERROR:chrome_browser_main_extra_parts_metrics.cc(227)] >>> START: ReportBluetoothAvailability(). If you don't see the END: message, >>> this is crbug.com/1216328. >>> [9463:9491:0302/085255.440023:ERROR:chrome_browser_main_extra_parts_metrics.cc(230)] >>> END: ReportBluetoothAvailability() >>> [9497:9509:0302/085258.416653:ERROR:cert_verify_proc_builtin.cc(603)] No >>> net_fetcher for performing AIA chasing. >>> [9497:9514:0302/085300.895407:ERROR:cert_verify_proc_builtin.cc(603)] No >>> net_fetcher for performing AIA chasing. >>> [9497:9514:0302/085332.999213:ERROR:cert_verify_proc_builtin.cc(603)] No >>> net_fetcher for performing AIA chasing. >>> [9497:9514:0302/085353.520635:ERROR:cert_verify_proc_builtin.cc(603)] No >>> net_fetcher for performing AIA chasing. >>> >>> Those errors can be ignored - they're garbage the Chrome engine spits >>> out that are merely annoying. You should see the pgAdmin window open at >>> this point. >>> >>> You can also run pgAdmin from the Wayland menu. Just type pgadmin in the >>> search box if the icon doesn't show up immediately. >>> >>> FYI, the testing above was done on a fresh installation of Ubuntu 21.10. >>> >>> -- >>> Dave Page >>> Blog: https://pgsnake.blogspot.com >>> Twitter: @pgsnake >>> >>> EDB: https://www.enterprisedb.com >>> >>>