Re: pgadmin4 suddenly not working - ImportError: cannot import name 'view_commit' - Mailing list pgadmin-support

From Aditya Toshniwal
Subject Re: pgadmin4 suddenly not working - ImportError: cannot import name 'view_commit'
Date
Msg-id CAM9w-_mQWb+Zrh-+Met6pD44wY3vQAo5MtBJm9gF4WwqnY5C_Q@mail.gmail.com
Whole thread Raw
In response to pgadmin4 suddenly not working - ImportError: cannot import name 'view_commit'  (Ni Ne <nineoften@hotmail.com>)
List pgadmin-support
Hi Ni Ne,

The old package - Flask-Security is still there in your virtual env. I think that's the reason 5.3 was not working for you.
Run - pip uninstall Flask-Security and try starting pgAdmin.

On Thu, Jul 15, 2021 at 12:01 AM Ni Ne <nineoften@hotmail.com> wrote:
Hi Aditya,

It was working on 5.3 then stopped. Then I upgraded to 5.4 to try to resolve the issues.

Here is the output from 'pip freeze' :

# python3 -m pip freeze
alabaster==0.7.12
alembic==1.6.5
appdirs==1.4.4
astor==0.8.1
attrs==21.2.0
autoflake==1.4
Babel==2.9.1
bandit==1.7.0
bcrypt==3.2.0
bidict==0.21.2
black==20.8b1
blinker==1.4
Brotli==1.0.9
certifi==2021.5.30
cffi==1.14.5
chardet==4.0.0
cheroot==8.5.2
click==7.1.2
coverage==5.5
cryptography==3.4.7
darglint==1.8.0
dataclasses==0.8
distlib==0.3.2
dnspython==1.16.0
doc8==0.8.1
docutils==0.17.1
email-validator==1.1.3
eradicate==1.0
eventlet==0.31.0
filelock==3.0.12
flake8==3.9.2
flake8-2020==1.6.0
flake8-bandit==2.1.2
flake8-broken-line==0.2.1
flake8-bugbear==19.8.0
flake8-builtins==1.5.3
flake8-commas==2.0.0
flake8-comprehensions==3.5.0
flake8-debugger==3.2.1
flake8-docstrings==1.6.0
flake8-eradicate==0.4.0
flake8-fixme==1.1.1
flake8-isort==3.0.1
flake8-logging-format==0.6.0
flake8-mutable==1.2.0
flake8-polyfill==1.0.2
flake8-quotes==2.1.2
flake8-rst-docstrings==0.0.12
flake8-string-format==0.2.3
flake8-variables-names==0.0.3
Flask==1.1.2
Flask-BabelEx==0.9.4
Flask-Compress==1.10.1
Flask-Gravatar==0.5.0
Flask-Login==0.5.0
Flask-Mail==0.9.1
Flask-Migrate==2.7.0
Flask-Paranoid==0.2.0
Flask-Principal==0.4.0
Flask-Security==3.0.0
Flask-Security-Too==4.0.1
Flask-SocketIO==5.1.0
Flask-SQLAlchemy==2.5.1
Flask-WTF==0.15.1
gitdb==4.0.7
GitPython==3.1.17
greenlet==1.1.0
httpagentparser==1.9.1
idna==2.10
imagesize==1.2.0
importlib-metadata==4.5.0
importlib-resources==5.1.4
iniconfig==1.1.1
isort==4.3.21
itsdangerous==1.1.0
jaraco.functools==3.3.0
Jinja2==2.11.3
ldap2pg==5.5
ldap3==2.9
Mako==1.1.4
MarkupSafe==2.0.1
mccabe==0.6.1
mod-wsgi==4.7.1
more-itertools==8.8.0
mypy-extensions==0.4.3
packaging==20.9
paramiko==2.7.2
passlib==1.7.4
pathspec==0.8.1
pbr==5.6.0
pep8-naming==0.9.1
pgadmin4==5.4
pluggy==0.13.1
psutil==5.8.0
psycopg2==2.7.7
psycopg2-binary==2.8.6
py==1.10.0
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycodestyle==2.7.0
pycparser==2.20
pydocstyle==5.1.1
pyflakes==2.3.1
Pygments==2.9.0
PyNaCl==1.4.0
pyparsing==2.4.7
pytest==6.2.4
pytest-cov==2.12.1
python-dateutil==2.8.1
python-dev-tools==2020.9.10
python-editor==1.0.4
python-engineio==4.2.0
python-ldap==3.3.1
python-socketio==5.3.0
pytz==2021.1
pyupgrade==2.19.4
PyYAML==5.4.1
regex==2021.4.4
requests==2.25.1
restructuredtext-lint==1.3.2
simplejson==3.17.2
six==1.16.0
smmap==4.0.0
snowballstemmer==2.1.0
speaklater==1.3
speaklater3==1.4
Sphinx==2.4.4
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
SQLAlchemy==1.3.24
sqlparse==0.4.1
sshtunnel==0.4.0
stevedore==3.3.0
testfixtures==6.17.1
tokenize-rt==4.1.0
toml==0.10.2
tox==3.23.1
tox-travis==0.12
typed-ast==1.4.3
typing-extensions==3.10.0.0
ua-parser==0.10.0
urllib3==1.26.5
user-agents==2.2.0
virtualenv==20.4.7
wemake-python-styleguide==0.14.1
Werkzeug==2.0.1
WTForms==2.3.3
zipp==3.4.1


From: Aditya Toshniwal <aditya.toshniwal@enterprisedb.com>
Sent: Tuesday, July 13, 2021 11:21 PM
To: Ni Ne <nineoften@hotmail.com>
Cc: pgAdmin Support <pgadmin-support@postgresql.org>
Subject: Re: pgadmin4 suddenly not working - ImportError: cannot import name 'view_commit'
 
Hi,

On Mon, Jul 12, 2021 at 10:25 PM Ni Ne <nineoften@hotmail.com> wrote:
Hi and thank you for the response. Unfortunately I do not have a requirements.txt file at that location. I do have this one however:

/usr/local/lib/python3.6/site-packages/pgadmin4/regression/requirements.txt

But trying to install against that returns this error:

python3 -m pip install -r /usr/local/lib/python3.6/site-packages/pgadmin4/regression/requirements.txt
ERROR: Could not open requirements file: [Errno 2] No such file or directory: '/usr/local/lib/python3.6/site-packages/pgadmin4/regression/../../requirements.txt'

I am also at the latest published verion of Flask-Security-Too for my platform - 4.0.1.
OK. Can you share "pip freeze" on your python virtual env ? From which version did you upgrade to latest version ? 

Please let me know if there are other things I can try. Thank you!


From: Aditya Toshniwal <aditya.toshniwal@enterprisedb.com>
Sent: Sunday, July 11, 2021 10:25 PM
To: Ni Ne <nineoften@hotmail.com>
Cc: pgadmin-support@lists.postgresql.org <pgadmin-support@lists.postgresql.org>
Subject: Re: pgadmin4 suddenly not working - ImportError: cannot import name 'view_commit'
 
Hi Ni Ne,

The package - Flask-Security-Too is updated in the recent release. Can you run pip install -r /usr/pgadmin4/web/requirements.txt for your python env ?

On Sat, Jul 10, 2021 at 1:20 AM Ni Ne <nineoften@hotmail.com> wrote:
pgadmin4 was previously working, logged in this morning and now it's not. Am guessing an automatic yum update went through.

I am running CentOS 7, pgadmin4 5.4, Flask 1.1.2


This is the error I am getting in the apache error_log file:

mod_wsgi (pid=14087): Failed to exec Python script file '/usr/pgadmin4/web/pgAdmin4.wsgi'.
mod_wsgi (pid=14087): Exception occurred processing WSGI script '/usr/pgadmin4/web/pgAdmin4.wsgi'.
Traceback (most recent call last):
  File "/usr/pgadmin4/web/pgAdmin4.wsgi", line 36, in <module>
    from pgAdmin4 import app as application
  File "/usr/pgadmin4/web/pgAdmin4.py", line 98, in <module>
    app = create_app()
  File "/usr/pgadmin4/web/pgadmin/__init__.py", line 689, in create_app
    for module in app.find_submodules('pgadmin'):
  File "/usr/pgadmin4/web/pgadmin/__init__.py", line 87, in find_submodules
    module = import_module(module_name)
  File "/usr/lib64/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/usr/pgadmin4/web/pgadmin/browser/__init__.py", line 35, in <module>
    from flask_security.views import _security, view_commit, _ctx
ImportError: cannot import name 'view_commit'

Does anyone have any ideas on how to resolve? Thanks!



--
Thanks,
Aditya Toshniwal
pgAdmin hacker | Sr. Software Engineer | edbpostgres.com
"Don't Complain about Heat, Plant a TREE"


--
Thanks,
Aditya Toshniwal
pgAdmin hacker | Sr. Software Engineer | edbpostgres.com
"Don't Complain about Heat, Plant a TREE"


--
Thanks,
Aditya Toshniwal
pgAdmin hacker | Sr. Software Engineer | edbpostgres.com
"Don't Complain about Heat, Plant a TREE"

pgadmin-support by date:

Previous
From: Dave Page
Date:
Subject: Re: Banned from forum
Next
From: Akshay Joshi
Date:
Subject: pgAdmin 4 v5.5 Released