I was able to install pgadmin4 on freshly installed ubuntu 23.04 using APT for Kinetic Kundu + several manual steps.
Note: Probably that is not the best approach, probably there are better, but that worked for me :shrugs:
Note2: I did it when pgAdmin 7.0 wasn't released; I used 6.21. But I believe that there should be not much difference (in step 5 it will be psycopg3, not psycopg2).
So, I did the following 5 steps:
- Prepare.
Install required dependencies. It's important to install them before you add the pgadmin's Kinetic apt list.
Otherwise you'll get issues with versions conflicts:
sudo apt install python3-pip python3-full libldap2 libpq5 libpq-dev
2). Add pgadmin's apt for Ubuntu Kinetic, like described here https://www.pgadmin.org/download/pgadmin-4-apt/
# Install the public key for the repository (if not done previously):
curl -fsS https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo gpg --dearmor -o /usr/share/keyrings/packages-pgadmin-org.gpg
# Create the repository configuration file:
sudo sh -c 'echo "deb [signed-by=/usr/share/keyrings/packages-pgadmin-org.gpg] https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/kinetic pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list && apt update'
Make sure you use 'kinetic' instead of lunar (don't use lsb_release, or replace 'lunar' to 'kinetic' after you added the repo).
i.e. check that file:
/etc/apt/sources.list.d/pgadmin4.list
has this line inside:
deb [signed-by=/usr/share/keyrings/packages-pgadmin-org.gpg] https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/kinetic pgadmin4 main
Then do the
sudo apt update
# 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
I proceeded with pgadmin4-desktop.
- at this moment you will get pgadmin installed.
But it will not work yet, because ubuntu 23.04 comes with python 3.11 installed; pgadmin4 from the apt expects python 3.10.
If you try to start the pgadmin, it will hang for 90 seconds, then you'll get the error message.
To not wait 90 seconds every time, you can use the following command to check / get the error message:
/usr/pgadmin4/venv/bin/python3 -s /usr/pgadmin4/web/pgAdmin4.py
make necessary links using the "ln -s " command.
Places to make the links:
/usr/bin/python3.11 -> python3.10 and a few links will be required inside /usr/pgadmin4/venv/ (maybe /usr/lib/python3.10 -> python3.11)
Unfortunately, I didn't write down exactly what links I made, so I can't give detailed instructions for this step at the moment. Take a look for broken links in these directories, and fix that. I used midnight commander (mc), it highlights broken links with red color. If you are stuck at this step, feel free to ask in the comments.
If you managed with that task and have documented the list of the links required, provide it please. I'll update the instructions.
after the python starts to work in the pgadmin virtual env,
the pgadmin will try to start, but will raise various errors.
You'll need to reinstall a few python modules in the pgadmin venv.
Namely:
psycopg2
cffi
psutil
greenlet
brotli
To do that, use the following command:
/usr/pgadmin4/venv/bin/pip3 uninstall <module_name>
then
/usr/pgadmin4/venv/bin/pip3 install <module_name>
Done! You have the pgadmin4 installed and working!
- Now click the thumb up and subscribe :) then grab a cup of your favorite drink :)