superset icon indicating copy to clipboard operation
superset copied to clipboard

Superset Fresh Install or Upgrade results in TypeError

Open srinisubramanian opened this issue 2 years ago • 14 comments

I have tried both upgrading from Superset 1.5 and installing Superset 2.0 in a separate pyenv. Both result in the same issue : TypeError: init() got an unexpected keyword argument 'unbound_message'

How to reproduce the bug

  1. I followed the https://superset.apache.org/docs/installation/installing-superset-from-scratch guide to setup 1.5 a few months ago and followed the same to setup 2.0. I also tried upgrading using https://superset.apache.org/docs/installation/upgrading-superset
  2. Unable to run superset
  3. Stack trace
Traceback (most recent call last):
  File "/home/jenkinsci/.pyenv/versions/superset2/bin/superset", line 33, in <module>
    sys.exit(load_entry_point('apache-superset==2.0.0', 'console_scripts', 'superset')())
  File "/home/jenkinsci/.pyenv/versions/superset2/bin/superset", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/home/jenkinsci/.pyenv/versions/3.9.11/lib/python3.9/importlib/metadata.py", line 86, in load
    module = import_module(match.group('module'))
  File "/home/jenkinsci/.pyenv/versions/3.9.11/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/home/jenkinsci/.pyenv/versions/3.9.11/envs/superset2/lib/python3.9/site-packages/superset/__init__.py", line 18, in <module>
    from flask import current_app, Flask
  File "/home/jenkinsci/.pyenv/versions/3.9.11/envs/superset2/lib/python3.9/site-packages/flask/__init__.py", line 4, in <module>
    from . import json as json
  File "/home/jenkinsci/.pyenv/versions/3.9.11/envs/superset2/lib/python3.9/site-packages/flask/json/__init__.py", line 8, in <module>
    from ..globals import current_app
  File "/home/jenkinsci/.pyenv/versions/3.9.11/envs/superset2/lib/python3.9/site-packages/flask/globals.py", line 56, in <module>
    app_ctx: "AppContext" = LocalProxy(  # type: ignore[assignment]
TypeError: __init__() got an unexpected keyword argument 'unbound_message'

Expected results

Superset should run normally

Actual results

Exception as above.

Environment

(please complete the following information):

  • OS : CentOS Linux release 7.9.2009 (Core)
  • browser type and version: Chrome
  • superset version: 2.0
  • python version: Tried both 3.8.13 and 3.9.11
  • any feature flags active:
    • DASHBOARD_RBAC
    • VERSIONED_EXPORT
    • DASHBOARD_CROSS_FILTERS
    • ENABLE_TEMPLATE_PROCESSING

Checklist

Make sure to follow these steps before submitting your issue - thank you!

  • [x] I have checked the superset logs for python stacktraces and included it here as text if there are any.
  • [x] I have reproduced the issue with at least the latest released version of superset.
  • [x] I have checked the issue tracker for the same issue and I haven't found one similar.

Additional context

Add any other context about the problem here.

srinisubramanian avatar Aug 02 '22 08:08 srinisubramanian

We have started seeing the same issue in our docker builds this morning.

scruffs avatar Aug 02 '22 13:08 scruffs

Strange thing is I tried this on another similar system and it upgraded and ran without errors. However on 2 other identical systems I have this issue and its right now a blocker wherein on two landscapes we are on 2.0 and the main servers are still stuck on 1.5

@villebro @srinify Any guidance appreciated

srinisubramanian avatar Aug 02 '22 13:08 srinisubramanian

OK, this is strange. When I installed I just used "pip install apache-superset". The output of the superset --version command displays the following:

(superset2) [xxxxxxx ~]$ superset --version
Loaded your LOCAL configuration at [/home/xxxxxx/.superset/superset_config.py]
Python 3.9.11
Flask 2.2.0
Werkzeug 2.2.1

The requirements.txt points to Flask 2.0.3 and on a hunch I did a pip uninstall Flask and pip install flask==2.0.3. Also werkzeug==2.0.3 and jinja2==3.0.1

It now starts working. Wondering why pip install apache-superset installed newer versions of flask etc?

srinisubramanian avatar Aug 03 '22 03:08 srinisubramanian

Thanks @srinisubramanian installing lower versions of flask and jijna fixed this issue for me.

judithbachmann-ah avatar Aug 03 '22 08:08 judithbachmann-ah

Pinning just Flask to 2.1.3 solved this for us.

technicaltitch avatar Aug 03 '22 10:08 technicaltitch

Pinning just Flask to 2.1.3 solved this for us.

2.1.3 didn't work for me. Had to set it to 2.0.3. But yes the Flask version is the issue.

srinisubramanian avatar Aug 03 '22 10:08 srinisubramanian

Pinning just Flask to 2.1.3 solved this for us.

2.1.3 didn't work for me. Had to set it to 2.0.3. But yes the Flask version is the issue.

I would double-check that, as it seems to have been the 2.2.0 release that (removed deprecated code and hence) broke Superset for us at least.

technicaltitch avatar Aug 03 '22 17:08 technicaltitch

Flask==2.1.3 with Werkzeug==2.0.3 (which is compatible) works for me. Bumping Werkzeug to anything >2.0.3 leads to the same error message again.

Usiel avatar Aug 11 '22 10:08 Usiel

I'm also trying to Setup Fresh Superset. But I'm getting this error. Please help.

(superset) root@osvinuser-s:~# superset db upgrade Traceback (most recent call last): File "/root/.pyenv/versions/superset/bin/superset", line 33, in sys.exit(load_entry_point('apache-superset==1.5.1', 'console_scripts', 'superset')()) File "/root/.pyenv/versions/superset/bin/superset", line 25, in importlib_load_entry_point return next(matches).load() File "/root/.pyenv/versions/3.7.13/envs/superset/lib/python3.7/site-packages/importlib_metadata/init.py", line 203, in load module = import_module(match.group('module')) File "/root/.pyenv/versions/3.7.13/lib/python3.7/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1006, in _gcd_import File "", line 983, in _find_and_load File "", line 953, in _find_and_load_unlocked File "", line 219, in _call_with_frames_removed File "", line 1006, in _gcd_import File "", line 983, in _find_and_load File "", line 953, in _find_and_load_unlocked File "", line 219, in _call_with_frames_removed File "", line 1006, in _gcd_import File "", line 983, in _find_and_load File "", line 967, in _find_and_load_unlocked File "", line 677, in _load_unlocked File "", line 728, in exec_module File "", line 219, in _call_with_frames_removed File "/root/.pyenv/versions/3.7.13/envs/superset/lib/python3.7/site-packages/superset/init.py", line 18, in from flask import current_app, Flask File "/root/.pyenv/versions/3.7.13/envs/superset/lib/python3.7/site-packages/flask/init.py", line 14, in from jinja2 import escape File "/root/.pyenv/versions/3.7.13/envs/superset/lib/python3.7/site-packages/jinja2/init.py", line 12, in from .environment import Environment File "/root/.pyenv/versions/3.7.13/envs/superset/lib/python3.7/site-packages/jinja2/environment.py", line 25, in from .defaults import BLOCK_END_STRING File "/root/.pyenv/versions/3.7.13/envs/superset/lib/python3.7/site-packages/jinja2/defaults.py", line 3, in from .filters import FILTERS as DEFAULT_FILTERS # noqa: F401 File "/root/.pyenv/versions/3.7.13/envs/superset/lib/python3.7/site-packages/jinja2/filters.py", line 13, in from markupsafe import soft_unicode ImportError: cannot import name 'soft_unicode' from 'markupsafe' (/root/.pyenv/versions/3.7.13/envs/superset/lib/python3.7/site-packages/markupsafe/init.py)


Flask==2.1.3 Flask-AppBuilder==3.4.5 Flask-Babel==2.0.0 Flask-Caching==1.11.1 Flask-Compress==1.12 Flask-JWT-Extended==3.25.1 Flask-Login==0.4.1 Flask-Migrate==3.1.0 Flask-OpenID==1.3.0 Flask-SQLAlchemy==2.5.1 flask-talisman==1.0.0 Flask-WTF==0.14.3 Werkzeug==2.2.2 Jinja2==3.1.2

AkashKit avatar Aug 18 '22 12:08 AkashKit

Check your Werkzeug and jinja2 version wrt working version mentioned above

srinisubramanian avatar Aug 19 '22 01:08 srinisubramanian

@srinisubramanian I had same issue with this #20967 And also just follow your resolution, but after run superset db upgrade, I got new error :

image

Is there something I missed ?

Environment

  • superset version 2.0
  • python version 3.8.10

afifdevtest avatar Sep 18 '22 05:09 afifdevtest

Try install WTForms.

pip install WTForms==2.3.3

hsoekiswo avatar Sep 18 '22 05:09 hsoekiswo

@afifdevtest It took me some time to get all the required versions. So just follow these steps. You will be good to go.

Supersets require only perticular version of some python libraries.

First run this command >>pip list

Some main packages to remember (flask==2.0.3, werkzeug==2.0.3 and jinja2==3.0.1);

install them with this command (pip install flask==2.0.3, pip install werkzeug==2.0.3, pip install jinja2==3.0.1)

also install some additional packages with specific version. pip install Flask-WTF==0.14.3 pip install pyOpenSSL pip install pySocks==1.5.6 pip install markupsafe==2.0.1 pip install pillow pip install flask-caching==1.10.0

Now run >>superset db upgrade

AkashKit avatar Sep 18 '22 05:09 AkashKit

Try install WTForms.

pip install WTForms==2.3.3

Installing the WTForms worked, but i wonder why!!! cool!!

arbor03 avatar Sep 20 '22 16:09 arbor03

flask==2.0.3.,werkzeug==2.0.3, jinja2==3.0.1 and WTForms==2.3.3 worked for me.

Yaswanth-Perumalla avatar Sep 20 '22 18:09 Yaswanth-Perumalla

Since we're now on 3.1, on the verge of 4.0, we're not supporting 2.x or prior versions actively. If anyone is experiencing this issue in current versions, please file a new issue with updated context and repro steps. Thank you for understanding :)

rusackas avatar Feb 09 '24 19:02 rusackas