How to install pgAdmin 4 in desktop mode? The documentation only details server mode.

  • The docker version sure was a lot easier and faster way of installing PGAdmin4. I spent a lot of time to do it the old way that was in the readme file. The way to access it then is in a browser window, point it to and it comes up real good. It loads quite fast BUT when I try to create a server with it it keeps saying that Postgresql is NOT running, however in PGAdmin3 Postgresql is running fine. Have read many comments saying what a poor product it is so use at your own risk!!! May 15, 2017 at 12:54
  • 2
    Only pgadmin3 is available on apt (ubuntu 16.04). Any idea how to open a request to Canonical to include pgadmin4 in apt packages? What's the process of requesting an "app" to be included in a package manager? Dec 26, 2017 at 8:47
  • @AlikElzin-kilaka - check my answer below for the apt approach. May 30, 2018 at 13:31
  • If anyone just wants pgAdmin3 you can simply install it using the Ubuntu Software application that's on all Ubuntu installations. Aug 22, 2019 at 13:23

4 Answers 4


For pgAdmin 4 v4.21 on Ubuntu, according to the download page:

Install dependencies, create a virtual environment, download, install & configure

Using Python2.x

sudo apt-get install virtualenv python-pip libpq-dev python-dev

virtualenv pgadmin4
cd pgadmin4
source bin/activate

pip install https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v4.21/pip/pgadmin4-4.21-py2.py3-none-any.whl

Using Python3.6 (Preferred to avoid encoding related issues)

sudo apt-get install virtualenv python3-pip libpq-dev python3-dev

virtualenv -p python3 pgadmin4
cd pgadmin4
source bin/activate

pip3 install https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v4.21/pip/pgadmin4-4.21-py2.py3-none-any.whl


Override default paths and set it to single-user mode in the local configuration file:

nano lib/python2.7/site-packages/pgadmin4/config_local.py

For Python3.x:

nano lib/python3.6/site-packages/pgadmin4/config_local.py


import os
DATA_DIR = os.path.realpath(os.path.expanduser(u'~/.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')


python lib/python2.7/site-packages/pgadmin4/pgAdmin4.py

For Python3.x:

python3 lib/python3.6/site-packages/pgadmin4/pgAdmin4.py


Access at http://localhost:5050


Exit with Ctrl-C

Run again

cd ~/pgadmin4
source bin/activate
python lib/python2.7/site-packages/pgadmin4/pgAdmin4.py

For Python3.6

cd ~/pgadmin4
source bin/activate
python3 lib/python3.6/site-packages/pgadmin4/pgAdmin4.py

Make a shortcut

touch ~/pgadmin4/pgadmin4
chmod +x ~/pgadmin4/pgadmin4
nano ~/pgadmin4/pgadmin4


cd ~/pgadmin4
source bin/activate
python lib/python2.7/site-packages/pgadmin4/pgAdmin4.py

For Python3.6

cd ~/pgadmin4
source bin/activate
python3 lib/python3.6/site-packages/pgadmin4/pgAdmin4.py

Now you can just run it with a simpler command:


Python3 users

Replace [x] in Python3.6 with your respective version.

Conflict with pgAdmin 3 configuration

pgAdmin 4 will not start in the environment where pgAdmin 3 was previously installed and used because of incompatible configuration in the .pgadmin directory. The simplest solution is to either clear that directory or tweak config_local.py to point to a clean new .pgadmin4 directory.

  • 404 on that wget. Apr 14, 2017 at 6:52
  • 7
    I'd like to add that so I can quickly run it, I added this to my ~/.bashrc : alias pgadmin="source ~/pgadmin4/bin/activate && python ~/pgadmin4/lib/python2.7/site-packages/pgadmin4/pgAdmin4.py" That way I can just type pgadmin and it launches, like it SHOULD out of the box. You listening pgadmin? Jun 13, 2017 at 21:32
  • 1
    Here is the correct link for FTP v2.1: ftp.postgresql.org/pub/pgadmin/pgadmin4/v2.1/pip/…
    – Aïssa
    Jan 22, 2018 at 12:42
  • 1
    Could the hard linking to python3.6 dependency in the python3 lib/python3.6/site-packages/pgadmin4/pgAdmin4.py be removed/replaced? That way the answer would be more future proof.
    – paul23
    Sep 4, 2018 at 18:22
  • 1
    On Ubuntu 19.04 which comes with Python 3.7 swap out every occurence of 3.6 with 3.7 in the Python 3.x instructions. May 19, 2019 at 9:15

Other option is to use docker and a docker image provided by thaJeztah - https://github.com/thaJeztah/pgadmin4-docker

$ docker run --rm -p 5050:5050 thajeztah/pgadmin4

Then to access a PostgreSQL DB instance from within pgadmin4 you should use the IP of the host instead of localhost and since Docker will map those to the container itself.

The IP of a dockerised DB instance could be found with 2 steps:

  • find the container ID of your db with:

    docker ps

  • inspect the container_name to find its ip with:

    docker inspect <ID from previous step>

you are looking for something like "IPAddress": ""

  • 1
    How can you make it see a dockerized postgres? localhost/ id did not work for me.
    – ampofila
    Apr 18, 2017 at 12:04
  • 1
    Can we set the IP static i.e. we don't have to update our application to point to new docker container IP every time we restart it
    – Nam G VU
    Sep 16, 2017 at 4:45
  • Nice, added a chromium application shortcut, and it's almost like having the actual application back-
    – chrismarx
    Jan 22, 2018 at 15:26
  • Other way to connect the host database: stackoverflow.com/questions/24319662/…
    – qmn1711
    Sep 24, 2018 at 13:17

On Ubuntu 16.04 you can install pgadmin4 with

sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
sudo apt install wget ca-certificates
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add 
sudo apt update
sudo apt install pgadmin4

I have tested this on 16.04.

source for the above approach

  • Okay, one another thing i want to know that how do i start if i installed it on server.
    – Akhilendra
    Aug 3, 2018 at 7:27
  • 1
    For Ubuntu based distros like Mint you may want to replace the $(lsb_release -cs) with the version of Ubuntu it's based on. For example, Mint Sarah (version 18) is based on Xenial and looks like this: sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main" >> /etc/apt/sources.list.d/pgdg.list' Sep 28, 2018 at 22:47
  • 3
    It looks like the ultimate solution, at least for Ubuntu +16.xx. Thanks !
    – Bonlou
    Nov 19, 2018 at 10:47

Finally, pgAdmin team created an apt package for pgAdmin4

It is supported on:

  • Debian 9 (Stretch), 10 (Buster)
  • Ubuntu 16.04 (Xenial), 18.04 (Bionic), 19.10 (Eoan), 20.04 (Focal)

Now to install it you have to setup the the pgAdmin 4 offical repository, then you can install it

Setup the repository

Install the public key for the repository (if not done previously)

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 pgAdmin4

You can install both Desktop and Web modes:

sudo apt install pgadmin4

For Desktop only:

sudo apt install pgadmin4-desktop

For Web only:

sudo apt install pgadmin4-web 

Source: https://www.pgadmin.org/download/pgadmin-4-apt/

  • I have installed the desktop version (6.1) and when entering I see there is a newer version (6.3) however when I run "sudo apt install pgadmin4-desktop" I still get "pgadmin4-desktop is already the newest version (6.1).". How can I update it to 6.3 ?
    – thanos.a
    Dec 17, 2021 at 8:11
  • @thanos.a try sudo apt update first, then sudo apt install pgadmin4-desktop
    – Hazem
    Dec 17, 2021 at 21:01
  • It used to tell me that I am using the latest version 6.1. Once I updated my Ubuntu version from 20.04 to 21.04, I was able to install 6.3
    – thanos.a
    Dec 20, 2021 at 8:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .