The pgAdmin 4 server could not be contacted
Found these.  We'll give it a shot.
https://wiki.postgresql.org/wiki/Getting_a_stack_trace_of_a_running_PostgreSQL_backend_on_Linux/BSD
https://wiki.postgresql.org/wiki/Getting_a_stack_trace_of_a_running_PostgreSQL_backend_on_Windows

Windows debugging.
Open Environment Variables (WINDOWS key + BREAK)
Set environment variable &quot;_NT_SYMBOL_PATH&quot; for 4.2.
C:\Program Files\PostgreSQL\12\debug_symbols;SRV*c:\localsymbols*http://msdl.microsoft.com/download/symbols


open pgAdmin 4 &gt; look for process in Task Manager and get process id
open Microsoft Visual Studio (run as administrator) &gt; Debug &gt; Attach to Process &gt; check &quot;Show processes from all users&quot; &gt; sort by process id &gt; Attach
now go back in pgAdmin


Got a new popup I've never seen before from Visual Studio!

Created new virtual environment based on Python 3.8.

Created a new Visual Studio Project using Python, not C++.  I might need a newer version of Python based on this fix.
https://github.com/microsoft/ptvs/issues/5853
https://bugs.python.org/issue37633
Since this new version does not show in the Base Interpreter, I created a new environment based on the zip file.

None of that worked.  Then I stumbled upon the registry configuration for pgAdmin.  I read that pgAdmin uses Python version 2.7.  And the PythonPath variable was blank, so I set it to C:\Python\Python27.  So it must be using a value from somewhere else to get the path.  It's looking in sys.path in Python whatever that is.

Then I set ApplicationPath to C:\Program Files\pgAdmin 4\v4\web, to the folder where pgadmin4.py is located.
Here is the icon I'm clicking on each time.
&quot;C:\Program Files\pgAdmin 4\v4\runtime\pgAdmin4.exe&quot;
&quot;C:\Program Files\PostgreSQL\12\pgAdmin 4\bin\pgAdmin4.exe&quot;

ERROR flask.app: Error starting the app server: (&lt;class 'OSError'&gt;,
OSError(10013, 'An attempt was made to access a socket in a way
forbidden by its access permissions', None, 10013, None),

There are two pgAdmin folders.  There are traces left over from the other pgAdmin uninstall.
C:\Program Files (x86)\pgAdmin 4\files.txt
C:\Program Files (x86)\pgAdmin 4\v4
C:\Program Files (x86)\pgAdmin 4\v4\venv
C:\Program Files (x86)\pgAdmin 4\v4\venv\Lib
C:\Program Files (x86)\pgAdmin 4\v4\venv\Lib\collections
C:\Program Files (x86)\pgAdmin 4\v4\venv\Lib\encodings
C:\Program Files (x86)\pgAdmin 4\v4\venv\Lib\importlib
C:\Program Files (x86)\pgAdmin 4\v4\venv\Lib\json
C:\Program Files (x86)\pgAdmin 4\v4\venv\Lib\site-packages
C:\Program Files (x86)\pgAdmin 4\v4\venv\Lib\__pycache__
C:\Program Files (x86)\pgAdmin 4\v4\venv\Lib\collections\__pycache__
C:\Program Files (x86)\pgAdmin 4\v4\venv\Lib\collections\__pycache__\__init__.cpython-38.pyc
C:\Program Files (x86)\pgAdmin 4\v4\venv\Lib\encodings\__pycache__
C:\Program Files (x86)\pgAdmin 4\v4\venv\Lib\encodings\__pycache__\aliases.cpython-38.pyc
C:\Program Files (x86)\pgAdmin 4\v4\venv\Lib\encodings\__pycache__\cp1252.cpython-38.pyc
C:\Program Files (x86)\pgAdmin 4\v4\venv\Lib\encodings\__pycache__\latin_1.cpython-38.pyc
C:\Program Files (x86)\pgAdmin 4\v4\venv\Lib\encodings\__pycache__\utf_8.cpython-38.pyc
C:\Program Files (x86)\pgAdmin 4\v4\venv\Lib\encodings\__pycache__\__init__.cpython-38.pyc
C:\Program Files (x86)\pgAdmin 4\v4\venv\Lib\importlib\__pycache__
C:\Program Files (x86)\pgAdmin 4\v4\venv\Lib\importlib\__pycache__\abc.cpython-38.pyc
C:\Program Files (x86)\pgAdmin 4\v4\venv\Lib\importlib\__pycache__\machinery.cpython-38.pyc
C:\Program Files (x86)\pgAdmin 4\v4\venv\Lib\importlib\__pycache__\util.cpython-38.pyc
C:\Program Files (x86)\pgAdmin 4\v4\venv\Lib\importlib\__pycache__\__init__.cpython-38.pyc
C:\Program Files (x86)\pgAdmin 4\v4\venv\Lib\json\__pycache__
C:\Program Files (x86)\pgAdmin 4\v4\venv\Lib\json\__pycache__\decoder.cpython-38.pyc
C:\Program Files (x86)\pgAdmin 4\v4\venv\Lib\json\__pycache__\encoder.cpython-38.pyc
C:\Program Files (x86)\pgAdmin 4\v4\venv\Lib\json\__pycache__\scanner.cpython-38.pyc
C:\Program Files (x86)\pgAdmin 4\v4\venv\Lib\json\__pycache__\__init__.cpython-38.pyc
C:\Program Files (x86)\pgAdmin 4\v4\venv\Lib\site-packages\__pycache__
C:\Program Files (x86)\pgAdmin 4\v4\venv\Lib\site-packages\__pycache__\_virtualenv.cpython-38.pyc
C:\Program Files (x86)\pgAdmin 4\v4\venv\Lib\__pycache__\abc.cpython-38.pyc
C:\Program Files (x86)\pgAdmin 4\v4\venv\Lib\__pycache__\codecs.cpython-38.pyc
C:\Program Files (x86)\pgAdmin 4\v4\venv\Lib\__pycache__\contextlib.cpython-38.pyc
C:\Program Files (x86)\pgAdmin 4\v4\venv\Lib\__pycache__\copyreg.cpython-38.pyc
C:\Program Files (x86)\pgAdmin 4\v4\venv\Lib\__pycache__\datetime.cpython-38.pyc
C:\Program Files (x86)\pgAdmin 4\v4\venv\Lib\__pycache__\enum.cpython-38.pyc
C:\Program Files (x86)\pgAdmin 4\v4\venv\Lib\__pycache__\functools.cpython-38.pyc
C:\Program Files (x86)\pgAdmin 4\v4\venv\Lib\__pycache__\genericpath.cpython-38.pyc
C:\Program Files (x86)\pgAdmin 4\v4\venv\Lib\__pycache__\heapq.cpython-38.pyc
C:\Program Files (x86)\pgAdmin 4\v4\venv\Lib\__pycache__\io.cpython-38.pyc
C:\Program Files (x86)\pgAdmin 4\v4\venv\Lib\__pycache__\keyword.cpython-38.pyc
C:\Program Files (x86)\pgAdmin 4\v4\venv\Lib\__pycache__\ntpath.cpython-38.pyc
C:\Program Files (x86)\pgAdmin 4\v4\venv\Lib\__pycache__\operator.cpython-38.pyc
C:\Program Files (x86)\pgAdmin 4\v4\venv\Lib\__pycache__\os.cpython-38.pyc
C:\Program Files (x86)\pgAdmin 4\v4\venv\Lib\__pycache__\re.cpython-38.pyc
C:\Program Files (x86)\pgAdmin 4\v4\venv\Lib\__pycache__\reprlib.cpython-38.pyc
C:\Program Files (x86)\pgAdmin 4\v4\venv\Lib\__pycache__\signal.cpython-38.pyc
C:\Program Files (x86)\pgAdmin 4\v4\venv\Lib\__pycache__\site.cpython-38.pyc
C:\Program Files (x86)\pgAdmin 4\v4\venv\Lib\__pycache__\sre_compile.cpython-38.pyc
C:\Program Files (x86)\pgAdmin 4\v4\venv\Lib\__pycache__\sre_constants.cpython-38.pyc
C:\Program Files (x86)\pgAdmin 4\v4\venv\Lib\__pycache__\sre_parse.cpython-38.pyc
C:\Program Files (x86)\pgAdmin 4\v4\venv\Lib\__pycache__\stat.cpython-38.pyc
C:\Program Files (x86)\pgAdmin 4\v4\venv\Lib\__pycache__\subprocess.cpython-38.pyc
C:\Program Files (x86)\pgAdmin 4\v4\venv\Lib\__pycache__\threading.cpython-38.pyc
C:\Program Files (x86)\pgAdmin 4\v4\venv\Lib\__pycache__\types.cpython-38.pyc
C:\Program Files (x86)\pgAdmin 4\v4\venv\Lib\__pycache__\warnings.cpython-38.pyc
C:\Program Files (x86)\pgAdmin 4\v4\venv\Lib\__pycache__\_bootlocale.cpython-38.pyc
C:\Program Files (x86)\pgAdmin 4\v4\venv\Lib\__pycache__\_collections_abc.cpython-38.pyc
C:\Program Files (x86)\pgAdmin 4\v4\venv\Lib\__pycache__\_sitebuiltins.cpython-38.pyc
C:\Program Files (x86)\pgAdmin 4\v4\venv\Lib\__pycache__\_weakrefset.cpython-38.pyc
C:\Program Files (x86)\pgAdmin 4\v4\venv\Lib\__pycache__\__future__.cpython-38.pyc

FINALLY SOLVED IT!  Flask within the Qt framework is NOT getting the port!  I put some troubleshooting code into the source code.

C:\Program Files\pgAdmin 4\v4\web\pgAdmin4.py

# Initialize Flask service only once
# If `WERKZEUG_RUN_MAIN` is None, i.e: app is initializing for first time
# so set `use_reloader` = False, thus reload won't call.
# Reference:
# https://github.com/pallets/werkzeug/issues/220#issuecomment-11176538
with open(&quot;myfile.txt&quot;, &quot;w&quot;) as file1:
    file1.write(&quot;Testing&quot;)
    file1.write(config.DEFAULT_SERVER)
    file1.write(config.EFFECTIVE_SERVER_PORT)
try:
    app.run(
        host=config.DEFAULT_SERVER,
        port=config.EFFECTIVE_SERVER_PORT,
        use_reloader=(
            (not app.PGADMIN_RUNTIME) and app.debug and
            os.environ.get(&quot;WERKZEUG_RUN_MAIN&quot;) is not None
        ),
        threaded=config.THREADED_MODE
    )

except IOError:
    app.logger.error(&quot;Error starting the app server: %s&quot;, sys.exc_info())