6

I have followed this tutorial for installing pgadmin4-web: pgAdmin 4 (APT) .

When I run the following command

sudo /usr/pgadmin4/bin/setup-web.sh 

I get the following error:

Setting up pgAdmin 4 in web mode on a Debian based platform… Creating configuration database… /usr/pgadmin4/bin/setup-web.sh: line 75: /usr/pgadmin4/venv/bin/python3: No such file or directory Error setting up server mode. Please examine the output above.

Any help would be great thanks.

Note:

After run the following command (tutorial´s step two)

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'

I had to change inside file /etc/apt/sources.list.d/pgadmin4.list from jammy to bionic

from
deb https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/jammy pgadmin4 main
to
deb https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/bionic pgadmin4 main
Byron2017
  • 871
  • 2
  • 11
  • 23
  • 3
    Go to https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/ and you will see that jammy is not on the list yet. Nothing you can do to add it, you need to wait for an update of the postgres team. This is why Ubuntu not recommend to swap from an LTS to another directly. Is preferable you wait 6 month after a new LTS version is released. I know, this is not nice, but you need to accept that other developers are not waiting for the Ubuntu releases at all and they don't care. Ubuntu should distribute pgadmin4 from they official repositories to solve that situation. – lestcape Apr 25 '22 at 04:02
  • I even managed to install it via `apt` but it fails to start due to some missing python modules – kpentchev Apr 28 '22 at 10:07

6 Answers6

7

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.

akaine
  • 129
  • 9
  • On 22.04, apt-key is deprecated and importing keys with it leads to annoying warnings every time you run apt update. To import the pgadmin public key to the new location, use: $ curl https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo tee /etc/apt/trusted.gpg.d/pgadmin.asc – caraka May 05 '22 at 22:30
  • @caraka Yes. To solve this warning you can follow this guide (this is what I did and it worked like a charm): https://askubuntu.com/questions/1403556/key-is-stored-in-legacy-trusted-gpg-keyring-after-ubuntu-22-04-update – akaine May 06 '22 at 23:29
  • E: The repository 'https://ftp.postgresql.org/pub/pgadmin/pgadmin4/snapshots/2022-05-05/apt/jammy pgadmin4 Release' does not have a Release file. – Grogu Jan 09 '23 at 23:03
3

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.

Shashank
  • 338
  • 4
  • 16
  • 1
    This works and is great. A nice alias you can add to your ~/.bash_aliases file to streamline this process is `alias pgadmin4='open http://127.0.0.1:5050 && cd ~ && source pgadmin4/bin/activate && pgadmin4'` ....then when you're done, you can close the pgadmin4 browser tab, ctrl + c the terminal tab runnnig the web pgadmin4 , and type `deactivate` to leave the virtual python environment – Garrett Simpson May 03 '22 at 06:45
3

I found the solution to this problem and is necessary to install python3.8 in the new OS Linux versions has python3.10.

Install Python3.8

Run the following commands as root or user with sudo access to update the packages list and install the prerequisites:

sudo apt update

sudo apt install software-properties-common

Add the deadsnakes PPA to your system’s sources list:

sudo add-apt-repository ppa:deadsnakes/ppa

  • When prompted press Enter to continue:

    Press [ENTER] to continue or Ctrl-c to cancel adding it.

Once the repository is enabled, install Python 3.8 with:

sudo apt install python3.8

Verify that the installation was successful by typing:

python3.8 --version

Python 3.8.0

Run finally

sudo /usr/pgadmin4/bin/setup-web.sh

Setting up pgAdmin 4 in web mode on a Debian based platform...
Creating configuration database...
NOTE: Configuring authentication for SERVER mode.

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

Adding to what Shashank outlined using PGAdmin Python virtual environment and run thru web browser.

  1. Follow guidance here
  2. To re-start PGAdmin, from terminal run

$ source pgadmin4/bin/activate
$ pgadmin4
  1. Navigate to http://127.0.0.1:5050 in browser (keep terminal open)
rcschmid
  • 61
  • 5
2

You can also use Docker to install pgadmin4 on Ubuntu 22.04:

docker pull dpage/pgadmin4
docker run -p 80:80 \
    -e 'PGADMIN_DEFAULT_EMAIL=user@domain.com' \
    -e 'PGADMIN_DEFAULT_PASSWORD=SuperSecret' \
    -d dpage/pgadmin4

To install docker: https://docs.docker.com/engine/install/ubuntu/

Documentation for container deployment: https://www.pgadmin.org/docs/pgadmin4/latest/container_deployment.html#examples

Louis Huang
  • 589
  • 3
  • 7
0

TL;DR;

For some reason installing just pgadmin4-web or pgadmin4-desktop does NOT install pgadmin4-server and you need first to install it like (for desktop):

sudo apt install pgadmin4-server pgadmin4-desktop

Long(er) version:

After upgrading to Ubuntu 22.04 (from 20.04) pgAdmin stopped working. There were some problems with older python version (3.8), tried to fix them in various ways but at the end gave up and just purged pgadmin4. After installing just pgadmin4-desktop package (which depends on pgadmin4 package) I found out that the installation is not full, i.e. missing files and dirs from /usr/pgadmin4. After installing the pgadmin4-server package everything started to work as expected. Hope this helps someone because I've wasted several hours investigating this gd issue.

Ognyan
  • 13,452
  • 5
  • 64
  • 82