Ran into this on Ubuntu 21.10 (impish), because I had borked my installation paths thinking pgadmin4 wasn't fully installed when it was.
The error is because it is assuming python3.8 is installed (21.10 comes with python3.9) , but it isn't, so all the symlinks and virtual env fails. But this is happening because you've installed a version of pgadmin4 that doesn't match your Ubuntu version.
garrett@garrett-external:/etc/apt/sources.list.d$ ls
deadsnakes-ubuntu-ppa-impish.list pgadmin4.list.save pgdg.list.save
pgadmin4.list pgdg.list
##Looking at pgadmin4.list.save , I see I had at least tried to use
hirsute 's repo:
garrett@garrett-external:/etc/apt/sources.list.d$ cat pgadmin4.list.save
deb https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/hirsute pgadmin4 main
##I'm thinking this is overriding the correct impish repos, so I'll
try deleting that file, purging the installation and re-installing:
garrett@garrett-external:/etc/apt/sources.list.d$ ls
deadsnakes-ubuntu-ppa-impish.list pgadmin4.list pgadmin4.list.save pgdg.list pgdg.list.save
garrett@garrett-external:/etc/apt/sources.list.d$ sudo rm pgadmin4.list.save
##double check that the pgadmin4 sources are correct...
garrett@garrett-external:/etc/apt/sources.list.d$ ls
deadsnakes-ubuntu-ppa-impish.list pgadmin4.list pgdg.list pgdg.list.save
garrett@garrett-external:/etc/apt/sources.list.d$ cat pgadmin4.list
deb https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/focal pgadmin4 main
##^ok definitely the problem...should fix that....
garrett@garrett-external:/etc/apt/sources.list.d$ sudo sed -i 's/focal/impish/g' /etc/apt/sources.list.d/pgadmin4.list
garrett@garrett-external:/etc/apt/sources.list.d$ cat ./pgadmin4.list
deb https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/impish pgadmin4 main
##uninstall pgadmin4
garrett@garrett-external:/etc/apt/sources.list.d$ sudo apt purge pgadmin4
garrett@garrett-external:/etc/apt/sources.list.d$ sudo apt autoremove
##reinstall pgadmin4
garrett@garrett-external:/etc/apt/sources.list.d$ sudo apt update && sudo apt install pgadmin4
And now it works fine
EDIT: DON'T GO DOWN THE RABBIT HOLE BELOW
Workaround: Manually install python3.8 using the deadsnakes PPA and some temporary apt cache updating trickery
#first add deadsnakes ppa...
$ sudo add-apt-repository ppa:deadsnakes
Following the gist of https://brennan.io/2021/06/21/deadsnakes-hirsute/ ,
update the deadsnakes ppa's app repos to look at the past 2 LTS versions
$ sudo vim /etc/apt/sources.list.d/deadsnakes-ubuntu-ppa-impish.list
---> change
'deb http://ppa.launchpad.net/deadsnakes/ppa/ubuntu/ impish main' to
'deb http://ppa.launchpad.net/deadsnakes/ppa/ubuntu/ bionic main' , also add
'deb http://ppa.launchpad.net/deadsnakes/ppa/ubuntu/ focal main'
#Add the following rules which blacklist all packages from
the repos, and then selectively enable Python versions from the correct
locations. This can be put in any filename within the directory
/etc/apt/preferences.d/ (I named mine deadsnakes_pref)
Explanation: Prevent installing from deadsnakes repo.
Package: *
Pin: release o=LP-PPA-deadsnakes
Pin-Priority: 1
Explanation: Allow installing python 3.{6,7} from deadsnakes/focal
Package: python3.6 python3.7
Pin: release o=LP-PPA-deadsnakes,n=focal
Pin-Priority: 500
Explanation: Allow installing python 3.8 from deadsnakes/bionic
Package: python3.8
Pin: release o=LP-PPA-deadsnakes,n=bionic
Pin-Priority: 500
##temporarily change all your sources to bionic, so the python3.8
#dependencies will be met
$ sudo sed -i 's/impish/bionic/g' /etc/apt/sources.list
try to update the apt cache and install python3.8 . You'll get yelled
at for not having the proper key ring:
W: GPG error: http://us.archive.ubuntu.com/ubuntu bionic InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3B4FE6ACC0B21F32
E: The repository 'http://us.archive.ubuntu.com/ubuntu bionic InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
so following
https://askubuntu.com/questions/13065/how-do-i-fix-the-gpg-error-no-pubkey
, I add the key
$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3B4FE6ACC0B21F32
now this should work
$ sudo apt update && sudo apt install python3.8
#after we're done, don't forget to change back your sources
$ sudo sed -i 's/bionic/impish/g' /etc/apt/sources.list
$ sudo apt update
#And now pgadmin4 should work. If you want to run it from the terminal,
add this line to your ~/.bash_aliases file:
alias pgadmin4='/usr/pgadmin4/bin/pgadmin4'