Closed econno11y closed 9 months ago
This is likely an instance of https://github.com/python/importlib_metadata/issues/455
Thanks for the report, I will add a workaround until https://github.com/python/importlib_metadata/issues/455 is fixed, will be backported to 2.4 soon.
@econno11y one question, is that traceback from the logs? Because the if ilmd_d is not None
line is under a generic exception handler so it should be captured and printed but not break the application.
Hi @juanjux I'm not sure what ilmd_d
is. The exception is getting thrown in
If I add a conditional:
try:
if "__callonce_result__" in f.__dict__:
retval, exc = f.__callonce_result__
The new traceback is:
Exception in thread ddtrace.internal.telemetry.writer:TelemetryWriter:
Traceback (most recent call last):
File "/opt/homebrew/bin/Cellar/pyenv/2.3.33/versions/3.9.7/lib/python3.9/threading.py", line 973, in _bootstrap_inner
self.run()
File "/Users/econnolly/source/repos/rivt/personalization/.venv/lib/python3.9/site-packages/ddtrace/internal/periodic.py", line 56, in run
self._target()
File "/Users/econnolly/source/repos/rivt/personalization/.venv/lib/python3.9/site-packages/ddtrace/internal/telemetry/writer.py", line 631, in periodic
self._update_dependencies_event(newly_imported_deps)
File "/Users/econnolly/source/repos/rivt/personalization/.venv/lib/python3.9/site-packages/ddtrace/internal/telemetry/writer.py", line 466, in _update_dependencies_event
packages = update_imported_dependencies(self._imported_dependencies, newly_imported_deps)
File "/Users/econnolly/source/repos/rivt/personalization/.venv/lib/python3.9/site-packages/ddtrace/internal/telemetry/data.py", line 84, in update_imported_dependencies
package = filename_to_package(module_path)
File "/Users/econnolly/source/repos/rivt/personalization/.venv/lib/python3.9/site-packages/ddtrace/internal/packages.py", line 126, in filename_to_package
mapping = _package_file_mapping()
File "/Users/econnolly/source/repos/rivt/personalization/.venv/lib/python3.9/site-packages/ddtrace/internal/utils/cache.py", line 130, in _
if exc is not None:
UnboundLocalError: local variable 'exc' referenced before assignment
Exception in thread ddtrace.internal.telemetry.writer:TelemetryWriter:
Traceback (most recent call last):
File "/opt/homebrew/bin/Cellar/pyenv/2.3.33/versions/3.9.7/lib/python3.9/threading.py", line 973, in _bootstrap_inner
self.run()
File "/Users/econnolly/source/repos/rivt/personalization/.venv/lib/python3.9/site-packages/ddtrace/internal/periodic.py", line 55, in run
while not self.quit.wait(self.interval):
File "/Users/econnolly/source/repos/rivt/personalization/.venv/lib/python3.9/site-packages/ddtrace/internal/telemetry/writer.py", line 631, in periodic
self._update_dependencies_event(newly_imported_deps)
File "/Users/econnolly/source/repos/rivt/personalization/.venv/lib/python3.9/site-packages/ddtrace/internal/telemetry/writer.py", line 466, in _update_dependencies_event
packages = update_imported_dependencies(self._imported_dependencies, newly_imported_deps)
File "/Users/econnolly/source/repos/rivt/personalization/.venv/lib/python3.9/site-packages/ddtrace/internal/telemetry/data.py", line 84, in update_imported_dependencies
package = filename_to_package(module_path)
File "/Users/econnolly/source/repos/rivt/personalization/.venv/lib/python3.9/site-packages/ddtrace/internal/packages.py", line 126, in filename_to_package
mapping = _package_file_mapping()
File "/Users/econnolly/source/repos/rivt/personalization/.venv/lib/python3.9/site-packages/ddtrace/internal/utils/cache.py", line 130, in _
if exc is not None:
UnboundLocalError: local variable 'exc' referenced before assignment
That doesn't kill the app either, but it does hang. Maybe that gives you a sense of what the calling code is.
@econno11y could you test if pinning importlib_metadata
(not importlib
) to 6.5.0 fixes the issue for you?
I'm having trouble pinning the version to 6.5.0. I made this change in the requirements file:
ddtrace==2.4.0
# attrs==23.2.0
# bytecode==0.15.1
# typing_extensions==4.9.0
# cattrs==23.2.3
# attrs==23.2.0
# exceptiongroup==1.2.0
# typing_extensions==4.9.0
# ddsketch==2.0.4
# protobuf==3.19.6
# six==1.16.0
# envier==0.5.0
# opentelemetry-api==1.22.0
# Deprecated==1.2.14
# wrapt==1.16.0
# importlib-metadata==6.5.0
# zipp==3.17.0
# protobuf==3.19.6
...
but here is the resulting dependency tree:
opentelemetry-api==1.22.0
├── Deprecated [required: >=1.2.6, installed: 1.2.14]
│ └── wrapt [required: >=1.10,<2, installed: 1.16.0]
└── importlib-metadata [required: >=6.0,<7.0, installed: 6.11.0]
└── zipp [required: >=0.5, installed: 3.17.0]
If I go and uninstall ddtrace, opentelemetry-api, and importlib-metada and then reinstall importlib-metadata==6.5.0, then opentelemetry-api==1.22.0, then ddtrace==2.4.0, then run the server, I get:
Traceback (most recent call last):
File "/opt/homebrew/bin/Cellar/pyenv/2.3.33/versions/3.9.7/bin/manage", line 33, in <module>
sys.exit(load_entry_point('discovery', 'console_scripts', 'manage')())
File "/Users/econnolly/source/repos/rivt/personalization/src/discovery/manage.py", line 17, in main
debug = settings.DEBUG
File "/opt/homebrew/bin/Cellar/pyenv/2.3.33/versions/3.9.7/lib/python3.9/site-packages/django/conf/__init__.py", line 102, in __getattr__
self._setup(name)
File "/opt/homebrew/bin/Cellar/pyenv/2.3.33/versions/3.9.7/lib/python3.9/site-packages/django/conf/__init__.py", line 89, in _setup
self._wrapped = Settings(settings_module)
File "/opt/homebrew/bin/Cellar/pyenv/2.3.33/versions/3.9.7/lib/python3.9/site-packages/django/conf/__init__.py", line 217, in __init__
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/opt/homebrew/bin/Cellar/pyenv/2.3.33/versions/3.9.7/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 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 "/Users/econnolly/source/repos/rivt/personalization/src/discovery/local_settings.py", line 3, in <module>
from .settings import * # noqa: F401, F403
File "/Users/econnolly/source/repos/rivt/personalization/src/discovery/settings.py", line 15, in <module>
from ddtrace import config
ModuleNotFoundError: No module named 'ddtrace'
print(sys.path) ['', '/opt/homebrew/bin/Cellar/pyenv/2.3.33/versions/3.9.7/lib/python39.zip', '/opt/homebrew/bin/Cellar/pyenv/2.3.33/versions/3.9.7/lib/python3.9', '/opt/homebrew/bin/Cellar/pyenv/2.3.33/versions/3.9.7/lib/python3.9/lib-dynload', '/Users/econnolly/source/repos/rivt/personalization/.venv/lib/python3.9/site-packages', '/Users/econnolly/source/repos/rivt/personalization/src']
pip show ddtrace | grep "Location"
Location: /Users/econnolly/source/repos/rivt/personalization/.venv/lib/python3.9/site-packages
localsettings.py
import logging # noqa: F401
from .settings import * # noqa: F401, F403
DEBUG = True
@econno11y can you please post your updated pip freeze
following the importlib_metadata
change?
@majorgreys when I manually uninstall ddtrace
, opentelemetry-api
, and importlib_metadata
and then reinstall, pinning importlib_metadata
to 6.5.0
, here is my pip freeze:
Django==4.2.5
django-allow-cidr==0.7.1
django-axes==5.41.1
django-celery-beat==2.5.0
django-cors-headers==4.3.1
django-extensions==3.2.3
django-ipware==6.0.3
django-postgres-extra==2.0.2
django-prettyjson==0.4.1
django-redis==5.4.0
django-storages==1.14.2
django-timezone-field==6.1.0
djangorestframework==3.14.0
dnspython==2.4.2
drf-extra-fields==3.7.0
editdistance==0.6.0
enforce==0.3.4
envier==0.5.0
exceptiongroup==1.2.0
executing==2.0.1
expiringdict==1.2.2
factory-boy==3.3.0
Faker==22.2.0
filelock==3.13.1
filetype==1.2.0
flake8==7.0.0
flake8-for-pycharm==0.4.1
freezegun==1.4.0
frozenlist==1.4.1
future==0.18.3
geographiclib==2.0
geopy==2.4.1
googleapis-common-protos==1.62.0
googlemaps==4.10.0
graphql-core==3.2.3
grpc-gateway-protoc-gen-openapiv2==0.1.0
grpcio==1.54.2
gunicorn==21.2.0
h11==0.14.0
hyperlink==21.0.0
identify==2.5.33
idna==3.6
importlib-metadata==6.5.0
incremental==22.10.0
iniconfig==2.0.0
ipython==8.18.1
isort==5.13.2
jedi==0.19.1
jmespath==1.0.1
joblib==1.3.2
kafka-python==2.0.2
keyring==21.8.0
kombu==5.3.4
langchain==0.0.270
langsmith==0.0.80
launchdarkly-server-sdk==8.2.1
loguru==0.7.2
lxml==5.1.0
marshmallow==3.20.2
matplotlib-inline==0.1.6
mccabe==0.7.0
mock==5.1.0
more-itertools==8.13.0
multidict==6.0.4
mypy-extensions==1.0.0
nodeenv==1.8.0
numexpr==2.8.8
numpy==1.22.4
openai==0.27.7
opentelemetry-api==1.22.0
oscrypto==1.3.0
packaging==23.2
pandas==1.3.3
parso==0.8.3
pexpect==4.9.0
pinecone-client==2.2.4
pipdeptree==2.13.1
platformdirs==4.1.0
pluggy==1.3.0
pre-commit==3.6.0
probableparsing==0.0.1
progressbar2==4.3.2
prompt-toolkit==3.0.43
protobuf==3.19.6
psycopg2-binary==2.9.1
ptyprocess==0.7.0
pure-eval==0.2.2
pyasn1==0.5.1
pyasn1-modules==0.3.0
pycodestyle==2.11.1
pycparser==2.21
pycryptodomex==3.20.0
pydantic==2.5.3
pydantic_core==2.14.6
pyflakes==3.2.0
Pygments==2.17.2
PyJWT==2.8.0
pylint==3.0.3
pyOpenSSL==22.0.0
pyRFC3339==1.1
pysimdjson==5.0.2
pytest==7.4.4
python-crfsuite==0.9.10
python-crontab==3.0.0
python-dateutil==2.8.0
python-dotenv==1.0.0
python-ipware==2.0.1
python-slugify==8.0.1
python-utils==3.8.1
pytz==2023.3.post1
PyYAML==6.0.1
redis==4.1.0
regex==2023.12.25
requests==2.31.0
responses==0.24.1
s3transfer==0.6.2
scikit-learn==1.3.0
scipy==1.11.4
semver==3.0.2
sentry-sdk==1.11.1
service-identity==23.1.0
setproctitle==1.3.3
six==1.16.0
slackclient==2.9.4
sniffio==1.3.0
snowflake-connector-python==2.7.8
soupsieve==2.5
SQLAlchemy==2.0.25
sqlparse==0.4.4
stack-data==0.6.3
standardjson==0.3.1
starlette==0.35.1
structlog==20.1.0
tblib==3.0.0
tenacity==8.2.2
text-unidecode==1.3
textrazor==1.4.0
threadpoolctl==3.2.0
tiktoken==0.5.2
tomli==2.0.1
tomlkit==0.12.3
tqdm==4.66.1
traitlets==5.14.1
Twisted==23.10.0
txaio==23.1.1
typing-inspect==0.9.0
typing_extensions==4.9.0
tzdata==2023.4
tzlocal==5.2
ujson==5.9.0
Unidecode==1.3.7
unittest-xml-reporting==3.2.0
urllib3==1.26.18
urllib3-mock==0.3.3
usaddress==0.5.10
uvicorn==0.17.6
vine==5.1.0
virtualenv==20.25.0
watchgod==0.8.2
wcwidth==0.2.13
websockets==12.0
wrapt==1.16.0
xmltodict==0.13.0
xxhash==3.4.1
yarl==1.9.4
zipp==3.17.0
zope.interface==6.1
zstandard==0.22.0
If I just set the version to 6.5.0
in requirements.txt
and run pip install --no-cache-dir -r requirements.txt
, pip freeze
yields the same with importlib_meta-data
pinned at 6.11.0
@econno11y I don't see ddtrace in your pip freeze from https://github.com/DataDog/dd-trace-py/issues/8068#issuecomment-1889845365, but the version of importlib-metadata has been pinned as it should. Can you confirm if the pinned version resolved the exception?
@majorgreys this did not fix the issue. I tried to pin it at 6.5.0 in requirements.txt, like this:
--editable . # this is used to make the whole system work as expected, so don't remove it
amqp==5.2.0
# vine==5.0.0
ariadne==0.21
# graphql-core==3.2.3
# starlette==0.28.0
# anyio==3.7.0
# exceptiongroup==1.1.1
# idna==3.4
# sniffio==1.3.0
# typing_extensions==4.7.1 # 4.6.x caused errors, try next version
# typing_extensions==4.7.1 # 4.6.x caused errors, try next version
ariadne-django==0.3.0
# ariadne==0.20.1
# graphql-core==3.2.3
# starlette==0.28.0
# anyio==3.7.0
# exceptiongroup==1.1.1
# idna==3.4
# sniffio==1.3.0
# typing_extensions==4.7.1
# typing_extensions==4.7.1
# Django==4.2.5
# asgiref==3.7.2
# typing_extensions==4.7.1
# sqlparse==0.4.4
beautifulsoup4==4.12.2
# soupsieve==2.4.1
blessed==1.20.0
# six==1.16.0
# wcwidth==0.2.6
boto3==1.24.75
# botocore==1.27.75
# jmespath==0.10.0
# python-dateutil==2.8.0
# six==1.16.0
# urllib3==1.26.18
# jmespath==0.10.0
# s3transfer==0.6.0
# botocore==1.27.75
# jmespath==0.10.0
# python-dateutil==2.8.0
# six==1.16.0
# urllib3==1.26.18
botocore==1.27.75 # todo: upgrade independently of other packages
# jmespath==0.10.0
# python-dateutil==2.8.0
# six==1.16.0
# urllib3==1.26.18
celery==5.2.3 # todo: upgrade independently of other packages
# billiard==3.6.4.0
# click==8.0.3
# click-didyoumean==0.3.0
# click==8.0.3
# click-plugins==1.1.1
# click==8.0.3
# click-repl==0.2.0
# click==8.0.3
# prompt-toolkit==3.0.24
# wcwidth==0.2.6
# six==1.16.0
# kombu==5.2.3
# amqp==5.1.1
# vine==5.0.0
# vine==5.0.0
# pytz==2023.3
# setuptools==59.6.0
# vine==5.0.0
channels==4.0.0
# asgiref==3.7.2
# typing_extensions==4.7.1
# Django==4.2.5
# asgiref==3.7.2
# typing_extensions==4.7.1
# sqlparse==0.4.4
chardet==5.2.0
dateparser==1.2.0
# python-dateutil==2.8.0
# six==1.16.0
# pytz==2023.3
# regex==2023.6.3
# tzlocal==4.4b1
# pytz-deprecation-shim==0.1.0.post0
# tzdata==2023.3
daphne==4.0.0
# asgiref==3.7.2
# typing_extensions==4.7.1
# autobahn==23.6.1
# cryptography==3.4.8
# cffi==1.14.6
# pycparser==2.20
# hyperlink==21.0.0
# idna==3.4
# setuptools==59.6.0
# txaio==23.1.1
# Twisted==22.10.0
# attrs==23.1.0
# Automat==22.10.0
# attrs==23.1.0
# six==1.16.0
# constantly==15.1.0
# hyperlink==21.0.0
# idna==3.4
# incremental==22.10.0
# typing_extensions==4.7.1
# zope.interface==6.0
# setuptools==59.6.0
datadog-api-client==2.20.0
# certifi==2022.12.7
# python-dateutil==2.8.0
# six==1.16.0
# typing_extensions==4.7.1
# urllib3==1.26.18
ddtrace==2.4.0
# attrs==23.2.0
# bytecode==0.15.1
# typing_extensions==4.9.0
# cattrs==23.2.3
# attrs==23.2.0
# exceptiongroup==1.2.0
# typing_extensions==4.9.0
# ddsketch==2.0.4
# protobuf==3.19.6
# six==1.16.0
# envier==0.5.0
# opentelemetry-api==1.22.0
# Deprecated==1.2.14
# wrapt==1.16.0
# importlib-metadata<=6.5.0
# zipp==3.17.0
# protobuf==3.19.6
# six==1.16.0
# typing_extensions==4.9.0
# xmltodict==0.13.0
decorator==5.1.1
Django==4.2.9
# asgiref==3.7.2
# typing_extensions==4.7.1
# sqlparse==0.4.4
django-allow-cidr==0.7.1
# Django==4.2.5
# asgiref==3.7.2
# typing_extensions==4.9.0
# sqlparse==0.4.4
django-axes==5.41.1 # todo: upgrade independently of other packages
# Django==4.2.5
# asgiref==3.7.2
# typing_extensions==4.7.1
# sqlparse==0.4.4
# django-ipware==4.0.2
# setuptools==59.6.0
django-celery-beat==2.5.0
# celery==5.2.3
# billiard==3.6.4.0
# click==8.0.3
# click-didyoumean==0.3.0
# click==8.0.3
# click-plugins==1.1.1
# click==8.0.3
# click-repl==0.2.0
# click==8.0.3
# prompt-toolkit==3.0.24
# wcwidth==0.2.6
# six==1.16.0
# kombu==5.2.3
# amqp==5.1.1
# vine==5.0.0
# vine==5.0.0
# pytz==2023.3
# setuptools==59.6.0
# vine==5.0.0
# cron-descriptor==1.4.0
# Django==4.2.5
# asgiref==3.7.2
# typing_extensions==4.7.1
# sqlparse==0.4.4
# django-timezone-field==5.1
# Django==4.2.5
# asgiref==3.7.2
# typing_extensions==4.7.1
# sqlparse==0.4.4
# pytz==2023.3
# python-crontab==2.7.1
# python-dateutil==2.8.0
# six==1.16.0
# tzdata==2023.3
django-cors-headers==4.3.1
# Django==4.2.5
# asgiref==3.7.2
# typing_extensions==4.7.1
# sqlparse==0.4.4
django-extensions==3.2.3
# Django==4.2.5
# asgiref==3.7.2
# typing_extensions==4.7.1
# sqlparse==0.4.4
django-postgres-extra==2.0.2 # todo: upgrading this breaks some tests - do independently of other packages
# ansimarkup==1.4.0
# colorama==0.4.4
# Django==4.2.5
# asgiref==3.7.2
# typing_extensions==4.7.1
# sqlparse==0.4.4
# enforce==0.3.4
# wrapt==1.12.1
# python-dateutil==2.8.0
# six==1.16.0
# structlog==20.1.0
# six==1.16.0
django-prettyjson==0.4.1 # Likely not used, investigate
# Django==4.2.5
# asgiref==3.7.2
# typing_extensions==4.7.1
# sqlparse==0.4.4
# six==1.16.0
# standardjson==0.3.1
django-redis==5.4.0
# Django==4.2.5
# asgiref==3.7.2
# typing_extensions==4.7.1
# sqlparse==0.4.4
# redis==4.1.0
# Deprecated==1.2.13
# wrapt==1.12.1
# packaging==21.3
# pyparsing==2.4.7
djangorestframework==3.14.0
# Django==4.2.5
# asgiref==3.7.2
# typing_extensions==4.7.1
# sqlparse==0.4.4
# pytz==2023.3
django-storages==1.14.2
# Django==4.2.5
# asgiref==3.7.2
# typing_extensions==4.7.1
# sqlparse==0.4.4
drf-extra-fields==3.7.0
# Django==4.2.5
# asgiref==3.7.2
# typing_extensions==4.7.1
# sqlparse==0.4.4
# djangorestframework==3.14.0
# Django==4.2.5
# asgiref==3.7.2
# typing_extensions==4.7.1
# sqlparse==0.4.4
# pytz==2023.3
# filetype==1.2.0
geopy==2.4.1
# geographiclib==2.0
googlemaps==4.10.0
# requests==2.29.0
# certifi==2022.12.7
# charset-normalizer==2.0.6
# idna==3.4
# urllib3==1.26.18
grpc-gateway-protoc-gen-openapiv2==0.1.0 # todo: used?
# googleapis-common-protos==1.56.4
# protobuf==3.19.5
# The above package requires us to pin protobuf to a <= 3.20 version.
protobuf<=3.20.*
grpcio==1.54.2 # todo: used?
gunicorn==21.2.0
# setuptools==59.6.0
ipython==8.18.1 # 8.19 drops support for python 3.9
# appnope==0.1.3
# backcall==0.2.0
# decorator==5.1.1
# jedi==0.18.2
# parso==0.8.3
# matplotlib-inline==0.1.6
# traitlets==5.9.0
# pexpect==4.8.0
# ptyprocess==0.7.0
# pickleshare==0.7.5
# prompt-toolkit==3.0.24
# wcwidth==0.2.6
# Pygments==2.14.0
# stack-data==0.6.2
# asttokens==2.2.1
# six==1.16.0
# executing==1.2.0
# pure-eval==0.2.2
# traitlets==5.9.0
kafka-python==2.0.2
keyring==21.8.0 # todo: investigate if all the scripts using this need to exist
langchain==0.0.270 # todo: upgrade independently of other packages
# aiohttp==3.8.5
# aiosignal==1.3.1
# frozenlist==1.3.3
# async-timeout==4.0.2
# attrs==23.1.0
# charset-normalizer==2.0.6
# frozenlist==1.3.3
# multidict==6.0.4
# yarl==1.9.2
# idna==3.4
# multidict==6.0.4
# async-timeout==4.0.2
# dataclasses-json==0.5.14
# marshmallow==3.20.1
# packaging==21.3
# pyparsing==2.4.7
# typing-inspect==0.9.0
# mypy-extensions==1.0.0
# typing_extensions==4.7.1
# langsmith==0.0.25
# pydantic==2.2.1
# annotated-types==0.5.0
# pydantic_core==2.6.1
# typing_extensions==4.7.1
# typing_extensions==4.7.1
# requests==2.29.0
# certifi==2022.12.7
# charset-normalizer==2.0.6
# idna==3.4
# urllib3==1.26.18
# numexpr==2.8.5
# numpy==1.22.4
# numpy==1.22.4
# pydantic==2.2.1
# annotated-types==0.5.0
# pydantic_core==2.6.1
# typing_extensions==4.7.1
# typing_extensions==4.7.1
# PyYAML==6.0
# requests==2.29.0
# certifi==2022.12.7
# charset-normalizer==2.0.6
# idna==3.4
# urllib3==1.26.18
# SQLAlchemy==2.0.20
# greenlet==2.0.2
# typing_extensions==4.7.1
# tenacity==8.2.2
launchdarkly-server-sdk==8.2.1 # todo: upgrade to 9.*
# certifi==2022.12.7
# expiringdict==1.1.4
# pyRFC3339==1.1
# pytz==2023.3
# semver==2.13.0
# urllib3==1.26.18
more-itertools==10.2.0
numpy==1.22.4
openai==0.27.7
# aiohttp==3.8.5
# aiosignal==1.3.1
# frozenlist==1.3.3
# async-timeout==4.0.2
# attrs==23.1.0
# charset-normalizer==2.0.6
# frozenlist==1.3.3
# multidict==6.0.4
# yarl==1.9.2
# idna==3.4
# multidict==6.0.4
# requests==2.29.0
# certifi==2022.12.7
# charset-normalizer==2.0.6
# idna==3.4
# urllib3==1.26.18
# tqdm==4.65.0
pandas==1.3.3 # todo: requires some indepth changelog reading: https://pandas.pydata.org/docs/whatsnew/index.html
# numpy==1.22.4
# python-dateutil==2.8.0
# six==1.16.0
# pytz==2023.3
pinecone-client==2.2.4
# dnspython==2.3.0
# loguru==0.7.0
# numpy==1.22.4
# python-dateutil==2.8.0
# six==1.16.0
# PyYAML==6.0
# requests==2.29.0
# certifi==2022.12.7
# charset-normalizer==2.0.6
# idna==3.4
# urllib3==1.26.18
# tqdm==4.65.0
# typing_extensions==4.7.1 # 4.6.x caused errors, try next version
# urllib3==1.26.18
progressbar2==4.3.2
# python-utils==3.3.3
psycopg2-binary==2.9.1 # note: https://docs.djangoproject.com/en/4.2/releases/4.2/#psycopg-3-support
pysimdjson==5.0.2
python-dotenv==1.0.0
python-slugify==8.0.1
# text-unidecode==1.3
redis==4.1.0
# Deprecated==1.2.13
# wrapt==1.12.1
# packaging==21.3
# pyparsing==2.4.7
# Leave unpinned, allow PIP to determine a supported version.
requests
sentry-sdk==1.11.1 # todo: upgrade independently of other packages: https://github.com/getsentry/sentry-python/blob/master/CHANGELOG.md
# certifi==2022.12.7
# urllib3==1.26.18
setproctitle==1.3.3
scikit-learn==1.3.0 # todo: research if this is used
# joblib==1.3.2
# numpy==1.22.4
# scipy==1.11.1
# numpy==1.22.4
# threadpoolctl==3.2.0
slackclient==2.9.4
# aiohttp==3.8.5
# aiosignal==1.3.1
# frozenlist==1.3.3
# async-timeout==4.0.2
# attrs==23.1.0
# charset-normalizer==2.0.6
# frozenlist==1.3.3
# multidict==6.0.4
# yarl==1.9.2
# idna==3.4
# multidict==6.0.4
snowflake-connector-python==2.7.8 # todo: research if this is used
# asn1crypto==1.4.0
# certifi==2022.12.7
# cffi==1.14.6
# pycparser==2.20
# charset-normalizer==2.0.6
# cryptography==3.4.8
# cffi==1.14.6
# pycparser==2.20
# idna==3.4
# oscrypto==1.2.1
# asn1crypto==1.4.0
# pycryptodomex==3.10.4
# PyJWT==2.4.0
# pyOpenSSL==21.0.0
# cryptography==3.4.8
# cffi==1.14.6
# pycparser==2.20
# six==1.16.0
# pytz==2023.3
# requests==2.29.0
# certifi==2022.12.7
# charset-normalizer==2.0.6
# idna==3.4
# urllib3==1.26.18
# setuptools==59.6.0
tenacity==8.2.2
textrazor==1.4.1
tiktoken==0.5.2
# regex==2023.6.3
# requests==2.29.0
# certifi==2022.12.7
# charset-normalizer==2.0.6
# idna==3.4
# urllib3==1.26.18
tqdm==4.66.1
ujson==5.9.0 # todo: research if this is used
urllib3==1.26.18 # todo: upgrade to 2.x: https://urllib3.readthedocs.io/en/latest/v2-migration-guide.html
usaddress==0.5.10
# future==0.18.3
# probableparsing==0.0.1
# python-crfsuite==0.9.10
Unidecode==1.3.8
unittest-xml-reporting==3.2.0
# lxml==4.9.2
uvicorn==0.17.6 # todo: upgrade independently of other packages
# asgiref==3.7.2
# typing_extensions==4.7.1 # 4.6.x caused errors, try next version
# click==8.0.3
# h11==0.14.0
watchgod==0.8.2
# anyio==3.7.0
# exceptiongroup==1.1.1
# idna==3.4
# sniffio==1.3.0
websockets==12.0
xxhash==3.4.1 # todo: research if this is used
zstandard==0.22.0 # todo: research if this is used
# Dev and Test packages
# ----------------------
coverage==7.4.0
debugpy==1.8.0
factory-boy==3.3.0
flake8-for-pycharm==0.4.1
freezegun==1.4.0
mock==5.1.0
pipdeptree==2.13.2
pre-commit==3.6.0
# Needed, missing?
pytest
urllib3_mock
responses
# Allow for --parallel unit testing.
tblib
but after deleting my virtual env, reinstalling, reactivating, and running pip install --no-cach-dir -r requirements.txt
, then pip freeze
, I see it is still at 6.11.0:
aiohttp==3.9.1
aiosignal==1.3.1
amqp==5.2.0
annotated-types==0.6.0
ansimarkup==1.4.0
anyio==3.7.1
ariadne==0.21
ariadne-django==0.3.0
asgiref==3.7.2
asn1crypto==1.5.1
astroid==3.0.2
asttokens==2.4.1
async-timeout==4.0.3
attrs==23.2.0
autobahn==23.6.2
Automat==22.10.0
autopep8==2.0.4
beautifulsoup4==4.12.2
billiard==3.6.4.0
blessed==1.20.0
boto3==1.24.75
botocore==1.27.75
bytecode==0.15.1
cattrs==23.2.3
celery==5.2.3
certifi==2023.11.17
cffi==1.16.0
cfgv==3.4.0
channels==4.0.0
chardet==5.2.0
charset-normalizer==2.0.12
click==8.1.7
click-didyoumean==0.3.0
click-plugins==1.1.1
click-repl==0.3.0
colorama==0.4.6
constantly==23.10.4
coverage==7.4.0
cron-descriptor==1.4.0
cryptography==36.0.2
Cython==3.0.0
daphne==4.0.0
dataclasses-json==0.5.14
datadog-api-client==2.20.0
dateparser==1.2.0
ddsketch==2.0.4
ddtrace==2.4.1
debugpy==1.8.0
decorator==5.1.1
Deprecated==1.2.14
dill==0.3.7
-e git+ssh://git@github.com/ontherivt/personalization.git@052bafb8db3c4d2b05a000a1751794f7f579c716#egg=discovery
distlib==0.3.8
Django==4.2.5
django-allow-cidr==0.7.1
django-axes==5.41.1
django-celery-beat==2.5.0
django-cors-headers==4.3.1
django-extensions==3.2.3
django-ipware==6.0.3
django-postgres-extra==2.0.2
django-prettyjson==0.4.1
django-redis==5.4.0
django-storages==1.14.2
django-timezone-field==6.1.0
djangorestframework==3.14.0
dnspython==2.4.2
drf-extra-fields==3.7.0
editdistance==0.6.0
enforce==0.3.4
envier==0.5.0
exceptiongroup==1.2.0
executing==2.0.1
expiringdict==1.1.4
factory-boy==3.3.0
Faker==22.1.0
filelock==3.13.1
filetype==1.2.0
flake8==7.0.0
flake8-for-pycharm==0.4.1
freezegun==1.4.0
frozenlist==1.4.1
future==0.18.3
geographiclib==2.0
geopy==2.4.1
googleapis-common-protos==1.62.0
googlemaps==4.10.0
graphql-core==3.2.3
grpc-gateway-protoc-gen-openapiv2==0.1.0
grpcio==1.54.2
gunicorn==21.2.0
h11==0.14.0
hyperlink==21.0.0
identify==2.5.33
idna==3.6
importlib-metadata==6.11.0
incremental==22.10.0
iniconfig==2.0.0
ipython==8.18.1
isort==5.13.2
jedi==0.19.1
jmespath==1.0.1
joblib==1.3.2
kafka-python==2.0.2
keyring==21.8.0
kombu==5.3.4
langchain==0.0.270
langsmith==0.0.79
launchdarkly-server-sdk==7.2.0
loguru==0.7.2
lxml==5.1.0
marshmallow==3.20.2
matplotlib-inline==0.1.6
mccabe==0.7.0
mock==5.1.0
more-itertools==8.13.0
multidict==6.0.4
mypy-extensions==1.0.0
nodeenv==1.8.0
numexpr==2.8.8
numpy==1.22.4
openai==0.27.7
opentelemetry-api==1.22.0
oscrypto==1.3.0
packaging==23.2
pandas==1.3.3
parso==0.8.3
pexpect==4.9.0
pinecone-client==2.2.4
pipdeptree==2.13.1
platformdirs==4.1.0
pluggy==1.3.0
pre-commit==3.6.0
probableparsing==0.0.1
progressbar2==4.3.2
prompt-toolkit==3.0.43
protobuf==3.19.6
psycopg2-binary==2.9.1
ptyprocess==0.7.0
pure-eval==0.2.2
pyasn1==0.5.1
pyasn1-modules==0.3.0
pycodestyle==2.11.1
pycparser==2.21
pycryptodomex==3.20.0
pydantic==2.5.3
pydantic_core==2.14.6
pyflakes==3.2.0
Pygments==2.17.2
PyJWT==2.8.0
pylint==3.0.3
pyOpenSSL==22.0.0
pyRFC3339==1.1
pysimdjson==5.0.2
pytest==7.4.4
python-crfsuite==0.9.10
python-crontab==3.0.0
python-dateutil==2.8.0
python-dotenv==1.0.0
python-ipware==2.0.1
python-slugify==8.0.1
python-utils==3.8.1
pytz==2023.3.post1
PyYAML==6.0.1
redis==4.1.0
regex==2023.12.25
requests==2.31.0
responses==0.24.1
s3transfer==0.6.2
scikit-learn==1.3.0
scipy==1.11.4
semver==2.13.0
sentry-sdk==1.11.1
service-identity==23.1.0
setproctitle==1.3.3
six==1.16.0
slackclient==2.9.4
sniffio==1.3.0
snowflake-connector-python==2.7.8
soupsieve==2.5
SQLAlchemy==2.0.25
sqlparse==0.4.4
stack-data==0.6.3
standardjson==0.3.1
starlette==0.34.0
structlog==20.1.0
tblib==3.0.0
tenacity==8.2.2
text-unidecode==1.3
textrazor==1.4.0
threadpoolctl==3.2.0
tiktoken==0.5.2
tomli==2.0.1
tomlkit==0.12.3
tqdm==4.66.1
traitlets==5.14.1
Twisted==23.10.0
txaio==23.1.1
typing-inspect==0.9.0
typing_extensions==4.9.0
tzdata==2023.4
tzlocal==5.2
ujson==5.9.0
Unidecode==1.3.7
unittest-xml-reporting==3.2.0
urllib3==1.26.18
urllib3-mock==0.3.3
usaddress==0.5.10
uvicorn==0.17.6
vine==5.1.0
virtualenv==20.25.0
watchgod==0.8.2
wcwidth==0.2.13
websockets==12.0
wrapt==1.16.0
xmltodict==0.13.0
xxhash==3.4.1
yarl==1.9.4
zipp==3.17.0
zope.interface==6.1
zstandard==0.22.0
ddtrace is there now.
I throws this series of exceptions and hangs:
(.venv) econnolly@Erins-MacBook-Air discovery % python manage.py runserver
Unable to build package file mapping, please report this to https://github.com/DataDog/dd-trace-py/issues
Traceback (most recent call last):
File "/Users/econnolly/source/repos/rivt/personalization/.venv/lib/python3.9/site-packages/ddtrace/internal/utils/cache.py", line 118, in _
retval, exc = f.__callonce_result__ # type: ignore[attr-defined]
AttributeError: 'function' object has no attribute '__callonce_result__'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/econnolly/source/repos/rivt/personalization/.venv/lib/python3.9/site-packages/ddtrace/internal/packages.py", line 101, in _package_file_mapping
if ilmd_d is not None and ilmd_d.files is not None:
File "/Users/econnolly/source/repos/rivt/personalization/.venv/lib/python3.9/site-packages/importlib_metadata/__init__.py", line 520, in files
return skip_missing_files(
File "/Users/econnolly/source/repos/rivt/personalization/.venv/lib/python3.9/site-packages/importlib_metadata/_functools.py", line 102, in wrapper
return func(param, *args, **kwargs)
File "/Users/econnolly/source/repos/rivt/personalization/.venv/lib/python3.9/site-packages/importlib_metadata/__init__.py", line 518, in skip_missing_files
return list(filter(lambda path: path.locate().exists(), package_paths))
File "/Users/econnolly/source/repos/rivt/personalization/.venv/lib/python3.9/site-packages/importlib_metadata/__init__.py", line 555, in <genexpr>
(subdir / name)
File "/opt/homebrew/bin/Cellar/pyenv/2.3.33/versions/3.9.7/lib/python3.9/pathlib.py", line 939, in relative_to
raise ValueError("{!r} is not in the subpath of {!r}"
ValueError: '/Users/econnolly/source/repos/rivt/personalization/.venv/bin/futurize' is not in the subpath of '/Users/econnolly/source/repos/rivt/personalization/.venv/lib/python3.9/site-packages' OR one path is relative and the other is absolute.
^CTraceback (most recent call last):
File "/Users/econnolly/source/repos/rivt/personalization/src/discovery/manage.py", line 40, in <module>
main()
File "/Users/econnolly/source/repos/rivt/personalization/src/discovery/manage.py", line 25, in main
debugpy.wait_for_client()
File "/Users/econnolly/source/repos/rivt/personalization/.venv/lib/python3.9/site-packages/debugpy/public_api.py", line 31, in wrapper
return wrapped(*args, **kwargs)
File "/Users/econnolly/source/repos/rivt/personalization/.venv/lib/python3.9/site-packages/debugpy/server/api.py", line 311, in __call__
pydevd._wait_for_attach(cancel=cancel_event)
File "/Users/econnolly/source/repos/rivt/personalization/.venv/lib/python3.9/site-packages/debugpy/_vendored/pydevd/pydevd.py", line 2726, in _wait_for_attach
py_db.block_until_configuration_done(cancel=cancel)
File "/Users/econnolly/source/repos/rivt/personalization/.venv/lib/python3.9/site-packages/debugpy/_vendored/pydevd/pydevd.py", line 884, in block_until_configuration_done
self._py_db_command_thread_event.wait(1 / 15.)
File "/opt/homebrew/bin/Cellar/pyenv/2.3.33/versions/3.9.7/lib/python3.9/threading.py", line 574, in wait
signaled = self._cond.wait(timeout)
File "/opt/homebrew/bin/Cellar/pyenv/2.3.33/versions/3.9.7/lib/python3.9/threading.py", line 316, in wait
gotit = waiter.acquire(True, timeout)
KeyboardInterrupt
(.venv) econnolly@Erins-MacBook-Air discovery % python manage.py runserver
Unable to build package file mapping, please report this to https://github.com/DataDog/dd-trace-py/issues
Traceback (most recent call last):
File "/Users/econnolly/source/repos/rivt/personalization/.venv/lib/python3.9/site-packages/ddtrace/internal/utils/cache.py", line 118, in _
retval, exc = f.__callonce_result__ # type: ignore[attr-defined]
AttributeError: 'function' object has no attribute '__callonce_result__'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/econnolly/source/repos/rivt/personalization/.venv/lib/python3.9/site-packages/ddtrace/internal/packages.py", line 101, in _package_file_mapping
if ilmd_d is not None and ilmd_d.files is not None:
File "/Users/econnolly/source/repos/rivt/personalization/.venv/lib/python3.9/site-packages/importlib_metadata/__init__.py", line 520, in files
return skip_missing_files(
File "/Users/econnolly/source/repos/rivt/personalization/.venv/lib/python3.9/site-packages/importlib_metadata/_functools.py", line 102, in wrapper
return func(param, *args, **kwargs)
File "/Users/econnolly/source/repos/rivt/personalization/.venv/lib/python3.9/site-packages/importlib_metadata/__init__.py", line 518, in skip_missing_files
return list(filter(lambda path: path.locate().exists(), package_paths))
File "/Users/econnolly/source/repos/rivt/personalization/.venv/lib/python3.9/site-packages/importlib_metadata/__init__.py", line 555, in <genexpr>
(subdir / name)
File "/opt/homebrew/bin/Cellar/pyenv/2.3.33/versions/3.9.7/lib/python3.9/pathlib.py", line 939, in relative_to
raise ValueError("{!r} is not in the subpath of {!r}"
ValueError: '/Users/econnolly/source/repos/rivt/personalization/.venv/bin/futurize' is not in the subpath of '/Users/econnolly/source/repos/rivt/personalization/.venv/lib/python3.9/site-packages' OR one path is relative and the other is absolute.
Checking in on this again. I'm still unable to build.
I see this https://github.com/DataDog/dd-trace-py/pull/8075. What is the status?
Summary of problem
Django project won't start due to ddtrace exception
Which version of dd-trace-py are you using? 2.4.0
Which version of pip are you using?
Which libraries and their versions are you using? 21.2.3
`pip freeze`
aiohttp==3.9.1 aiosignal==1.3.1 amqp==5.2.0 annotated-types==0.6.0 ansimarkup==1.4.0 anyio==3.7.1 ariadne==0.21 ariadne-django==0.3.0 asgiref==3.7.2 asn1crypto==1.5.1 astroid==3.0.2 asttokens==2.4.1 async-timeout==4.0.3 attrs==23.2.0 autobahn==23.6.2 Automat==22.10.0 beautifulsoup4==4.12.2 billiard==3.6.4.0 blessed==1.20.0 boto3==1.24.75 botocore==1.27.75 bytecode==0.15.1 cattrs==23.2.3 celery==5.2.3 certifi==2023.11.17 cffi==1.16.0 cfgv==3.4.0 channels==4.0.0 chardet==5.2.0 charset-normalizer==2.0.12 click==8.1.7 click-didyoumean==0.3.0 click-plugins==1.1.1 click-repl==0.3.0 colorama==0.4.6 constantly==23.10.4 coverage==7.4.0 cron-descriptor==1.4.0 cryptography==36.0.2 Cython==3.0.0 daphne==4.0.0 dataclasses-json==0.5.14 datadog-api-client==2.20.0 dateparser==1.2.0 ddsketch==2.0.4 ddtrace==2.4.0 debugpy==1.8.0 decorator==5.1.1 Deprecated==1.2.14 dill==0.3.7 -e git+ssh://git@github.com/ontherivt/personalization.git@78ed9502c81f6b418a44f4ece00cb276942df4ee#egg=discovery distlib==0.3.8 Django==4.2.5 django-allow-cidr==0.7.1 django-axes==5.41.1 django-celery-beat==2.5.0 django-cors-headers==4.3.1 django-extensions==3.2.3 django-ipware==6.0.3 django-postgres-extra==2.0.2 django-prettyjson==0.4.1 django-redis==5.4.0 django-storages==1.14.2 django-timezone-field==6.1.0 djangorestframework==3.14.0 dnspython==2.4.2 drf-extra-fields==3.7.0 editdistance==0.6.0 enforce==0.3.4 envier==0.5.0 exceptiongroup==1.2.0 executing==2.0.1 expiringdict==1.1.4 factory-boy==3.3.0 Faker==22.1.0 filelock==3.13.1 filetype==1.2.0 flake8==7.0.0 flake8-for-pycharm==0.4.1 freezegun==1.4.0 frozenlist==1.4.1 future==0.18.3 geographiclib==2.0 geopy==2.4.1 googleapis-common-protos==1.62.0 googlemaps==4.10.0 graphql-core==3.2.3 grpc-gateway-protoc-gen-openapiv2==0.1.0 grpcio==1.54.2 gunicorn==21.2.0 h11==0.14.0 hyperlink==21.0.0 identify==2.5.33 idna==3.6 importlib-metadata==6.11.0 incremental==22.10.0 iniconfig==2.0.0 ipython==8.18.1 isort==5.13.2 jedi==0.19.1 jmespath==1.0.1 joblib==1.3.2 kafka-python==2.0.2 keyring==21.8.0 kombu==5.3.4 langchain==0.0.270 langsmith==0.0.79 launchdarkly-server-sdk==7.2.0 loguru==0.7.2 lxml==5.1.0 marshmallow==3.20.2 matplotlib-inline==0.1.6 mccabe==0.7.0 mock==5.1.0 more-itertools==8.13.0 multidict==6.0.4 mypy-extensions==1.0.0 nodeenv==1.8.0 numexpr==2.8.8 numpy==1.22.4 openai==0.27.7 opentelemetry-api==1.22.0 oscrypto==1.3.0 packaging==23.2 pandas==1.3.3 parso==0.8.3 pexpect==4.9.0 pinecone-client==2.2.4 pipdeptree==2.13.1 platformdirs==4.1.0 pluggy==1.3.0 pre-commit==3.6.0 probableparsing==0.0.1 progressbar2==4.3.2 prompt-toolkit==3.0.43 protobuf==3.19.6 psycopg2-binary==2.9.1 ptyprocess==0.7.0 pure-eval==0.2.2 pyasn1==0.5.1 pyasn1-modules==0.3.0 pycodestyle==2.11.1 pycparser==2.21 pycryptodomex==3.20.0 pydantic==2.5.3 pydantic_core==2.14.6 pyflakes==3.2.0 Pygments==2.17.2 PyJWT==2.8.0 pylint==3.0.3 pyOpenSSL==22.0.0 pyRFC3339==1.1 pysimdjson==5.0.2 pytest==7.4.4 python-crfsuite==0.9.10 python-crontab==3.0.0 python-dateutil==2.8.0 python-dotenv==1.0.0 python-ipware==2.0.1 python-slugify==8.0.1 python-utils==3.8.1 pytz==2023.3.post1 PyYAML==6.0.1 redis==4.1.0 regex==2023.12.25 requests==2.31.0 responses==0.24.1 s3transfer==0.6.2 scikit-learn==1.3.0 scipy==1.11.4 semver==2.13.0 sentry-sdk==1.11.1 service-identity==23.1.0 setproctitle==1.3.3 six==1.16.0 slackclient==2.9.4 sniffio==1.3.0 snowflake-connector-python==2.7.8 soupsieve==2.5 SQLAlchemy==2.0.25 sqlparse==0.4.4 stack-data==0.6.3 standardjson==0.3.1 starlette==0.34.0 structlog==20.1.0 tblib==3.0.0 tenacity==8.2.2 text-unidecode==1.3 textrazor==1.4.0 threadpoolctl==3.2.0 tiktoken==0.5.2 tomli==2.0.1 tomlkit==0.12.3 tqdm==4.66.1 traitlets==5.14.1 Twisted==23.10.0 txaio==23.1.1 typing-inspect==0.9.0 typing_extensions==4.9.0 tzdata==2023.4 tzlocal==5.2 ujson==5.9.0 Unidecode==1.3.7 unittest-xml-reporting==3.2.0 urllib3==1.26.18 urllib3-mock==0.3.3 usaddress==0.5.10 uvicorn==0.17.6 vine==5.1.0 virtualenv==20.25.0 watchgod==0.8.2 wcwidth==0.2.13 websockets==12.0 wrapt==1.16.0 xmltodict==0.13.0 xxhash==3.4.1 yarl==1.9.4 zipp==3.17.0 zope.interface==6.1 zstandard==0.22.0How can we reproduce your problem?
M2 mac django project
What is the result that you get?
I get the exception pasted above
What is the result that you expected?
That the dependencies would build successfully and the dango server would run