I'm getting this error on startup of pgAdmin4 on Kubuntu 18.04:

An error occurred initialising the application server:
Failed to launch the application server, server thread exiting.

In the following window ("Configuration") I have these default values:

Python Path:
Application Path:

Since I don't have a /usr/pgadmin4/ directory, all of them are wrong.

See https://stackoverflow.com/questions/43968302/failed-to-launch-application-server-server-thread-existing-on-windows for the same error on Windows

5 Answers 5


For me, when I run pgadmin like Thomas Landauer says, I got this error:

$ sudo python3 /usr/share/pgadmin4/web/pgAdmin4.py
Traceback (most recent call last):
  File "/usr/share/pgadmin4/web/pgAdmin4.py", line 58, in <module>
    exec(open(file_quote(setupfile), 'r').read())
  File "<string>", line 47, in <module>
  File "/usr/share/pgadmin4/web/pgadmin/setup/data_directory.py", line 29, in create_app_data_directory
  File "/usr/share/pgadmin4/web/pgadmin/setup/data_directory.py", line 15, in _create_directory_if_not_exists
FileNotFoundError: [Errno 2] No such file or directory: '/var/cache/pgadmin/sessions'

The error says what is the problem, so I created the folders:

$ sudo mkdir -p /var/cache/pgadmin/sessions

And after restarting pgAdmin4, it first asked for user creation, then worked.


The problem seems to be that I have python2 and python3 installed. Solution (workaround) that works for me:

  1. Locate your pgAdmin4.py. In my case, it's /usr/share/pgadmin4/web/pgAdmin4.py
  2. Start it in a terminal like this: sudo python3 /usr/share/pgadmin4/web/pgAdmin4.py

If you have a better solution, please let us know :-)

I opened a ticket for this: https://redmine.postgresql.org/issues/3737


Forget about the prebuilt package (apt). It is broken in so many ways (Python path, PIP path, filesystem permission) while not showing much debug info.

Use Python wheel instead. At least it will should you what exactly is broken, chances are you need to

  • install a few modules (mako)
  • run with sudo (or fix file permission issue manually)
  • check logs ls .pg* -lh

Probably not the optimal way but here is how I got it to work

python3.7 -m pip install --user https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v4.5/pip/pgadmin4-4.5-py2.py3-none-any.whl

sudo python3.7 ~/.local/lib/python3.7/site-packages/pgadmin4/pgAdmin4.py
  • The way you phrase your answer is misleading: the fact that you had little success with the repository package does not necessary imply that there is a problem with the package. May 6, 2019 at 17:46

I've had the same issue after installing from

deb http://apt.postgresql.org/pub/repos/apt/

In the end, the solution was to directly enter in the web browser to access the server which should already run.

If you're having trouble accessing your installation, check the output of systemctl status apache2 which should indicate a running server. A good tutorial can be found at https://computingforgeeks.com/how-to-install-pgadmin-4-on-ubuntu/.


It is fixed 4.6 version. Uninstall which you installed.


  • Not sure how useful a link to a Windows version of an application will be … 🤔
    – user1091774
    Dec 13, 2020 at 4:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.