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

Python Auto-instrumentation: Conflict dependencies versions #1885

Open
ChouMeriam21 opened this issue Jul 2, 2023 · 6 comments
Open

Python Auto-instrumentation: Conflict dependencies versions #1885

ChouMeriam21 opened this issue Jul 2, 2023 · 6 comments
Labels

Comments

@ChouMeriam21
Copy link

Hello!

I encountered an issue while using the OpenTelemetry auto-instrumentation to instrument a Python application that relies on urllib3 library version 1.26.14. According to the documentation, this version is supposed to be supported by the OpenTelemetry operator (ghcr.io/open-telemetry/opentelemetry-operator/autoinstrumentation-python:0.39b0), which I used as the image for the Instrumentation resource in Kubernetes.

Unfortunately, during deployment, I encountered a conflict error that prevented the creation of my pod.

image

@srikanthccv
Copy link
Member

Could you share the complete error/stack trace?

@ChouMeriam21
Copy link
Author

Yes of course, here's the complete error trace:
image
image

@ChouMeriam21
Copy link
Author

I had to change the versions of the following packages to make the auto instrumentation works :

  • urllib3 (from 1.26.14 to 2.0.2)
  • requests (from 2.31.0 to 2.82.2)
  • charset-normaliser (from 2.1.1 to 3.1.0)
  • packaging ( from 23.1 to 23.0)

Is there any other way ? Especially that there are some packages as requests and packaging that had to endure a downgrade which is not the desired behaviour.

@lusains
Copy link

lusains commented Nov 6, 2023

image

autoinstrumentation-python:0.40b0,How to fix it~

@sy-be
Copy link

sy-be commented Jan 29, 2024

I'd like to add some more context here.

When an init container for autoinstrumentation runs, it installs all of the packages and their dependencies listed in the requirements.txt file. In case with urllib3 it installs the latest available and supported version (which atm is 2.1.0). However if the application code specifies a different version in the corresponding Python environment (e.g. 1.26.14), this unfortunately breaks the application as PYTHONPATH is set to:

PYTHONPATH="/otel-auto-instrumentation-python/opentelemetry/instrumentation/auto_instrumentation:/otel-auto-instrumentation-python"

which overrides the import path for the urllib3. This in turn breaks other dependencies which rely on functionality of urllib3 1.26.14 which is a different major version.

A simple solution would be to somehow prepend the PYTHONPATH which whichever environment is used by the application. Another, possibly a better way, would be to prevent installation of packages inside /otel-auto-instrumentation-python - only install the instrumentation libraries without any other dependencies.

@sy-be
Copy link

sy-be commented Jan 29, 2024

This is somewhat similar to #1884, however in my case, I do not set PYTHONPATH anywhere and when this env var is set - it overrides the path with opentelemetry-autoinstrumentation and the libraries there.

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

No branches or pull requests

5 participants