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

ddtrace fails to declare all of its direct dependencies #8866

Open
cliebBS opened this issue Apr 3, 2024 · 1 comment
Open

ddtrace fails to declare all of its direct dependencies #8866

cliebBS opened this issue Apr 3, 2024 · 1 comment

Comments

@cliebBS
Copy link

cliebBS commented Apr 3, 2024

Summary of problem

When starting with ddtrace-run and ddtrace 2.4.3 or 2.7.6 when opentelemetry-api 1.24.0 is present results in the following error message:

error configuring Datadog tracing
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/ddtrace/bootstrap/sitecustomize.py", line 116, in <module>
    import ddtrace.bootstrap.preload as preload  # Perform the actual initialisation
  File "/usr/local/lib/python3.10/site-packages/ddtrace/internal/module.py", line 220, in _exec_module
    self.loader.exec_module(module)
  File "/usr/local/lib/python3.10/site-packages/ddtrace/bootstrap/preload.py", line 14, in <module>
    from ddtrace.internal.tracemethods import _install_trace_methods  # noqa:F401
  File "/usr/local/lib/python3.10/site-packages/ddtrace/internal/module.py", line 220, in _exec_module
    self.loader.exec_module(module)
  File "/usr/local/lib/python3.10/site-packages/ddtrace/internal/tracemethods.py", line 4, in <module>
    import wrapt
ModuleNotFoundError: No module named 'wrapt'

This can be traced back to the following change in the dependency tree for ddtrace

when using opentelemetry-api 1.23.0 (excerpt from `poetry show --tree`)

ddtrace 2.4.3 Datadog APM client library
├── attrs >=20
├── bytecode *
├── cattrs *
│   ├── attrs >=23.1.0
│   ├── exceptiongroup >=1.1.1
│   └── typing-extensions >=4.1.0,<4.6.3 || >4.6.3
├── ddsketch >=2.0.1
│   ├── protobuf >=3.0.0
│   └── six *
├── envier *
├── opentelemetry-api >=1
│   ├── deprecated >=1.2.6
│   │   └── wrapt >=1.10,<2
│   └── importlib-metadata >=6.0,<7.0
│       └── zipp >=0.5
├── protobuf >=3
├── six >=1.12.0
├── typing-extensions *
└── xmltodict >=0.12
when using opentelemetry-api 1.24.0 (excerpt from `poetry show --tree`)

ddtrace 2.4.3 Datadog APM client library
├── attrs >=20
├── bytecode *
├── cattrs *
│   ├── attrs >=23.1.0
│   ├── exceptiongroup >=1.1.1
│   └── typing-extensions >=4.1.0,<4.6.3 || >4.6.3
├── ddsketch >=2.0.1
│   ├── protobuf >=3.0.0
│   └── six *
├── envier *
├── opentelemetry-api >=1
├── protobuf >=3
├── six >=1.12.0
├── typing-extensions *
└── xmltodict >=0.12

By adding a dependency on wrapt >=1.10,<2 to my project, I was able to utilize DD tracing again.

Further digging shows that the reason that wrapt is missing is not due to opentelemetry-api 1.24.0 not depending on wrapt anymore, but rather due to a bug in Poetry 1.3.2 that was fixed at some point prior to their latest release, 1.8.2. That being said, relying on your dependencies to install your direct dependencies for you is just asking to become broken by an "improvement" to one of your direct or transitive dependencies that drops a dependency that you're using directly. You should audit your code to ensure that any other libraries in addition to wrapt are actually included in the install dependencies for this package.

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

Reproduced on both 2.4.3 and 2.7.6

Which version of pip are you using?

Poetry 1.3.2

Which libraries and their versions are you using?

`pip freeze` ddtrace 2.4.3 Datadog APM client library ├── attrs 23.2.0 ├── bytecode 0.15.1 ├── cattrs 23.2.3 │ ├── attrs 23.2.0 │ ├── exceptiongroup 1.2.0 │ └── typing-extensions 4.6.1 ├── ddsketch 3.0.1 │ ├── protobuf 3.20.3 │ └── six 1.16.0 ├── envier 0.5.1 ├── opentelemetry-api 1.24.0 ├── protobuf 3.20.3 ├── six 1.16.0 ├── typing-extensions 4.6.1 └── xmltodict 0.13.0

How can we reproduce your problem?

I was unable to build a minimal reproduction case for this issue as it is caused by a combination of our very large pyproject.toml file and an old version of Poetry that is not maintained anymore. You can "reproduce" the initial error that I had by doing pip install ddtrace==2.7.6 && poetry uninstall wrapt, though I doubt that is actually helpful in addressing the problem here :)

What is the result that you get?

What is the result that you expected?

@ZStriker19
Copy link
Contributor

Hi @cliebBS thanks for reaching out. We'll take a look!

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

No branches or pull requests

2 participants