title: Running pgadmin throw an unexpected error
body: <p>I have installed postgresql and pgadmin in my ubuntu 20.04 machine.</p>
  <p>but I face this error when I running this command in the terminal: <code>python pgAdmin4.py</code></p>
  <pre><code>Traceback (most recent call last):
  File &quot;pgAdmin4.py&quot;, line 92, in &lt;module&gt;
  app = create_app()
  File &quot;/home/farhad/Public/pgadmin/pgadmin/lib/python3.8/site-packages/pgadmin4/pgadmin/__init__.py&quot;, line 350, in create_app
  db_upgrade(app)
  File &quot;/home/farhad/Public/pgadmin/pgadmin/lib/python3.8/site-packages/pgadmin4/pgadmin/setup/db_upgrade.py&quot;, line 25, in db_upgrade
  flask_migrate.upgrade(migration_folder)
  File &quot;/home/farhad/Public/pgadmin/pgadmin/lib/python3.8/site-packages/flask_migrate/__init__.py&quot;, line 95, in wrapped
  f(*args, **kwargs)
  File &quot;/home/farhad/Public/pgadmin/pgadmin/lib/python3.8/site-packages/flask_migrate/__init__.py&quot;, line 280, in upgrade
  command.upgrade(config, revision, sql=sql, tag=tag)
  File &quot;/home/farhad/Public/pgadmin/pgadmin/lib/python3.8/site-packages/alembic/command.py&quot;, 
  line 298, in upgrade
  script.run_env()
   File &quot;/home/farhad/Public/pgadmin/pgadmin/lib/python3.8/site-packages/alembic/script/base.py&quot;, 
  line 489, in run_env
  util.load_python_file(self.dir, &quot;env.py&quot;)
  File &quot;/home/farhad/Public/pgadmin/pgadmin/lib/python3.8/site-packages/alembic/util/pyfiles.py&quot;, line 98, in load_python_file
  module = load_module_py(module_id, path)
     File &quot;/home/farhad/Public/pgadmin/pgadmin/lib/python3.8/site-packages/alembic/util/compat.py&quot;, line 184, in load_module_py
  spec.loader.exec_module(module)
     File &quot;&lt;frozen importlib._bootstrap_external&gt;&quot;, line 783, in exec_module
     File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 219, in _call_with_frames_removed
     File &quot;/home/farhad/Public/pgadmin/pgadmin/lib/python3.8/site-packages/pgadmin4/pgadmin/setup/../../migrations/env.py&quot;, line 94, in &lt;module&gt;
        run_migrations_online()
     File &quot;/home/farhad/Public/pgadmin/pgadmin/lib/python3.8/site-packages/pgadmin4/pgadmin/setup/../../migrations/env.py&quot;, line 87, in run_migrations_online
       context.run_migrations()
      File &quot;&lt;string&gt;&quot;, line 8, in run_migrations
     File &quot;/home/farhad/Public/pgadmin/pgadmin/lib/python3.8/site-packages/alembic/runtime/environment.py&quot;, line 846, in run_migrations
  self.get_context().run_migrations(**kw)
     File &quot;/home/farhad/Public/pgadmin/pgadmin/lib/python3.8/site-packages/alembic/runtime/migration.py&quot;, line 520, in run_migrations
       step.migration_fn(**kw)
      File &quot;/home/farhad/Public/pgadmin/pgadmin/lib/python3.8/site-packages/pgadmin4/migrations/versions/3c1e4b6eda55_.py&quot;, line 20, in upgrade
       db.engine.execute(
      File &quot;/home/farhad/Public/pgadmin/pgadmin/lib/python3.8/site-packages/sqlalchemy/engine/base.py&quot;, line 2238, in execute
        return connection.execute(statement, *multiparams, **params)
      File &quot;/home/farhad/Public/pgadmin/pgadmin/lib/python3.8/site-packages/sqlalchemy/engine/base.py&quot;, line 1006, in execute
       return self._execute_text(object_, multiparams, params)
      File &quot;/home/farhad/Public/pgadmin/pgadmin/lib/python3.8/site-packages/sqlalchemy/engine/base.py&quot;, line 1175, in _execute_text
      ret = self._execute_context(
      File &quot;/home/farhad/Public/pgadmin/pgadmin/lib/python3.8/site-packages/sqlalchemy/engine/base.py&quot;, line 1317, in _execute_context
       self._handle_dbapi_exception(
       File &quot;/home/farhad/Public/pgadmin/pgadmin/lib/python3.8/site-packages/sqlalchemy/engine/base.py&quot;, line 1511, in _handle_dbapi_exception
        util.raise_(
        File &quot;/home/farhad/Public/pgadmin/pgadmin/lib/python3.8/site-packages/sqlalchemy/util/compat.py&quot;, line 178, in raise_
        raise exception
        File &quot;/home/farhad/Public/pgadmin/pgadmin/lib/python3.8/site-packages/sqlalchemy/engine/base.py&quot;, line 1277, in _execute_context
        self.dialect.do_execute(
       File &quot;/home/farhad/Public/pgadmin/pgadmin/lib/python3.8/site-packages/sqlalchemy/engine/default.py&quot;, line 593, in do_execute
       cursor.execute(statement, parameters)
    sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) duplicate column name: hostaddr
     [SQL: ALTER TABLE server ADD COLUMN hostaddr TEXT(1024)]
     (Background on this error at: http://sqlalche.me/e/13/e3q8)
  </code></pre>
  <p>before that I have installed it frequently, without any problem.</p>
  <p>I have installed postgresql with this command:</p>
  <p><code>sudo apt install postgresql postgresql-contrib</code></p>
  <p>Then I installed pgadmin based on below steps:</p>
  <ol>
  <li><p>running command <code>sudo apt install build-essential libssl-dev libffi-dev libgmp3-dev virtualenv python3-pip libpq-dev python-dev</code></p>
  </li>
  <li><p>create a directory named <code>pgadmin</code> in somewhere in my system.</p>
  </li>
  <li><p>using <code>virtualenv</code> to create an isolated environment and running command <code>virtualenv pgadmin</code>.</p>
  </li>
  <li><p><code>cd pgadmin</code>.</p>
  </li>
  <li><p><code>source bin/activate</code></p>
  </li>
  <li><p>run command <code>wget https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v4.23/pip/pgadmin4-4.23-py3-none-any.whl</code>.</p>
  </li>
  <li><p>Installing it using python pip: <code>pip install  pgadmin4-4.23-py3-none-any.whl</code></p>
  </li>
  <li><p>creating a file named <code>config_local.py</code> in this path:</p>
  </li>
  </ol>
  <p><code>/pgadmin/pgadmin/lib/python3.8/site-packages/pgadmin4</code></p>
  <p>and put this content to it:</p>
  <pre><code>import os
  DATA_DIR = os.path.realpath(os.path.expanduser(u'~/.pgAdmin/'))
  LOG_FILE = os.path.join(DATA_DIR, 'pgAdmin4.log')
  SQLITE_PATH = os.path.join(DATA_DIR, 'pgAdmin4.db')
  SESSION_DB_PATH = os.path.join(DATA_DIR, 'sessions')
  STORAGE_DIR = os.path.join(DATA_DIR, 'storage')
  SERVER_MODE = False
  </code></pre>
  <ol start="9">
  <li>And finally when I run pgadmin by command <code>python /pgadmin/pgadmin/lib/python3.8/site-packages/pgadmin4/pgadmin4.py</code> face to that error.</li>
  </ol>