Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

postgresql - Get fatal error: server could not be contacted when running pgAdmin4. 'NoneType' object has no attribute 'value'

I have a fresh install of windows where I am trying to install Postgres and pgAdmin4. I did a fresh install of everything (pgAdmin 4, postrgres 13, etc.) with default settings. When I run pgAdmin 4 I get a "fatal error: server could not be contacted" with the following message:

pgAdmin Runtime Environment
--------------------------------------------------------
Python Path: "C:Program FilesPostgreSQL13pgAdmin 4pythonpython.exe"
Runtime Config File: "C:UsersusernameAppDataRoamingpgadmin
untime_config.json"
pgAdmin Config File: "C:Program FilesPostgreSQL13pgAdmin 4webconfig.py"
Webapp Path: "C:Program FilesPostgreSQL13pgAdmin 4webpgAdmin4.py"
pgAdmin Command: "C:Program FilesPostgreSQL13pgAdmin 4pythonpython.exe -s C:Program FilesPostgreSQL13pgAdmin 4webpgAdmin4.py"
Environment: 
  - ALLUSERSPROFILE: C:ProgramData
  - APPDATA: C:UsersusernameAppDataRoaming
  - CHROME_CRASHPAD_PIPE_NAME: \.pipecrashpad_4296_YJZESWNMDVNGRRUO
  - CHROME_RESTART: NW.js|Whoa! NW.js has crashed. Relaunch now?|LEFT_TO_RIGHT
  - CommonProgramFiles: C:Program FilesCommon Files
  - CommonProgramFiles(x86): C:Program Files (x86)Common Files
  - CommonProgramW6432: C:Program FilesCommon Files
  - COMPUTERNAME: pcname
  - ComSpec: C:Windowssystem32cmd.exe
  - configsetroot: C:WindowsConfigSetRoot
  - DriverData: C:WindowsSystem32DriversDriverData
  - HOMEDRIVE: C:
  - HOMEPATH: Usersusername
  - LOCALAPPDATA: C:UsersusernameAppDataLocal
  - LOGONSERVER: \pcname
  - NUMBER_OF_PROCESSORS: 8
  - NVM_HOME: C:UsersusernameAppDataRoaming
vm
  - NVM_SYMLINK: C:Program Files
odejs
  - OneDrive: C:UsersusernameOneDrive
  - OS: Windows_NT
  - Path: C:Windowssystem32;C:Windows;C:WindowsSystem32Wbem;C:WindowsSystem32WindowsPowerShellv1.0;C:WindowsSystem32OpenSSH;C:Program Files (x86)NVIDIA CorporationPhysXCommon;C:Program FilesGitcmd;C:Program FilesPostgreSQL12in;C:UsersusernameAppDataRoaming
vm;C:Program Files
odejs;C:UsersusernameAppDataLocalMicrosoftWindowsApps;C:UsersusernameAppDataLocalProgramsMicrosoft VS Codein
  - PATHEXT: .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
  - PGADMIN_INT_KEY: 2e023387-9c82-4cdd-af2f-c82562c6e4fc
  - PGADMIN_INT_PORT: 50567
  - PGADMIN_SERVER_MODE: OFF
  - PROCESSOR_ARCHITECTURE: AMD64
  - PROCESSOR_IDENTIFIER: Intel64 Family 6 Model 140 Stepping 1, GenuineIntel
  - PROCESSOR_LEVEL: 6
  - PROCESSOR_REVISION: 8c01
  - ProgramData: C:ProgramData
  - ProgramFiles: C:Program Files
  - ProgramFiles(x86): C:Program Files (x86)
  - ProgramW6432: C:Program Files
  - PSModulePath: C:Program FilesWindowsPowerShellModules;C:Windowssystem32WindowsPowerShellv1.0Modules
  - PUBLIC: C:UsersPublic
  - SystemDrive: C:
  - SystemRoot: C:Windows
  - TEMP: C:UsersusernameAppDataLocalTemp
  - TMP: C:UsersusernameAppDataLocalTemp
  - USERDOMAIN: pcname
  - USERDOMAIN_ROAMINGPROFILE: pcname
  - USERNAME: username
  - USERPROFILE: C:Usersusername
  - windir: C:Windows
--------------------------------------------------------

Traceback (most recent call last):
  File "C:Program FilesPostgreSQL13pgAdmin 4webpgAdmin4.py", line 98, in <module>
    app = create_app()
  File "C:Program FilesPostgreSQL13pgAdmin 4webpgadmin\__init__.py", line 347, in create_app
    if not os.path.exists(SQLITE_PATH) or get_version() == -1:
  File "C:Program FilesPostgreSQL13pgAdmin 4webpgadminsetupdb_version.py", line 19, in get_version
    return version.value
AttributeError: 'NoneType' object has no attribute 'value'

Note: 'username' and 'pcname' are placeholders that I substituted for the actual strings, some of which were originally capitalized.

Verified service "postgresql-x64-13" was running. I continue to get this message despite trying the following:

  • Running as administrator.
  • Deleting C:UsersusernameAppDataRoamingpgadmin.
  • Adding C:Program FilesPostgreSQL13in to the PATH environment variable (system and user)
  • Restarting the service.
  • Uninstalling/reinstalling Postgres 13.
  • Uninstalling/installing Postgres 12.
  • Restarting my machine.

The one thing that yielded different results was stopping the service, deleting C:UsersusernameAppDataRoamingpgadmin, restarting the service, then running pg4admin which resulted in a "fatal error" with the following output:

pgAdmin Runtime Environment
--------------------------------------------------------
Python Path: "C:Program FilesPostgreSQL13pgAdmin 4pythonpython.exe"
Runtime Config File: "C:UsersusernameAppDataRoamingpgadmin
untime_config.json"
pgAdmin Config File: "C:Program FilesPostgreSQL13pgAdmin 4webconfig.py"
Webapp Path: "C:Program FilesPostgreSQL13pgAdmin 4webpgAdmin4.py"
pgAdmin Command: "C:Program FilesPostgreSQL13pgAdmin 4pythonpython.exe -s C:Program FilesPostgreSQL13pgAdmin 4webpgAdmin4.py"
Environment: 
  - ALLUSERSPROFILE: C:ProgramData
  - APPDATA: C:UsersusernameAppDataRoaming
  - CHROME_CRASHPAD_PIPE_NAME: \.pipecrashpad_10312_CHCJAQAYYFQQIAGB
  - CHROME_RESTART: NW.js|Whoa! NW.js has crashed. Relaunch now?|LEFT_TO_RIGHT
  - CommonProgramFiles: C:Program FilesCommon Files
  - CommonProgramFiles(x86): C:Program Files (x86)Common Files
  - CommonProgramW6432: C:Program FilesCommon Files
  - COMPUTERNAME: pcname
  - ComSpec: C:Windowssystem32cmd.exe
  - configsetroot: C:WindowsConfigSetRoot
  - DriverData: C:WindowsSystem32DriversDriverData
  - HOMEDRIVE: C:
  - HOMEPATH: Usersusername
  - LOCALAPPDATA: C:UsersusernameAppDataLocal
  - LOGONSERVER: \pcname
  - NUMBER_OF_PROCESSORS: 8
  - NVM_HOME: C:UsersusernameAppDataRoaming
vm
  - NVM_SYMLINK: C:Program Files
odejs
  - OneDrive: C:UsersusernameOneDrive
  - OS: Windows_NT
  - Path: C:Windowssystem32;C:Windows;C:WindowsSystem32Wbem;C:WindowsSystem32WindowsPowerShellv1.0;C:WindowsSystem32OpenSSH;C:Program Files (x86)NVIDIA CorporationPhysXCommon;C:Program FilesGitcmd;C:Program FilesPostgreSQL13in;C:UsersusernameAppDataRoaming
vm;C:Program Files
odejs;C:UsersusernameAppDataLocalMicrosoftWindowsApps;C:UsersusernameAppDataLocalProgramsMicrosoft VS Codein;C:UsersusernameAppDataRoaming
vm;C:Program Files
odejs;C:Program FilesPostgreSQL13in;
  - PATHEXT: .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
  - PGADMIN_INT_KEY: cb6cf8e1-ca8b-416b-985f-1fd1a945ff06
  - PGADMIN_INT_PORT: 50906
  - PGADMIN_SERVER_MODE: OFF
  - PROCESSOR_ARCHITECTURE: AMD64
  - PROCESSOR_IDENTIFIER: Intel64 Family 6 Model 140 Stepping 1, GenuineIntel
  - PROCESSOR_LEVEL: 6
  - PROCESSOR_REVISION: 8c01
  - ProgramData: C:ProgramData
  - ProgramFiles: C:Program Files
  - ProgramFiles(x86): C:Program Files (x86)
  - ProgramW6432: C:Program Files
  - PSModulePath: C:Program FilesWindowsPowerShellModules;C:Windowssystem32WindowsPowerShellv1.0Modules
  - PUBLIC: C:UsersPublic
  - SESSIONNAME: Console
  - SystemDrive: C:
  - SystemRoot: C:Windows
  - TEMP: C:UsersusernameAppDataLocalTemp
  - TMP: C:UsersusernameAppDataLocalTemp
  - USERDOMAIN: pcname
  - USERDOMAIN_ROAMINGPROFILE: pcname
  - USERNAME: username
  - USERPROFILE: C:Usersusername
  - windir: C:Windows
--------------------------------------------------------

NOTE: Configuring authentication for DESKTOP mode.

Traceback (most recent call last):
  File "C:Program FilesPostgreSQL13pgAdmin 4webpgAdmin4.py", line 91, in <module>
    exec(open(file_quote(setup_py), 'r').read())
  File "<string>", line 506, in <module>
  File "<string>", line 378, in setup_db
  File "C:Program FilesPostgreSQL13pgAdmin 4webpgadmin\__init__.py", line 351, in create_app
    db_upgrade(app)
  File "C:Program FilesPostgreSQL13pgAdmin 4webpgadminsetupdb_upgrade.py", line 25, in db_upgrade
    flask_migrate.upgrade(migration_folder)
  File "C:Program FilesPostgreSQL13pgAdmin 4pythonlibsite-packagesflask_migrate\__init__.py", line 96, in wrapped
    f(*args, **kwargs)
  File "C:Program FilesPostgreSQL13pgAdmin 4pythonlibsite-packagesflask_migrate\__init__.py", line 271, in upgrade
    command.upgrade(config, revision, sql=sql, tag=tag)
  File "C:Program FilesPostgreSQL13pgAdmin 4pythonlibsite-packagesalembiccommand.py", line 294, in upgrade
    script.run_env()
  File "C:Program FilesPostgreSQL13pgAdmin 4pythonlibsite-packagesalembicscriptase.py", line 490, in run_env
    util.load_python_file(self.dir, "env.py")
  File "C:Program FilesPostgreSQL13pgAdmin 4pythonlibsite-packagesalembicutilpyfiles.py", line 97, in load_python_file
    module = load_module_py(module_id, path)
  File "C:Program FilesPostgreSQL13pgAdmin 4pythonlibsite-packagesalembicutilcompat.py", line 182, in load_module_py
    spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "C:Program FilesPostgreSQL13pgAdmin 4webpgadminsetup....migrationsenv.py", line 93, in <module>
    run_migrations_online()
  File "C:Program FilesPostgreSQL13pgAdmin 4webpgadminsetup....migrationsenv.py", line 86, in run_migrations_online
    context.run_migrations()
  File "<string>", line 8, in run_migrations
  File "C:Program FilesPostgreSQL13pgAdmin 4pythonlibsite-packagesalembic
untimeenvironment.py", line 813, in run_migrations
    self.get_context().run_migrations(**kw)
  File "C:Program FilesPostgreSQL13pgAdmin 4pythonlibsite-packagesalembic
untimemigration.py", line 561, in run_migrations
    step.migration_fn(**kw)
  File "C:Program FilesPostgreSQL13pgAdmin 4webmigrationsversionsfdc58d9bd449_.py", line 122, in upgrade
    Security(current_app, user_datastore, register_blueprint=False)
  File "C:Program FilesPostgreSQL13pgAdmin 4pythonlibsite-packagesflask_securitycore.py", line 1062, in __init__
    self._state = self.init_app(
  File "C:Program FilesPostgreSQL13pgAdmin 4pythonlibsite-packagesflask_securitycore.py", line 1102, in init_app
    self._state = state = _get_state(app, datastore, **kwargs)
  File "C:Program FilesPostgreSQL13pgAdmin 4pythonlibsite-packagesflask_securitycore.py", line 608, in _get_state
    remember_token_serializer=_get_serializer(app, "remember"),
  File "C:Program FilesPostgreSQL13pgAdmin 4pythonlibsite-packagesflask_securitycore.py", line 593, in _get_serializer
    return URLSafeTimedSerializer(secret_key=secret_key, salt=salt)
  File "C:Program FilesPostgreSQL13pgAdmin 4pythonlibsite-packagesitsdangerousserializer.py", line 104, in __init__
    self.secret_keys: _t.List[bytes] = _make_keys_list(secret_key)
  File "C:Program FilesPostgreSQL13pgAdmin 4pythonlibsite-packagesitsdangeroussigner.py", line 64, in _make_keys_list
    return [want_bytes(s) for s in secret_key]
TypeError: 'NoneType' object is not iterable

I recently installed this on a different machine without any issues. Seems odd that a fresh build would have the issues. Almost makes me think I am lacking something the older build contains (python?), although this shouldn't be the case. There are lots of posts about this and I have tried everything suggested in them without resolution.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

As Delsx pointed out in the comments, the standalone pgAdmin can be installed without the same issues from pgadmin.org/download. It appears this is a widespread bug that has been reported on the pgAdmin bug list, here and here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...