I already found the solution, I just want to share it in case someone has the same problem.
Situation
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
And,
Installing pgAdmin 4 on Linux Mint 20 (ulyana)
And in Spanish,
Cómo instalar PostgreSQL con pgAdmin4 en Linux Mint 20
Error
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
self.dialect.do_execute(
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
[SQL:
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