How to install pgAdmin4 on Raspberry Pi 4 Raspbian 10 Buster howto guide
About
This is a description of how I got pgAdmin4 working on my Raspberry Pi 4 4GB running Raspbian 10 Buster.
Installation
Write the commands in the grey boxes in a Terminal window.
Install packages:
sudo apt updatesudo apt upgradesudo apt install build-essential libssl-dev libffi-dev libgmp3-dev virtualenv python-pip libpq-dev python-dev python3 nano
Create a python3 virtual environment:
virtualenv -p python3 ~/pgadmin4
Enter the virtual environment directory, and create directories used for pgAdmin storage, sessions and logging:
cd ~/pgadmin4mkdir varmkdir var/storagemkdir var/sessions
Activate the virtual environment:
source bin/activate
Get the pgAdmin4 python wheel and install it:
wget https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v4.18/pip/pgadmin4-4.18-py2.py3-none-any.whlpip3 install pgadmin4–4.18-py2.py3-none-any.whl
Downgrade the python packet werkzeug to avoid a breaking change in v1.0.
pip3 install 'werkzeug<1.0'
Create configuration file:
nano lib/python3.7/site-packages/pgadmin4/config_local.py
Populate the configuration file like so:
PGADMIN_DEFAULT_EMAIL='a@a.a'
PGADMIN_DEFAULT_PASSWORD='123456'
LOG_FILE = '~/pgadmin4/var/log'
SQLITE_PATH = '~/pgadmin4/var/pgadmin4.db'
SESSION_DB_PATH = '~/pgadmin4/var/sessions'
STORAGE_DIR = '~/pgadmin4/var/storage'
Exit the virtual environment:
deactivate
Start pgAdmin4:
python3 \
~/pgadmin4/lib/python3.7/site-packages/pgadmin4/pgAdmin4.py
Point your browser to: http://127.0.0.1:5050/
Log in with the email and password from the config file created above.
Notes
The password has to be at least 6 characters.
Copy/paste of quotes and dashes does not always work — keep this in mind if you get some strange errors.
References
The pgAdmin4 latest python wheels: https://www.pgadmin.org/download/pgadmin-4-python-wheel/
How to install PgAdmin4 on Ubuntu 18.04 Server mode: https://www.nixgyd.com/install-pgadmin4-ubuntu-18-04-server-mode/392
The werkzeug breaking change is discussed here: https://github.com/pallets/werkzeug/issues/1714
pgAdmin: https://www.pgadmin.org/