Kaleab Woldemariam
Kaleab Woldemariam

Reputation: 3003

pgadmin4 : postgresql application server could not be contacted

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 on 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, on 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.

Upvotes: 173

Views: 430826

Answers (30)

kirubel Tamene
kirubel Tamene

Reputation: 19

For Windows

1 -> Go to C:\Users\%USERNAME%\AppData\Roaming\pgAdmin

  • change the username to your own username tho in the above path 2 -> Select all -> Delete all 3 -> Search for pg-Admin and right click - run as administrator.

Now it works. atleast for me!

Upvotes: 0

Long Tran
Long Tran

Reputation: 83

For my case installing Postgres 16 on Windows 11.

  1. Install Postgres only and drivers via StackBuilder (don't install pgAdmid4 at this step). enter image description here
  1. Install pgAdmin4 separately via https://www.pgadmin.org/download/pgadmin-4-windows/

  2. Check in Services to ensure Postgres + pgAdmin4 are running.

Upvotes: 0

Ameliance SkyMusic
Ameliance SkyMusic

Reputation: 371

Just restart Windows right after installation

Upvotes: 1

erakm
erakm

Reputation: 106

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

Upvotes: 0

Praneet Rane
Praneet Rane

Reputation: 118

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.

Upvotes: 0

rogeliorichman
rogeliorichman

Reputation: 143

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

Upvotes: 0

Hardik
Hardik

Reputation: 1717

Start pgAdmin 4 as administrator.

Do the following steps:

  1. Right click pgAdmin 4 icon
  2. Select "Run As Administrator"

Upvotes: 131

Ricardo Appleton
Ricardo Appleton

Reputation: 679

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

Upvotes: 0

UnDiUdin
UnDiUdin

Reputation: 15404

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:

  1. uninstall postgres from control panel /uninstall applications choosing the option "uninstall components" and choosing "pgadmin" ad component to uninstall
  2. downloaded pgadmin installer from pgadmin.org
  3. installed pgagdmin
  4. from the pgadmin preferences in the binarypath i put C:\Program Files\PostgreSQL\13\bin

This solved the issue for me.

Upvotes: 0

icvader
icvader

Reputation: 3486

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.

Upvotes: 326

Luis
Luis

Reputation: 1235

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 edit activate.bat. Make sure the path in set "VIRTUAL_ENV=... is actually c:\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.

Upvotes: 0

Language Lassi
Language Lassi

Reputation: 2630

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:

  1. Navigate to Postgres session's folder C:\Users\YourUsernameOrAdmin\AppData\Roaming\pgAdmin\sessions
  2. Delete all the data from this folder.
  3. Start PgAdmin in administrator mode.

Cheers!

Upvotes: 12

Vinod Kumar Gupta
Vinod Kumar Gupta

Reputation: 109

Deleting contents of folder C:\Users\User_Name\AppData\Roaming\pgAdmin\sessions helped me, I was able to start and load the pgAdmin server

Upvotes: 7

Ammar Abdul Wadood
Ammar Abdul Wadood

Reputation: 59

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

Upvotes: -1

Vinod Kumar Gupta
Vinod Kumar Gupta

Reputation: 109

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

Upvotes: -1

CodeM7
CodeM7

Reputation: 113

Last resort HKEY_CURRENT_USER\Software\pgadmin\pgadmin4 export/delete you know what to do here :)

Upvotes: 0

user12949097
user12949097

Reputation: 473

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.

Upvotes: 0

A_jain2310
A_jain2310

Reputation: 37

Just click on that pgadmin 4 icon and run as administrator. Allow the access permissions. It will start locally.

Upvotes: 2

Balin
Balin

Reputation: 81

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.

Upvotes: 3

Akshata Dabade
Akshata Dabade

Reputation: 567

Deleting the contents of C:\Users\%USERNAME%\AppData\Roaming\pgAdmin directory worked for me!

Upvotes: 23

5637800
5637800

Reputation: 687

I Fixed it in windows 10 just running pgAdmin 4 as Run as Administrator .

Upvotes: 5

Wilson Tamarozzi
Wilson Tamarozzi

Reputation: 646

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.

enter image description here

Upvotes: 4

Dizzy
Dizzy

Reputation: 397

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:

  1. Delete from App Data C:\Users\%USERNAME%\AppData\Roaming\pgAdmin
  2. Add to Path Variables C:\Program Files\PostgreSQL\9.6\bin (I actually added it to both user and system)
  3. 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.

Upvotes: 30

Akitha_MJ
Akitha_MJ

Reputation: 4294

In Windows Just go to this path and clear it ,that works !!

C:\Users\%USERNAME%\AppData\Roaming\pgAdmin

Upvotes: 5

Michael P. Scott
Michael P. Scott

Reputation: 714

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.

Upvotes: 0

gxet4n
gxet4n

Reputation: 369

You should downgrade to pgadmin3. It Worked for me on windows 10.1 with postrgreSQL 9.6.

Upvotes: -1

boggy
boggy

Reputation: 4027

I had the same issue on the macosx and I renamed .pgadmin (in /users/costa) to .pgadminx and I was able to start pgAdmin4.

Upvotes: 3

daemonThread
daemonThread

Reputation: 1044

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").enter image description here

Upvotes: 0

Jose Miguel Perez
Jose Miguel Perez

Reputation: 21

I had this problem with pgadmin4 v2.1 on linux fedora 27

Solved by installing a missing dependency: python3-flask-babelex

Upvotes: 2

Magdalena
Magdalena

Reputation: 449

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.

Upvotes: 21

Related Questions