Search code examples
pgadminwerkzeug

"ImportError: cannot import name 'ImmutableDict'" error when installing pgAdmin4


I am trying to install pgAdmin4 on Ubuntu 18.04 with python3 following this tutorial (https://www.digitalocean.com/community/tutorials/how-to-install-configure-pgadmin4-server-mode) but when configuring pgAdmin4 I get this error:

(my_env) 1 jess@hilarioserver:~/environments$ python my_env/lib/python3.6/site-packages/pgadmin4/setup.py
Traceback (most recent call last):
  File "my_env/lib/python3.6/site-packages/pgadmin4/setup.py", line 17, in <module>
    from pgadmin.model import db, User, Version, ServerGroup, Server, \
  File "/home/cta/environments/my_env/lib/python3.6/site-packages/pgadmin4/pgadmin/__init__.py", line 21, in <module>
    from flask_babelex import Babel, gettext
  File "/home/cta/environments/my_env/lib/python3.6/site-packages/flask_babelex/__init__.py", line 23, in <module>
    from werkzeug import ImmutableDict
ImportError: cannot import name 'ImmutableDict'

I already tried to install werkzeug but still giving the same error.

alembic (1.4.0) Babel (2.8.0) bcrypt (3.1.7) blinker (1.4) cffi (1.13.2) Click (7.0) cryptography (2.8) Flask (1.0.2) Flask-BabelEx (0.9.3) Flask-Compress (1.4.0) Flask-Gravatar (0.5.0) Flask-Login (0.4.1) Flask-Mail (0.9.1) Flask-Migrate (2.4.0) Flask-Paranoid (0.2.0) Flask-Principal (0.4.0) Flask-Security (3.0.0) Flask-SQLAlchemy (2.3.2) Flask-WTF (0.14.2) itsdangerous (1.1.0) Jinja2 (2.11.1) Mako (1.1.1) MarkupSafe (1.1.1) paramiko (2.7.1) passlib (1.7.1) pgadmin4 (4.18) pip (9.0.1) pkg-resources (0.0.0) psutil (5.5.1) psycopg2-binary (2.8.4) pycparser (2.19) PyNaCl (1.3.0) python-dateutil (2.8.1) python-editor (1.0.4) pytz (2018.9) setuptools (39.0.1) simplejson (3.16.0) six (1.14.0) speaklater (1.3) SQLAlchemy (1.3.13) sqlparse (0.2.4) sshtunnel (0.1.5) Werkzeug (1.0.0) wheel (0.34.2) WTForms (2.2.1)

Any idea?


Solution

  • I've been troubleshooting this today while installing another package as well and it seems there was a new version released today that might be causing the issue.

    https://pypi.org/project/Werkzeug/#history

    I decided to go back to an earlier version (0.16.1) and it solved my issue. To downgrade:

    pip install --upgrade werkzeug==0.16.1

    Hope this works for you as well.