pgAdmin 4 on Gentoo

Since Gentoo Linux removed pgAdmin 4, you have to install it on your own. Based on the official howto for installing pgAdmin 4 as a Python package, this shows how to

Install pgAdmin 4

We will install pgAdmin 4 to ~/bin/pgadmin4 in your home directory, and will place its logfile as well as the user database in ~/.pgadmin.

$ python3 -m venv bin/pgadmin4
$ . bin/pgadmin4/bin/activate
$ pip install pgadmin4
$ cat >>bin/pgadmin4/lib/python3.9/site-packages/pgadmin4/config_local.py <<EOF
import os.path

DATA_DIR = os.path.realpath(os.path.expanduser('~/.pgadmin/'))
LOG_FILE = os.path.join(DATA_DIR, 'pgadmin4.log')
SQLITE_PATH = os.path.join(DATA_DIR, 'pgadmin4.db')
SESSION_DB_PATH = os.path.join(DATA_DIR, 'sessions')
STORAGE_DIR = os.path.join(DATA_DIR, 'storage')
EOF
If you want to change the default port 5050 on which pgAdmin listens, add this to config_local.py:
DEFAULT_SERVER_PORT = 5051
Optionally, if you want to access pgAdmin from other hosts than your local desktop, add this:
DEFAULT_SERVER = "0.0.0.0"
# or bind it to a specific interface:
# DEFAULT_SERVER = "192.168.23.42"
In this case, you might want to limit access to certain hosts or networks:
ALLOWED_HOSTS = ("127.0.0.1", "192.168.23.0/24",)
Now start pgAdmin and create the admin user:
$ pgadmin4
NOTE: Configuring authentication for SERVER mode.

Enter the email address and password to use for the initial pgAdmin user account:

Email address: Enter your email address
Password: Enter some password
Retype password: Retype the same password
Starting pgAdmin 4. Please navigate to http://127.0.0.1:5050 in your browser.
...
Now point your web browser to the shown address, and log in with the admin credentials created right before.

Update pgAdmin 4

$ . bin/pgadmin4/bin/activate
$ pip install -U pgadmin4

Start pgAdmin 4

Either create a shell script:

#!/bin/sh

. ~/bin/pgadmin4/bin/activate

echo "*** Press CTRL+C to stop pgAdmin 4 ***"
pgadmin4 | while read LINE; do
  echo "$LINE"
  url="${LINE##*navigate to }"
  url="${url%% in your browser.}"
  addrport="${url##http}"
  if [ "$addrport" != "$url" ]; then
    firefox "$url"
  fi
done
Or create an entry in your start menu, e.g. if you have used Xfce:
xfce4-terminal -T pgAdmin4 -I /home/yourusername/bin/pgadmin4/lib/python3.9/site-packages/pgadmin4/pgadmin/static/favicon.ico -x bash --rcfile ~/bin/pgadmin4/bin/activate -i -c 'echo "*** Press CTRL+C to stop pgAdmin 4 ***"; pgadmin4 | while read LINE; do echo "$LINE"; url="${LINE##*navigate to }"; url="${url%% in your browser.}"; addrport="${url##http}"; if [ "$addrport" != "$url" ]; then firefox "$url"; fi; done'