Tayyab Vohra
Tayyab Vohra

Reputation: 1662

How to install pgadmin4 on Ubuntu

I am trying to install pgadmin4 on ubuntu vps server but i am unable to install . I am getting this error

postgres version 12.2 ubuntu version 18.04

unable to figure out this error , any help would be appreciated tried everything but didnot worked

Setting up pgadmin4-apache2 (4.18-1.pgdg18.04+1) ...
apache2_invoke pgadmin4: already enabled
Traceback (most recent call last):
  File "setup.py", line 413, in <module>
    setup_db()
  File "setup.py", line 347, in setup_db
    app = create_app()
  File "/usr/share/pgadmin4/web/pgadmin/__init__.py", line 400, in create_app
    driver.init_app(app)
  File "/usr/share/pgadmin4/web/pgadmin/utils/driver/__init__.py", line 40, in init_app
    DriverRegistry.load_drivers()
  File "/usr/share/pgadmin4/web/pgadmin/utils/driver/registry.py", line 88, in load_drivers
    module = import_module(module_name)
  File "/usr/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/share/pgadmin4/web/pgadmin/utils/driver/psycopg2/__init__.py", line 28, in <module>
    from .server_manager import ServerManager
  File "/usr/share/pgadmin4/web/pgadmin/utils/driver/psycopg2/server_manager.py", line 30, in <module>
    from sshtunnel import SSHTunnelForwarder, BaseSSHTunnelForwarderError
  File "/usr/lib/python3/dist-packages/sshtunnel.py", line 25, in <module>
    import paramiko
  File "/usr/lib/python3/dist-packages/paramiko/__init__.py", line 30, in <module>
    from paramiko.transport import SecurityOptions, Transport
  File "/usr/lib/python3/dist-packages/paramiko/transport.py", line 66, in <module>
    from paramiko.sftp_client import SFTPClient
  File "/usr/lib/python3/dist-packages/paramiko/sftp_client.py", line 41, in <module>
    from paramiko.sftp_file import SFTPFile
  File "/usr/lib/python3/dist-packages/paramiko/sftp_file.py", line 66
    self._close(async=True)
                    ^
SyntaxError: invalid syntax
dpkg: error processing package pgadmin4-apache2 (--configure):
 installed pgadmin4-apache2 package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 pgadmin4-apache2
E: Sub-process /usr/bin/dpkg returned an error code (1)

Upvotes: 3

Views: 2987

Answers (3)

fraimbault
fraimbault

Reputation: 1

As printed in log issue is in File "/usr/lib/python3/dist-packages/paramiko/sftp_file.py", line 66 self._close(async=True)

The problem seems to be with the name choosen for the variable async set to True in the above example. async is also a python command, so I suppose Python interpret async as the python command not a variable.

I renamed all async variable to aasync in file "/usr/lib/python3/dist-packages/paramiko/sftp_file.py" and then try to install python3-paramiko. I have no error anymore.

Upvotes: 0

Ghazaleh Javaheri
Ghazaleh Javaheri

Reputation: 2117

from pgadmin website:

Setup the repository

Install the public key for the repository (if not done previously):

sudo curl https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo apt-key add

Create the repository configuration file:

sudo sh -c 'echo "deb https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/$(lsb_release -cs) pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list && apt update'

Install pgAdmin

Install for both desktop and web modes:

sudo apt install pgadmin4

Install for desktop mode only:

sudo apt install pgadmin4-desktop

Install for web mode only:

sudo apt install pgadmin4-web 

Configure the webserver, if you installed pgadmin4-web:

sudo /usr/pgadmin4/bin/setup-web.sh

Upvotes: 0

Pavel Franc&#237;rek
Pavel Franc&#237;rek

Reputation: 188

Solution for me was explicitly install package python3-paramiko:

apt-get install python3-paramiko

Resulted in:

Preparing to unpack .../python3-paramiko_2.6.0-2_all.deb ...
Unpacking python3-paramiko (2.6.0-2) over (2.0.0-1ubuntu1.2) ...
Setting up python3-bcrypt (3.1.7-2ubuntu1) ...
Setting up python3-cryptography (2.8-3ubuntu0.1) ...
Setting up pgadmin4-apache2 (4.25-1.pgdg20.04+1) ...
pgAdmin 4 - Application Initialisation
======================================

Setting up python3-nacl (1.3.0-5) ...
Setting up python3-paramiko (2.6.0-2) ...

Happened during release upgrade from 18.04 to 20.04. Error traceback was the same.

Upvotes: 1

Related Questions