-
Notifications
You must be signed in to change notification settings - Fork 646
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
DependencyConflict: requested: "psycopg2 >= 2.7.3.1" but found: "None" #610
Comments
Did you get any solution, i am trying to setup this whole distributed tracing and stuck at instrumenting psycopg2_binary. |
psycopg project recommends using psycopg2 in production instead of psycopg binary so we preferred to use that as the dependency. https://www.psycopg.org/docs/install.html#psycopg-vs-psycopg-binary
If there are use cases where one might want to use the binary version, may be we can add both deps and update our dep resolution system treat such cases as OR so that presence of either library resolves the requirement. |
We also use Although harder for you to maintain, instead of updating your |
Or something like this:
|
@owais can I help open a pull request for one of these options? |
That would be great but please summarize your solution here first. My only concern is if we'll ever need to support the AND case in addition to OR and if we should account for that today. |
@owais isn't AND already supported with:
in which case:
Would work with the above option. If I'm missing something (which I may be since I'm not as familiar with all the instrumentation yet). Please let me know and I'll write up a solution |
Here is an extremely disgusting workaround that I'm using in the meantime. Caveat - this only really works because I'm doing manual "auto-instrumentation" which you're not supposed to do. But it does work! import opentelemetry
orig_get_dependency_conflicts = opentelemetry.instrumentation.dependencies.get_dependency_conflicts
def psycopg2_or_psycopg2_binary_dependency_conficts(
deps: typing.Collection[str],
) -> typing.Optional[DependencyConflict]:
if 'psycopg2>=2.7.3.1' in deps:
conflict = orig_get_dependency_conflicts(deps)
if conflict and not conflict.found:
return orig_get_dependency_conflicts(['psycopg2-binary>=2.7.3.1'])
return orig_get_dependency_conflicts(deps)
opentelemetry.instrumentation.dependencies.get_dependency_conflicts = psycopg2_or_psycopg2_binary_dependency_conficts
# This import kicks off all of the autoinstrumentation of OpenTelemetry
import opentelemetry.instrumentation.auto_instrumentation.sitecustomize as autotrace |
@justmobilize "package2=1.0|package2-binary=1.0" < this is not something supported by pip out of the box right? So you are proposing a syntax to denote OR? That could work but I feel if one string/element always represented a single package, it'd be so much easier to work with. How about this: _instruments = Collection[Collection[Package...]...] Inner tuples would be AND'ed while outer ones would be OR'ed. For example:
would mean the instrumentation will be applied either when both
|
@owais I can do that. Just the guidance I needed. Should I follow SOP and join the Slack channel and find a |
@justmobilize no, you don't have to. You can just send the PR and discuss everything on Github. You're welcome to join the slack though :) |
I managed to make the instrumentation of psycopg2 work normally with psycopg2-binary. via the flag, As internally in I know that using more details in this discussion |
@eugeniyost @justmobilize @Dipenbhatt03 does @MatheusGeiger |
@justmobilize is out for a while, but @mmchugh and I also worked on this issue. We haven't tested |
@ocelotl Sorry for the slow response, but I got around to testing this and adding |
Another solution to this problem - theoretically could be to make a new |
|
Also fixes the issue for me when trying to trace in a development environment. Might be worth adding this to the documentation / example? psycopg2 2.7.3.1 is more than 7 years old, even debian's oldoldstable (buster) ships 2.7.7, so I don't thing the version check is super critical for it anyway: I would assume packages which try to instrument psycopg2 need psycopg2 themselves, whether it's as psycopg2 or psycopg2-binary. |
That should be easy to fix, just need to do whatever the kafka-python instrumentation is doing in pyproject.toml and package.py. |
After upgrade opentelemetry-instrumentation-psycopg2 from 0.19b0 to 0.23b2 there was an message
DependencyConflict: requested: "psycopg2 >= 2.7.3.1" but found: "None"
, my project dependencies do not have psycopg2, there is psycopg2-binary.Describe your environment
Steps to reproduce
install psycopg2-binary to project dependencies and opentelemetry-instrumentation-psycopg2 0.23b2, run django server using uwsgi
What is the expected behavior?
no DependencyConflict message
What is the actual behavior?
message
DependencyConflict: requested: "psycopg2 >= 2.7.3.1" but found: "None"
The text was updated successfully, but these errors were encountered: