DataDog / dd-trace-py

Datadog Python APM Client
https://ddtrace.readthedocs.io/
Other
553 stars 416 forks source link

failed to import ddtrace module 'ddtrace.contrib.langchain' when patching on import #8063

Closed bmoe872 closed 10 months ago

bmoe872 commented 10 months ago

Summary of problem

We started getting an error with DDTrace described in the title. We used to have langchain pinned because this was an issue before as well. Since then though we don't have it pinned any longer.

Which version of dd-trace-py are you using?

ddtrace==2.4.0

Which version of pip are you using?

pip 23.2.1 from python 3.11

Which libraries and their versions are you using?

`pip freeze` aiohttp==3.9.1 aiosignal==1.3.1 airtable-python-wrapper==0.13.0 alembic==1.13.1 analytics-python==1.4.post1 annotated-types==0.6.0 anyascii==0.3.2 anyio==4.2.0 Appium-Python-Client==3.1.1 asgiref==3.7.2 asn1crypto==1.5.1 attrs==23.2.0 auth0-python==4.7.0 backoff==1.10.0 bcrypt==4.1.2 beautifulsoup4==4.11.2 bingads==13.0.18 boto3==1.34.15 botocore==1.34.15 bpmappers==1.3 bytecode==0.15.1 CacheControl==0.13.1 cachetools==5.3.2 cattrs==23.2.3 certifi==2023.11.17 cffi==1.16.0 charset-normalizer==3.3.2 click==8.1.7 cookies==2.2.1 coverage==7.4.0 cryptography==41.0.7 cssselect==1.2.0 curlify==2.2.1 dataclasses-json==0.6.3 datadog==0.47.0 ddsketch==2.0.4 ddtrace==2.4.0 decorator==5.1.1 defusedxml==0.7.1 Deprecated==1.2.14 Django==4.2.7 django-appconf==1.0.6 django-compressor==4.4 django-csp==3.7 django-deprecate-fields==0.1.1 django-environ==0.10.0 django-extensions==3.2.3 django-filter==23.5 django-health-check==3.17.0 django-ipware==6.0.3 django-libsass==0.9 django-model-utils==4.3.1 django-modelcluster==6.2.1 django-multiselectfield==0.1.12 django-permissionedforms==0.1 django-redis==5.4.0 django-redis-sessions==0.6.2 django-rq==2.10.1 django-s3-storage==0.15.0 django-social-share==2.3.0 django-taggit==4.0.0 django-treebeard==4.7 django-webpack-loader==3.0.0 django-with-asserts==0.0.1 djangorestframework==3.14.0 draftjs-exporter==2.1.7 ecdsa==0.18.0 envier==0.5.0 et-xmlfile==1.1.0 facebook-business==18.0.5 faust-cchardet==2.1.19 filelock==3.13.1 filetype==1.2.0 fool-access==0.5.1 fool-accounts==8.5.3 fool-api-kit==4.1.0 fool-auth==10.2.1 fool-email-address-api-client==6.6.0 fool-error-pages==2.0.1 fool-hydra-client==6.4.0 fool-infotrack==7.6.4 fool-openapi-client==0.6.0 fool-operations==0.11.1 fool-user-api-client==6.6.0 frozenlist==1.4.1 furl==2.1.3 google-ads==22.1.0 google-api-core==2.15.0 google-api-python-client==2.113.0 google-auth==2.26.1 google-auth-httplib2==0.2.0 google-auth-oauthlib==1.2.0 googleapis-common-protos==1.62.0 greenlet==3.0.3 grpcio==1.60.0 grpcio-status==1.60.0 gunicorn==21.2.0 h11==0.14.0 hiredis==2.3.2 html5lib==1.1 httpcore==0.16.3 httplib2==0.22.0 httpx==0.23.3 idna==3.6 importlib-metadata==6.11.0 inflect==7.0.0 informant-api==2.9.0 jmespath==1.0.1 josepy==1.14.0 jsonpatch==1.33 jsonpointer==2.4 l18n==2021.3 langchain==0.1.0 langchain-community==0.0.11 langchain-core==0.1.9 langsmith==0.0.79 libsass==0.23.0 lxml==5.1.0 Mako==1.3.0 MarkupSafe==2.1.3 marshmallow==3.20.2 mock==5.1.0 monotonic==1.6 msgpack==1.0.7 multidict==6.0.4 mypy-extensions==1.0.0 ndg-httpsclient==0.5.1 numpy==1.26.3 oauthlib==3.2.2 openpyxl==3.1.2 opentelemetry-api==1.22.0 opsgenie-sdk==2.1.5 orderedmultidict==1.0.1 outcome==1.3.0.post0 packaging==23.2 paramiko==3.4.0 pillow==10.2.0 pillow-heif==0.14.0 platformdirs==3.11.0 proto-plus==1.23.0 protobuf==4.25.1 psycopg2-binary==2.9.9 py==1.11.0 pyasn1==0.5.1 pyasn1-modules==0.3.0 pycountry==23.12.11 pycparser==2.21 pydantic==2.5.3 pydantic_core==2.14.6 Pygments==2.17.2 PyJWT==2.8.0 PyNaCl==1.5.0 pyOpenSSL==23.3.0 pyparsing==3.1.1 PySocks==1.7.1 python-amazon-paapi==5.0.1 python-dateutil==2.8.2 python-docx==1.1.0 python-ipware==2.0.1 python-jose==3.3.0 python-json-logger==2.0.7 pytz==2023.3.post1 PyYAML==6.0.1 rcssmin==1.1.1 redis==5.0.1 regex==2023.12.25 requests==2.31.0 requests-oauthlib==1.3.1 responses==0.24.1 retry==0.9.2 rfc3986==1.5.0 rjsmin==1.2.1 rq==1.15.1 rsa==4.9 s3transfer==0.10.0 sanic-ipware==0.1.0 selenium==4.16.0 sentry-sdk==1.39.1 six==1.16.0 slack-bolt==1.18.1 slack_sdk==3.26.2 sniffio==1.3.0 snowflake-connector-python==3.6.0 sortedcontainers==2.4.0 soupsieve==2.5 SQLAlchemy==2.0.25 sqlparse==0.4.4 suds-community==1.1.2 tblib==3.0.0 telepath==0.3.1 tenacity==8.2.3 tiktoken==0.5.2 tomlkit==0.12.3 trio==0.24.0 trio-websocket==0.11.1 typing-inspect==0.9.0 typing_extensions==4.9.0 ua-parser==0.18.0 unicodecsv==0.14.1 uritemplate==4.1.1 urllib3==2.0.7 user-agents==2.2.0 wagtail==5.2 wagtail-ai==1.1.1 wagtail-airtable @ git+https://github.com/wagtail-nest/wagtail-airtable.git@92b960d6b1d84bea33429741236cd92a27f6ef63 wagtail-content-import==0.11.0 wagtail-draftail-anchors==0.6.0 wagtail-modeladmin==1.0.0 wagtail-shortcode==1.0.3 wagtail-transfer==0.9.3 webencodings==0.5.1 Willow==1.6.3 wrapt==1.16.0 wsproto==1.2.0 xmltodict==0.13.0 yarl==1.9.4 zipp==3.17.0

How can we reproduce your problem?

I wish I could figure out what's actually causing this, but I'm having trouble figuring out where this is even being triggered from.

emmettbutler commented 10 months ago

Thanks for the report. It sounds likely that this was the issue fixed in https://github.com/DataDog/dd-trace-py/pull/7996, released in 2.4.1. Depending on 2.4.1 will probably fix your issue. Please comment if that's not the case.