I had a similar problem and couldn't find any solution for the desktop version, in particular, for Ubuntu 22.04 (jammy). However, this should also work for the pgadmin4-web:
sudo curl https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo apt-key add
sudo sh -c 'echo "deb https://ftp.postgresql.org/pub/pgadmin/pgadmin4/snapshots/2022-05-05/apt/jammy pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list && apt update'
sudo apt install pgadmin4-web
(Don't forget to run sudo /usr/pgadmin4/bin/setup-web.sh after that)
For the desktop version just install pgadmin4-desktop instead of pgadmin4-web:
sudo apt install pgadmin4-desktop
Also, please note that this is a temporary solution (May 2022), until the devs release the final pgadmin4 version for jammy. Once it's out, you would just need to update the repository.
Hope this helps.
Answer from akaine on Stack OverflowVideos
I had a similar problem and couldn't find any solution for the desktop version, in particular, for Ubuntu 22.04 (jammy). However, this should also work for the pgadmin4-web:
sudo curl https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo apt-key add
sudo sh -c 'echo "deb https://ftp.postgresql.org/pub/pgadmin/pgadmin4/snapshots/2022-05-05/apt/jammy pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list && apt update'
sudo apt install pgadmin4-web
(Don't forget to run sudo /usr/pgadmin4/bin/setup-web.sh after that)
For the desktop version just install pgadmin4-desktop instead of pgadmin4-web:
sudo apt install pgadmin4-desktop
Also, please note that this is a temporary solution (May 2022), until the devs release the final pgadmin4 version for jammy. Once it's out, you would just need to update the repository.
Hope this helps.
I managed to install pgadmin4 from APT on Ubuntu 22.04, but even after that I was facing some issues while starting pgadmin4.
So I found out that there's a python package for pgadmin4 which exists. It will install the web version of the pgadmin4 and it works without any issue.
Follow the below steps to install or you can check this link.
$ sudo mkdir /var/lib/pgadmin
$ sudo mkdir /var/log/pgadmin
$ sudo chown $USER /var/lib/pgadmin
$ sudo chown $USER /var/log/pgadmin
# Create virtual environment
$ python3 -m venv pgadmin4
$ source pgadmin4/bin/activate
# Install pgadmin4
(pgadmin4) $ pip install pgadmin4
# Start pgadmin4
(pgadmin4) $ pgadmin4
For the first time after running pgadmin4, you'll be asked to set the email and password.
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
cd
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
cd
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
Configure
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
Write:
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')
SERVER_MODE = False
Run
python lib/python2.7/site-packages/pgadmin4/pgAdmin4.py
For Python3.x:
python3 lib/python3.6/site-packages/pgadmin4/pgAdmin4.py
Access
Access at http://localhost:5050
Exit
Exit with Ctrl-C
Run again
cd ~/pgadmin4
source bin/activate
python lib/python2.7/site-packages/pgadmin4/pgAdmin4.py
For Python3.6
#!/bin/bash
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
Write:
#!/bin/bash
cd ~/pgadmin4
source bin/activate
python lib/python2.7/site-packages/pgadmin4/pgAdmin4.py
For Python3.6
#!/bin/bash
cd ~/pgadmin4
source bin/activate
python3 lib/python3.6/site-packages/pgadmin4/pgAdmin4.py
Now you can just run it with a simpler command:
~/pgadmin4/pgadmin4
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.
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 127.0.0.1 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 psinspect the container_name to find its ip with:
docker inspect <ID from previous step>
you are looking for something like "IPAddress": "172.18.0.3"
There is a known issue with pgadmin4 6.10 on Ubuntu 20.04 (and Debian 11 Bullseye in my case): https://redmine.postgresql.org/issues/7442?issue_count=380&issue_position=38&next_issue_id=7438&prev_issue_id=7444 (login required).
Downgrade to 6.9 works for me and the initial reporter:
sudo apt -y remove pgadmin4
sudo apt -y autoremove pgadmin4*
sudo apt -y install pgadmin4-desktop*=6.9 pgadmin4-server*=6.9
It's 2022, In My Case, My Ubuntu 22.04 is installing Python3.10 by default, but PGAdmin requires to use python3.8 instead. So I need to install 3.8 and then pointed the PGAdmin python to use python3.8.
ln -s /usr/bin/python3.8 /usr/pgadmin4/venv/bin/python3
hope it help
Solution for me was explicitly install package python3-paramiko:
apt-get install python3-paramiko
Resulted in:
Preparing to unpack .../python3-paramiko_2.6.0-2_all.deb ...
Unpacking python3-paramiko (2.6.0-2) over (2.0.0-1ubuntu1.2) ...
Setting up python3-bcrypt (3.1.7-2ubuntu1) ...
Setting up python3-cryptography (2.8-3ubuntu0.1) ...
Setting up pgadmin4-apache2 (4.25-1.pgdg20.04+1) ...
pgAdmin 4 - Application Initialisation
======================================
Setting up python3-nacl (1.3.0-5) ...
Setting up python3-paramiko (2.6.0-2) ...
Happened during release upgrade from 18.04 to 20.04. Error traceback was the same.
from pgadmin website:
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