Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flask 2.0 support #2426

Closed
swc2124 opened this issue May 12, 2021 · 8 comments · Fixed by #2439
Closed

Flask 2.0 support #2426

swc2124 opened this issue May 12, 2021 · 8 comments · Fixed by #2439

Comments

@swc2124
Copy link

swc2124 commented May 12, 2021

Im hitting this error after running pip install --no-binary ddtrace ddtrace

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/kbra_event_schema_api/api/__init__.py", line 2, in <module>
    from .webapp import app
  File "/usr/local/lib/python3.7/site-packages/kbra_event_schema_api/api/webapp.py", line 2, in <module>
    from flask import Flask, jsonify #, request
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
  File "/usr/local/lib/python3.7/site-packages/ddtrace/vendor/wrapt/importer.py", line 157, in load_module
    notify_module_loaded(module)
  File "/usr/local/lib/python3.7/site-packages/ddtrace/vendor/wrapt/decorators.py", line 445, in _synchronized
    return wrapped(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/ddtrace/vendor/wrapt/importer.py", line 135, in notify_module_loaded
    hook(module)
  File "/usr/local/lib/python3.7/site-packages/ddtrace/monkey.py", line 130, in on_import
    imported_module.patch()
  File "/usr/local/lib/python3.7/site-packages/ddtrace/contrib/flask/patch.py", line 76, in patch
    _w("flask", "Flask._register_error_handler", traced_register_error_handler)
  File "/usr/local/lib/python3.7/site-packages/ddtrace/vendor/wrapt/wrappers.py", line 831, in wrap_function_wrapper
    return wrap_object(module, name, FunctionWrapper, (wrapper,))
  File "/usr/local/lib/python3.7/site-packages/ddtrace/vendor/wrapt/wrappers.py", line 777, in wrap_object
    (parent, attribute, original) = resolve_path(module, name)
  File "/usr/local/lib/python3.7/site-packages/ddtrace/vendor/wrapt/wrappers.py", line 769, in resolve_path
    original = lookup_attribute(parent, attribute)
  File "/usr/local/lib/python3.7/site-packages/ddtrace/vendor/wrapt/wrappers.py", line 761, in lookup_attribute
    return getattr(parent, attribute)
AttributeError: type object 'Flask' has no attribute '_register_error_handler'
@swc2124
Copy link
Author

swc2124 commented May 12, 2021

if i dont do pip install --no-binary ddtrace ddtrace then I get this:

2021-05-12 01:18:32,087 WARNING [ddtrace.bootstrap.sitecustomize] [sitecustomize.py:156] [dd.service=event-schema dd.env=dev dd.version=0.1.10:12 dd.trace_id=0 dd.span_id=0] - error configuring Datadog tracing
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/ddtrace/bootstrap/sitecustomize.py", line 80, in <module>
    import ddtrace.profiling.auto  # noqa: F401
  File "/usr/local/lib/python3.7/site-packages/ddtrace/profiling/__init__.py", line 21, in <module>
    _not_compatible_abi()
  File "/usr/local/lib/python3.7/site-packages/ddtrace/profiling/__init__.py", line 10, in _not_compatible_abi
    "Python ABI is not compatible, you need to recompile this module.\n"
ImportError: Python ABI is not compatible, you need to recompile this module.
Reinstall it with the following command:
  pip install --no-binary ddtrace ddtrace

@jd
Copy link
Contributor

jd commented May 12, 2021

The ABI error message is due to your Python 3.7 being older than the one we used to provide wheels. If possible, I'd suggest upgrading your Python 3.7 version to the latest one.

You might still end up with the Flask issue though. What's your flask version?

@DonghanYang
Copy link

DonghanYang commented May 12, 2021

I can see the same error message type object 'Flask' has no attribute '_register_error_handler' with below requirements:

Flask==2.0.0
connexion==2.7.0
ddtrace==0.48.0

Downgrade Flask seems to resolve the issue. It seems that the Flask 2.0.0 is released today.

@smirnoffs
Copy link

I had the same problem when using connexion and ddtrace. Solved by pinning the version of Flask to flask<2.0.0.

@jd jd changed the title Flask AttributeError Flask 2.0 support May 12, 2021
@jd
Copy link
Contributor

jd commented May 12, 2021

It sounds like we don't support Flask 2.0 yet, as it has been released yesterday. We'll look into that!

@swc2124
Copy link
Author

swc2124 commented May 12, 2021

Thanks.

@Kyle-Verhoog Kyle-Verhoog linked a pull request May 14, 2021 that will close this issue
@mergify mergify bot closed this as completed in #2439 May 18, 2021
@stevepentland
Copy link

stevepentland commented May 25, 2021

It appears this is still breaking in a similar fashion with flask 2.0.1 and ddtrace 0.49.0 as #2439 did not make it into 0.49.0. Can someone please clarify if there is a target for getting this change out?

@Kyle-Verhoog
Copy link
Member

@stevepentland it did not make it into 0.49.0. It will definitely be in 0.50 but we will backport it to 0.49 as well!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants