I installed PostgreSql on my Windows machine.
I can connect to PostgreSql through cmd.
But when I want to launch pgAdmin I am getting this error message.
In my case, SERVER_MODE was already False in config_distro.py. I then proceeded to start pgadmin4 as an administrator. This also did not work. Finally, I resolved this by restarting postgresql service in services.msc.
postgres service restart