I have installed PostgreSQL 9.6.2 on my Windows 8.1. But the pgadmin4 is not able to contact the local server. I have tried several solutions suggested here in stackoverflow, tried to uninstall and reinstall PostgreSQL 9.6.2 , tried to modify the config.py, config_distro.py, and delete the files in Roaming folder,i tried standalone pgadmin4 installation, but no success.However, in my local machine i am able to access the server using psql.exe and log as as superuser (postgres user). Can you please suggest any possible solutions to starting/running pgadmin4 ? Thank you.
-
2watch that you don't have multiple versions of pgadmin installed. I had installed 1.6 and 2.0 at the same time and was accidentally starting the old version due to a pinned app. – Matthew Lock Nov 16 '17 at 07:36
-
Possible duplicate of [Postgres could not connect to server](https://stackoverflow.com/questions/13410686/postgres-could-not-connect-to-server) – daemonThread Apr 19 '18 at 07:00
-
This works too https://stackoverflow.com/questions/44101231/error-when-opening-pgadmin-4-on-mac/46372782#46372782 – Michael Buen May 03 '18 at 05:01
-
3Restarting the Postgres service is worked for me. – Gajendra Aug 20 '18 at 14:27
42 Answers
I found the same issue when upgrading to pgAdmin 4 (v1.6). On Windows I found that clearing out the content inside C:\Users\%USERNAME%\AppData\Roaming\pgAdmin\sessions
folder fixed the issue for me. I believe it was attempting to use the sessions from the prior version and was failing. I know the question was marked as answered, but downgrading may not always be an option.
Note: AppData\Roaming\pgAdmin is a hidden folder.
-
27Be aware that by doing this, you lose all your saved connections. – ChristopherS Oct 06 '17 at 06:52
-
1This solution worked in my case as well. I encountered the same problem after upgrading from PostgreSQL 9.6 to 10. I use Windows 64 Bit. I agree that this is the one that should be marked as the solution. – Alex Nov 07 '17 at 14:08
-
1@icvader I'm using pgadmin4 v2.0 and your answer worked like a charm, thank you. – Seyfi Dec 15 '17 at 10:48
-
1`Delete everything inside from *C:\Users\{Username}\AppData\Roaming\pgAdmin*`. Thanks a lot for the solution and saving my time. – testuser Dec 31 '17 at 12:36
-
5For mac users this works as well by deleting ~/.pgadmin. WARNING: It will also delete your saved connections, as mentioned above. – jbodily Jan 11 '18 at 19:16
-
4to be honest: pgAdmin sucks. I repeatedly have to use this solution. But you do not only loose your connections: you also loose the update from 4.0 to 4.1. So every time this happens, it is A LOT of work – Alex Jan 22 '18 at 20:06
-
also: beware of the slow loading of pgAdmin4. If I can't wait about a minute (on my super new machine!!!) and change to a different app, the loading will not finish. And this can sometimes cause the server to not be contacted any more... – Alex Jan 22 '18 at 20:07
-
-
When I upgraded from pgadmin 4 to 4.2, I received the error. The cleanout of the directory mentioned in this solution worked right away for me. Thanks to icvader – bob-in-columbia Mar 28 '18 at 15:45
-
This is a fine solution. But pgadmin is taking longer to restore the database. I am not sure about that – Lokesh Pandey Apr 16 '18 at 06:50
-
-
Worked for me in pgAdmin 10.5! Although I need to repeat it, every time I use pgAdmin. Also, doesn't always work at once, sometimes it works when i restart pgAdmin twice. No idea why! – Abhishek Kumawat Sep 19 '18 at 07:19
-
For me this was part of the solution: I needed to combine it with a full uninstall and reinstall. Nuke it from a low orbit, ensuring all program and data directories are eliminated, then reinstall. Reboot after reinstall. After this is finally worked. – Tom Walker Oct 16 '18 at 16:26
-
24Do not delete C:\Users\%USERNAME%\AppData\Roaming\pgAdmin. Delete only files from C:\Users\%USERNAME%\AppData\Roaming\pgAdmin\sessions . – Developer Marius Žilėnas Feb 07 '19 at 12:13
-
6I had a fresh install that couldn't connect, and I had to delete the entire `%appdata%\pgAdmin` folder. Note that a quick way to access `%username%\AppData\Roaming` is the env variable `%appdata%` – Nelson Feb 14 '21 at 15:04
-
Tried to delete content of "%username%\AppData\Roaming\pgAdmin\sessions" folder but didnt't work. Considering previously we had 2 different pgadmin 4 installations from 2 different PostgreSQL server versions (11 and 14), we reinstalled standalone latest version of PgAdmin4 from scratch and finally cleared "%username%\AppData\Roaming\pgAdmin" folder ("sessions", "storage", etc..). It worked like a breeze :) – leodali Sep 08 '22 at 08:50
-
This worked perfectly for me after weeks of googling solutions. Thanks – Daniel Ngandu Oct 06 '22 at 05:59
Start pgAdmin 4 as administrator.
Do the following steps:
- Right click pgAdmin 4 icon
- Select "Run As Administrator"
-
3This worked for me on Windows 10 (64 bit) OS. Installed postgresql-9.6.9-1-windows-x64.exe and I could not start pgAdmin4. This solution worked. But that means I have to keep on running the app as admin. – Cletus Ajibade May 31 '18 at 15:44
-
I've been dealing with this for awhile (frustrating). So much that I have instructions on my desktop consolidating all of these ideas. Here is my magic combination to the solution:
- Delete from App Data C:\Users\%USERNAME%\AppData\Roaming\pgAdmin
- Add to Path Variables C:\Program Files\PostgreSQL\9.6\bin (I actually added it to both user and system)
- Right click and start as admin.
You don't have to do this every time but when it gets out of wack try these steps.

- 291
- 3
- 3
-
I lied. Still having the problem. I've uninstalled, reinstalled, etc. fed up. – Dizzy Sep 21 '18 at 21:24
-
Following those 3 steps I managed to use pgAdmin again, thanks! I did (2) only for my user not system. Using the content of the other answers I did not succeed, so I would choose this as the best answer! – UnDiUdin Apr 15 '22 at 12:41
I had the same issue on Windows 10, with a new installation of PostgreSQL 10.
I solved it by including the path C:\PostgreSQL\10\bin ({your path to postgresql}\bin) to system environment variables.
To access environment variables: Control Panel > System and security > System or right click on PC, then > Advance system settings > Environment variables > System variables > Path > Edit.

- 419
- 4
- 8
-
1This worked for me. I am using Win 7 and PostGreSQL 9.6.8. No need to downgrade pgAdmin 4. In my case it is a fresh installation, so no need to clear sessions folder. – Prince Mar 11 '19 at 12:31
Deleting the contents of C:\Users\%USERNAME%\AppData\Roaming\pgAdmin
directory worked for me!

- 2,758
- 1
- 20
- 30

- 477
- 5
- 10
-
Just to delete the session dir did not work for me. Only deleteing the whole pgAdmin folder worked. But had to configure it again :( – yonexbat May 16 '23 at 06:41
What finally worked was downgrading to pgadminIII-v.1.22:

- 4,704
- 38
- 51

- 2,567
- 4
- 22
- 43
It seems in most of the cases Postgres trying to use information from previous sessions to find/connect the server and failing. Clearing out the previous session info helped me, it is a combination of 2 already mentioned answers above:
- Navigate to Postgres session's folder
C:\Users\YourUsernameOrAdmin\AppData\Roaming\pgAdmin\sessions
- Delete all the data from this folder.
- Start PgAdmin in administrator mode.
Cheers!

- 2,520
- 21
- 24
if you are using Mac OS X here is a fix: Open terminal and run this command
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log restart
and for other OS just restart your Postgresql server, it will solve
Then start pgAdmin4, it will start as normal
Share or comment if saved someone

- 1,557
- 3
- 17
- 33
I had same issue on windows. I had v1.6 installed as well as v2.0. Uninstalling v1.6 allowed me to login.

- 61
- 1
- 1
-
Surprising that installing 2 didn't uninstall 1.6. In my case I had pinned the pgadmin icon to the start menu, which was attempting and failing to start pgadmin 1.6. – Matthew Lock Nov 16 '17 at 07:35
-
pgadmin v2.0 from postgresql 10.1 installation, did not start correctly. The version v2.1 from https://www.pgadmin.org/download/ works well. – mikowiec Jan 19 '18 at 12:22
I had the same problem, but running it as an admin worked.

- 47,830
- 31
- 106
- 135

- 61
- 1
- 4
Have you recently installed a new version of pgAdmin ?
This issue (and the misleading message) is simply due to the fact that old versions of pgAdmin are unable to read the settings saved by a newer version of pgAdmin !
Make sure you're starting the right version of pgAdmin (your shortcuts are likely to point to the old version !) and/or uninstall the old version: the upgrade wizard doesn't do it for you !
Deleting contents of folder C:\Users\User_Name\AppData\Roaming\pgAdmin\sessions
helped me, I was able to start and load the pgAdmin server

- 4,271
- 8
- 34
- 56

- 89
- 1
- 3
I had the same issue on the macosx
and I renamed .pgadmin (in /users/costa) to .pgadminx
and I was able to start pgAdmin4
.
-
2The question was `Can you please suggest any possible solutions to starting/running pgadmin4?`. It is true it was in the context of windows, but other people might have the same issue on other OSes as I had on macOS. My answer can help someone else. And actually it did. I guess I could add it as a comment to the original post. – boggy Apr 28 '18 at 00:55
-
Sorry, my bad. Please edit you answer that it so more focused on the solution, right now it is easy to misread. – Moti Korets Apr 28 '18 at 01:04
-
1After an hour of searching this was the only solution that allowed PG Admin4 to start up again. Very helpful – Getafix Aug 08 '18 at 11:29
In Windows Just go to this path and clear it ,that works !!
C:\Users\%USERNAME%\AppData\Roaming\pgAdmin

- 3,882
- 25
- 20
I was able to solve the problem by changing the pgAdmin web interface port.
I believe this problem occurred on my computer because I have several other services consuming webs ports like qBittorrent, IDEJetbrains, etc.
Right-clicking on the pgAdmin logo near the clock is possible to configure it.

- 606
- 1
- 8
- 10
-
If you have a Fixed Port Number configured on, you might want to try this out first before deleting the content of C:\Users\%USERNAME%\AppData\Roaming\pgAdmin, running it as an Administrator or even reinstalling pgAdmin – Ron Michael Jun 05 '20 at 00:21
If you use older postgresql version like 9.x and its services is running,PgAdmin 4 confused which server is base database.
So stop the service older version or new one.Run PgAdmin 4 as Administrator
Its worked for me

- 1,899
- 1
- 13
- 28
I use the cmd prompt on Windows 10 with psql postgres postgres
.
Then I launch pgAdmin4 and it works.

- 9,280
- 9
- 43
- 57

- 81
- 4
-
Windows7, postgresql10, postgres db settings unchanged. Sometimes pgAdmin4 launches, sometimes it doesn't. In the latter case using the command "psql [database] [user]" e.g. "psql postgres postgres" solve the issue, that is pgAmin4 then launches. Still, I would like to understand what is going on. – tagoma Mar 31 '18 at 09:13
This is often a firewall problem. The firewall log then shows dropped packets between 127.0.0.1: and 127.0.0.1:, where the latter is the port shown in the Browser to get no connection with. This means, that the connection between pgAdmin client (high_port_1) and pgAdmin server (high_port_2) is blocked. Check your firewall log and if you find dropped packets like described, adapt your firewall settings accordingly.

- 81
- 3
If none of the methods help try checking your system and user environments PATH and PYTHONPATH variables.
I was getting this error due to my PATH variable was pointing to different Python installation (which comes from ArcGIS Desktop).
After removing path to my Python installation from PATH variable and completely removing PYTHONPATH variable, I got it working!
Keep in mind that python command will not be available from command line if you remove it from PATH.

- 19
- 1
- 3
I had this problem with pgadmin4 v2.1 on linux fedora 27
Solved by installing a missing dependency: python3-flask-babelex

- 21
- 1
-
Thank you very much for this hint, José! In fact, I was fighting to start pgAdmin 4 on my OpenSuSE Leap 15.0 machine, and it was in fact the missing dep you were telling about. – Neppomuk Nov 30 '18 at 22:11
Just click on that pgadmin 4 icon and run as administrator. Allow the access permissions. It will start locally.

- 39
- 1
- 5
I need to add this here because I've had several issues with this message. If you have recently upgraded to High Sierra you will find the latest (pgadmin 4.20) will keep appearing with the message "Application Server Could Not be Contacted". What this actually means on Macs is that python was unable to configure your environment in ~/.pgadmin
This directory stores all the things you setup and configure and even logs of what was ran on your user copy usage of pgadmin.
The way to fix this issue on High Sierra is down to sqlite3. If you look in that directory you'll see everything is stored in sqlite3 files.
When version 4.20 of pgadmin was released it was shipped with a version later than sqlite3.19 and the problem arises because High Sierra is shipped with sqlite3.19, so to fix this issue, you need to replace the old version of sqlite3 with the latest on your packager.
Now be aware, MacosX+ all use sqlite to store details for the majority of apps on your mac, so you'll need to make sure you do not just wipe the old version but you'll have to have both versions co-existing together in harmony to avoid anything major occurring on your mac.
1) download brew https://brew.sh/
2) update brew and upgrade brew to make sure it's up-to-date
3) brew install sqlite3
4) mv /usr/bin/sqlite3 /usr/bin/sqlite3.os
5) ln -s /usr/local/Cellar/sqlite/3.21.0/bin/sqlite3 /usr/bin/sqlite3
6) /usr/bin/sqlite3 -version (check version is later than 3.19)
You can now proceed to open up pgadmin as normal

- 11
- 1
-
Fails at step 4): mv: rename /usr/bin/sqlite3 to /usr/bin/sqlite3.os: Read-only file system – Ville Miekk-oja Jan 05 '20 at 14:32
Got this issue after I upgraded PostgreSQL 9.4 to 9.6. The 9.4 binary package had PgAdmin 3 while 9.6 came with PgAdmin 4. I resolved it after a clean installation (I completely uninstalled and reinstalled) of PostgreSQL.
However, under different circumstances, you could try running the pgAdmin 4 application as an Administrator. This should fix the error.

- 105
- 2
- 15
downloaded pgadmin 4 v2.0 and install it no problem atm on force installation. try it. that was solution for me.

- 19
- 3
For my case in Windows 10 for postgresql 10 version, it worked by changing SERVER_MODE
to False
in config_distro.py
placed in web folder, as per these configuration settings: https://www.pgadmin.org/docs/pgadmin4/dev/desktop_deployment.html.
There are other settings mentioned in this answer (https://superuser.com/a/1131964) regarding python but I just changed SERVER_MODE
and it worked.

- 565
- 1
- 5
- 16
Kill it in Windows Task Manager and then try again. It seems that there is some sort of a problem when accessing the server from different applications.

- 6,429
- 3
- 17
- 25
As for me on windows 2012r2 it's start to work only after I reinstall pgAdmin 4 to folder c:\pgAdmin4. With out spaces and any special chars. And all so I give full permission to this folder in NTFS.

- 3
- 2
Happens mostly when you have multiple versions of pgadmin installed or while trying to upgrade. Even I tried everything from killing the "running PID on port 5432" to "changing the server mode". In my case I uninstall postgres and re-install it again on different port(5433).
Later, I opened it through cmd(right click on cmd and select "run cmd as an Administrator").

- 1,014
- 2
- 12
- 23
I ran into this issue as well. Windows 10. I had older version of pgAdmin 4 (1.6) and 2.0. I guess both are older now.
In any case a complete uninstall of both versions and a reinstall of 2.0 worked.

- 634
- 6
- 7
A variety of reasons attribute to the failure boot of pgAdmin 4. The reason to my situation is that my Windows system language is not English or utf-8 related. Changing the system locale to English solved the starting issue.

- 423
- 1
- 4
- 10
Last resort HKEY_CURRENT_USER\Software\pgadmin\pgadmin4 export/delete you know what to do here :)

- 93
- 2
- 12
I had a hard time getting pgadmin4 to run on Windows 10 because of having multiple pgadmin4's around, possibly having installed other python versions.
My first suggestion is:
The "application server" is not Postgres itself, but a python program launched by pgadmin4.
If like me you just invoke the Windows Start menu and start typing the name of the program you want to run (
p g a d m i n
...), take a moment to right-click on the results, open the file location, right-click on the executable and look at its properties to make sure it's the version you think you're running.If the version does not match your expectations, open the Start Menu and look carefully for the version you just installed.
Case 1:
One of the pgadmin versions I had trouble was a global installation of pgadmin4 version 3.5 in c:\Program Files\PostgreSQL\11\pgAdmin 4
. What worked for me in this case was making sure that its python virtual environment was setup properly.
- Go to the
c:\Program Files\PostgreSQL\11\pgAdmin 4\venv\Scripts
directory and editactivate.bat
. Make sure the path inset "VIRTUAL_ENV=...
is actuallyc:\Program Files\PostgreSQL\11\pgAdmin 4\venv
(or something that makes sense) - Open a command prompt and go to the
c:\Program Files\PostgreSQL\11\pgAdmin 4
directory - Activate the python environment by typing
.\venv\Scripts\activate.bat
; the command prompt should change - At this point, I could launch pgadmin4 manually from the command prompt using
.\bin\pgAdmin4.exe
- This version lets you right-click on its icon in the system tray, and you get a menu that lets you tweak a few settings and look for its logs.
Case 2:
During troubleshooting, I also installed a user specific pgadmin4 version 0.54.1 and it didn't work either. This one lives in c:\users\{your username}\AppData\Local\Programs\pgAdmin 4\v5\runtime\pgAdmin4.exe
.
- This version displays a configuration button when it fails to run.
- What worked for me here was running it as administrator and increasing the wait from 90 seconds to 2 minutes.

- 1,235
- 1
- 12
- 12
I had this issue after installing Postgres 13 on a windows 10 machine where already i had postgres 11.
After uninstalling all and reinstall 13 only I still had the problem.
I finally managed in his way:
- uninstall postgres from control panel /uninstall applications choosing the option "uninstall components" and choosing "pgadmin" ad component to uninstall
- downloaded pgadmin installer from pgadmin.org
- installed pgagdmin
- from the pgadmin preferences in the binarypath i put C:\Program Files\PostgreSQL\13\bin
This solved the issue for me.

- 14,924
- 39
- 151
- 249
I had a similar scenario:
Windows 8.1;
PostgresSQL 10 (x86) - installed via setup (file postgresql-10.22-1-windows.exe);
PG Admin 4 v3.6 installed separately;
Upon trying to open PG Admin, it would take a while and then timeout and give the error message reported in this thread.
I tried various solutions, including editing config.py, as the op said, but nothing worked, until I came across this video on YouTube
Essentially, and to cut the story short,
- open Add Programs and Features
- Uninstall/modify PostgreSQL installation
- Individual Components
- tick PG Admin 4 (which was installed along with the database, and is found in the same installation folder as PostgreSQL
- click Next.
After removing this installation of PG Admin 4, the stand alone installation started working

- 679
- 10
- 22
My solution was just reinstall pgadmin4.
Go to Uninstall programs but only uninstall pgadmin and not all postgresql.

- 1,793
- 19
- 38

- 35
- 1
- 1
- 4
Check for the port number (default is 5432
) it is connecting.
In my case, I uninstall the setup, deleted postgress folder from Program files.
Then reinstalled it and it started working.

- 2,455
- 13
- 33
- 37

- 42
- 5
I fixed this error another way that didn't write here before. Maybe my case was different but the solution approach will be helpful for someone. I had the same error for pgAdmin 4 v7.1 in windows10. And when I looked at the details I saw that the error includes this information:
import psutil
File "C:\Program Files\PostgreSQL\15\pgAdmin 4\python\lib\site-packages\psutil_init_.py", line 241, in module
raise ImportError(msg)
ImportError: version conflict: 'C:\Program Files\PostgreSQL\15\pgAdmin 4\python\lib\site-packages\psutil\_psutil_windows.cp310-win_amd64.pyd' C extension module was built for another version of psutil (5.9.3 instead of 5.9.5); you may try to 'pip uninstall psutil', manually remove C:\Program Files\PostgreSQL\15\pgAdmin 4\python\lib\site-packages\psutil_psutil_windows.cp310-win_amd64.pyd or clean the virtual env somehow, then reinstall
I removed this file manually and run pgAdmin again as administrator then my problem had fixed. Hope this answer will be helpful for someone

- 106
- 2
Deleting everything from this (C:\Users\YourUsernameOrAdmin\AppData\Roaming\pgAdmin) folder helped me launching pgAdmin4 server again
I am running pgAdmin4 v4.27 now. After I upgraded to pgAdmin4 v4.28 the problem started i.e. the server was not starting. I tried many ways including changing the content type of .js to test/javascript from text/plain, it did not work. Finally deleting all contents from C:\Users\YourUsernameOrAdmin\AppData\Roaming\pgAdmin helped me

- 89
- 1
- 3
-
Please, make sure your solution was not already proposed in [another answer](https://stackoverflow.com/a/45823367/6682517) before posting it – Sergey Shubin Nov 18 '20 at 12:48
try this
I encountered the same problem and activated the setup file, it created a database, and was restarting again
sudo /usr/pgadmin4/bin/setup-web.sh

- 59
- 6