Make sure you have the latest version of pip
python3 -m pip install --upgrade pip
Create the virtual environment
python3 -m venv pgadmin4
I like the idea to use local sub-directories vs global ones
cd ~/pgadmin4 mkdir var mkdir var/storage mkdir var/sessions
Activate the virtual environment (to install or later to use)
source /home/pi/pgadmin4/bin/activate
pip install pgadmin4
Optional (“Install simple-websocket for improved performance”)
pip install simple-websocket
Create the configuration file for your virtual environment
nano /home/pi/pgadmin4/lib/python3.7/site-packages/config_local.py
Add default e-mail, password, change the paths
PGADMIN_DEFAULT_EMAIL = 'e-mail address' PGADMIN_DEFAULT_PASSWORD = 'password 7+ chars long' LOG_FILE = '/home/pi/pgadmin4/var/log' SQLITE_PATH = '/home/pi/pgadmin4/var/pgadmin4.db' SESSION_DB_PATH = '/home/pi/pgadmin4/var/sessions' STORAGE_DIR = '/home/pi/pgadmin4/var/storage'
Let’s go
pgadmin4

To use any tools, go to File/Preferences and set up Binary Path

Done, deactivate the virtual environment
Well, probably, it’s time to test everything
Go to PostgreSQL Sample Database, download the sample, and try to restore it…
– first you need to create database. name doesn’t matter
– the .tar archive should be in /home/pi/pgadmin4/var/storage/your-email-at-login
– DONE? Now it’s time for break
deactivate
Resources:
– How to install pgAdmin4 on Raspberry Pi 4 Raspbian 10 Buster howto guide
– pgAdmin 4 (Python), official site