I already found the solution, I just want to share it in case someone has the same problem.


Install pgAdmin4 version 4.30 on Linux Mint 20 (Ulyana) and Linux Mint 20.1 (Ulyssa) inside virtualenv. The bulk of pgAdmin4 is a Python web application written using the Flask framework. Therefore, it is an ideal candidate to be implemented in a Python virtualenv as indicated in:

How to Install PostgreSQL with pgAdmin4 on Linux Mint 20


Installing pgAdmin 4 on Linux Mint 20 (ulyana)

And in Spanish,

Cómo instalar PostgreSQL con pgAdmin4 en Linux Mint 20


After finishing the process, when trying to run pgAdmin4 for the first time, the following error appears:

Traceback (most recent call last):
  File "venv/lib/python3.8/site-packages/pgadmin4/pgAdmin4.py", line 87, in <module>
    exec(open(file_quote(setup_py), 'r').read())
  File "<string>", line 449, in <module>
  File "<string>", line 372, in setup_db

  File "/home/mint/pgAdmin4/venv/lib/python3.8/site-packages/flask_sqlalchemy/__init__.py", line 575, in get_options
    self._sa.apply_driver_hacks(self._app, sa_url, options)
  File "/home/mint/pgAdmin4/venv/lib/python3.8/site-packages/flask_sqlalchemy/__init__.py", line 908, in apply_driver_hacks
    sa_url.database = os.path.join(app.root_path, sa_url.database)
AttributeError: can't set attribute

In the second attempt to execute pgAdmin4 the error shown is:

Traceback (most recent call last):
  File "/home/mint/pgAdmin4/venv/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1705, in _execute_context
  File "/home/mint/pgAdmin4/venv/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 681, in do_execute
    cursor.execute(statement, parameters)
sqlite3.OperationalError: table version already exists

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "venv/lib/python3.8/site-packages/pgadmin4/pgAdmin4.py", line 94, in <module>
    app = create_app()

  File "/home/mint/pgAdmin4/venv/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 681, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) table version already exists
CREATE TABLE version (
    name VARCHAR(32) NOT NULL, 
    value INTEGER NOT NULL, 
    PRIMARY KEY (name)

(Background on this error at: http://sqlalche.me/e/14/e3q8)

This situation started to occur in March 2021 and as far as I know, it is identical on both Linux Mint 20 and Linux Mint 20.1.

Note: a more suitable location to put the virtualenv would have been /opt, but for multiple tests I opted for /home from a live USB with Linux Mint 20. Then apply the final changes to my Linux Mint 20.1

2 Answers 2



Downgrade SQLAlchemy to an earlier non-conflict version.

At the time of publishing the posts that explain the steps to install pgAdmin4 within virtualenv on Linux Mint 20, pip was implementing SQLAlchemy 1.3.23. Then, in these last days, the version used is SQLAlchemy 1.4.1

Downgrade can be done with pip install --upgrade. --upgrade can be used for both, downgrade or upgrade.

(venv) mint@mint:~/pgAdmin4$ pip install --upgrade SQLAlchemy==1.3.23

After this, when trying to run pdAdmin4, a new problem will be displayed:

Traceback (most recent call last):
  File "venv/lib/python3.8/site-packages/pgadmin4/pgAdmin4.py", line 94, in <module>
    app = create_app()
  File "/home/mint/pgAdmin4/venv/lib/python3.8/site-packages/pgadmin4/pgadmin/__init__.py", line 347, in create_app
    if not os.path.exists(SQLITE_PATH) or get_version() == -1:
  File "/home/mint/pgAdmin4/venv/lib/python3.8/site-packages/pgadmin4/pgadmin/setup/db_version.py", line 19, in get_version
    return version.value
AttributeError: 'NoneType' object has no attribute 'value'

This new issue is resolved by removing the ~/.pgadmin directory (created during installation) and then rerunning "python pgAdmin4.py"

  • Unfortunately, I can't shake the final error, there - I remove ~/.pgadmin but it says "python pgAdmin4.py" is unavailable, so I run "python ./pgadmin4env/bin/pgadmin4&" (as documented in the first listed guide) from within the virtual environment - which recreates ~/.pgadmin but then I still have the final error you've reported? Many thanks for any help you could give. Oct 9, 2021 at 16:31
  • Found and navigated to the exact folder containing pgAmin4.py and ran "python pgAdmin4.py", whilst in the virtual environment, from there - but the same error still appears :/ Oct 9, 2021 at 16:50
  • This problem is frequently presented by the update of dependencies. Therefore, I decided to use pgAdmin4 on Linux Mint 20.2 through Docker. Dec 10, 2021 at 1:56

I know its a bit late to answer, but in some case someone still looking for the solution. Here's what fixed mine.

I just follow the tutorial on

How to Install PostgreSQL with pgAdmin4 on Linux Mint 20 (first link)


Installing pgAdmin 4 on Linux Mint 20 (ulyana) (second link)

First of all update all our pip packages. Heres how to do it.

Then what i do is change the installation link to the latest version, so the other required packages will be updated too.

Or in simple explanation, in the 11th step(on the first link) or in the 6th step (on the second link) change the command to this one:

pip install https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v6.1/pip/pgadmin4-6.1-py3-none-any.whl

After that, do the next step in the tutorial.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.