19

Basically, follow the steps as outlined here: https://wiki.postgresql.org/wiki/Apt.

  1. sudo apt-get install curl ca-certificates gnupg
  2. curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
  3. sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
  4. sudo apt-get update
  5. sudo apt-get install pgadmin4

(The actual command for the last step includes postgresql-11. I never do that because I just want pgadmin4 and have never had issues with it working properly.)

Anyway, this is what happens when trying to install:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package pgadmin4 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'pgadmin4' has no installation candidate

I've redone the steps with the same result.

I did also try to do the following, but it requires python3.7 which I'm not going to install.

sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt eoan-pgdg main" > /etc/apt/sources.list.d/pgdg.list'

Verified focal shows up at apt.postgresql.org:

enter image description here

Kind of stumped after that as to what to do.

Suggestions?

cjones
  • 447
  • 2
  • 5
  • 12
  • 2
    I'm having the same issue. The reason why is that the focal packages don't have pgAdmin4 yet. You can confirm this if you check the packages file in the main folder of focal-pgdg/. Like you, I tried getting it from the eoan packages, but asked for python3.7. What I'm confused about is that I did install libpython3.8, but it doesn't recognize it. https://askubuntu.com/questions/1230387/20-04-focal-fossa-pgadmin4-depends-on-libpython-but-it-is-installed?noredirect=1# – ShrimpCrackers Apr 24 '20 at 18:13
  • I wrote a short post explaining how to use the dockerized pgAdmin4 with a local Postgres server on Ubuntu 20.04. Apparently, it's not that straightforward. https://dragoshmocrii.com/dockerized-pgadmin-4-local-postgres-server-on-ubuntu-20-04/ – Dragos Apr 27 '20 at 16:03
  • I had the same problem and the solution was surprising simple: replace your command #3 above by this command: **sudo sh -c 'echo "deb https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/focal pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list && apt update'** which is basically the same, except for the fact that I changed the $(lsb_release... etc by **focal**. That command was giving 'groovy' as result, which was causing the problem. Take a look at https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/focal/dists/pgadmin4/ to check the actual path. It's working fine here! – Almir Campos Jan 06 '21 at 07:22

3 Answers3

10

I was able to install pgadmin4 on ubuntu 20.04 (focal fossa) using the following article as a base: https://linuxhint.com/install-pgadmin4-ubuntu/

A few changes to the instructions are required:

  1. In part 2:

    sudo apt-get install build-essential libssl-dev libffi-dev libgmp3-dev
    sudo apt-get install python3-virtualenv libpq-dev python3-dev
    
  2. In part 5:
    The latest version for the moment is:

    https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v4.20/pip/pgadmin4-4.20-py2.py3-none-any.whl
    

    (I used release, not a daily snapshot)

  3. In part 6: Use

    pip install pgadmin4-4.20-py2.py3-none-any.whl 
    
  4. In part 7:
    Use 'python3.8' instead of 'python2.7'

That's all.
Worked for me.

Nadeem Qasmi
  • 123
  • 3
zpetukhov
  • 116
  • 5
  • Does virtual env is necessary? If so, can I ask why? – Sarthak Kumar May 05 '20 at 07:19
  • 1
    @Sarthak Using virtual environment isn't necessary. You can install _pgadmin4_ as your local package (e.g. at _~/.local/lib/python3.8/site-packages/pgadmin4_) instead of installing in a virtual environment. – Ajeet Shah May 11 '20 at 13:02
  • An installation of a virtual env it is not a requierimiend, but it's strongly recommended, please read the notes: https://www.pgadmin.org/download/pgadmin-4-python-wheel/ – lestcape May 14 '20 at 01:14
  • I can't answer bc my rep is too low... but things are even better now (2021/02/26) and you'll have much better luck if you just let the official pgadmin4 figure out dependencies for you. `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/apt/$(lsb_release -cs) pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list && apt update'` `sudo apt install pgadmin4-web'` That installs the web version which apache can host – moodboom Feb 26 '21 at 19:04
5

Update: Please note that it's possible install pgadmin4 (4.21) directly from the repositories now.

The problem of the upstream debian repository was the python 3.8 support. They said that was fixed in this commit, but they are apparently missing this: https://github.com/postgres/pgadmin4/commit/b7dad25d3eb29fae05fef4f161dea644f080276f

Also the upstream has no support for Ubuntu 20.04 yet. See the status at this date (2020-05-13): https://www.postgresql.org/ftp/pgadmin/pgadmin4/snapshots/

If someone were to distribute pgadmin4 directly in Ubuntu it would be really helpfully, but it is not available yet.

Zanna
  • 69,223
  • 56
  • 216
  • 327
lestcape
  • 996
  • 6
  • 10
  • How long does it usually take for these changes to be released? – ShrimpCrackers Apr 25 '20 at 05:33
  • I think it will have support in the next version and they release are one per month, more less. So, i suppose the next version 4.21 will be released at the start of the next month and will support python 3.8 and also ubuntu 20.04. But i can not warranty that will be in this way, its a assumption. You can try to install it from source if you can not wait (https://linuxhint.com/install-pgadmin4-ubuntu/). Just reemplace the source and use the last available (https://ftp.postgresql.org/pub/pgadmin/pgadmin4/snapshots/2020-04-26/pgadmin4-4.20-py2.py3-none-any.whl). – lestcape Apr 26 '20 at 05:08
  • a new version `v4.21` of PgAdmin was released on 04-30-20, but it still does not support Ubuntu 20.04 – Ait Yahia Idir May 01 '20 at 21:29
  • 1
    The issue with python3.8 was fixed, they just need to update the repository now because they have the version 4.16-1 and what they need to have is the 4.21. As i already said i can not warranty that will be in this way. Even more intresting Fedora 32 was released after Ubuntu 20.04 and now it have an snapshot while ubuntu 20.04 not. What can i said? It's a human factor. – lestcape May 01 '20 at 21:59
  • It was update to 4.21 now, so can be installed directly from the repository. – lestcape May 14 '20 at 01:15
  • Why is this always such a nightmare to install PG4... Its been like this since it first came out :( – Jamie Hutber Jul 28 '20 at 12:47
  • @JamieHutber Most of Linux developers use a Debian base desktop (like is Ubuntu). So, it's difficult to see a problem to install something that was tested a lot by his own developers in the same platform. But most of people is not the same of say all people and apparently pg developers use Fedora. So, I think is easy to see why... – lestcape Jul 29 '20 at 15:14
  • Ye, this makes sense. I think a better way for me to say it, why cannot I not install it via apt? – Jamie Hutber Jul 30 '20 at 08:08
  • You can now, finally, so it's less of a nightmare - see my comment on the accepted answer - I'll convert to a real answer once my rep is high enough. – moodboom Feb 26 '21 at 19:19
4

As a workaround you could run pgadmin4 in docker

docker run -p 5050:80 \
-e 'PGADMIN_DEFAULT_EMAIL=THE_EMAIL_YOU_WANT_TO_USE' \
-e 'PGADMIN_DEFAULT_PASSWORD=XXXXX' \
-d dpage/pgadmin4

Then point your browser to http://localhost:5050

Zanna
  • 69,223
  • 56
  • 216
  • 327
apanagio
  • 149
  • 2
  • 1
    Just note that if you want to connect to a postgres running on your local machine you shouldn't use localhost as the server's address but the ip of your pc. – apanagio Apr 27 '20 at 08:50