Skip to content

Commit 8345735

Browse files
authored
pin urllib3 version in docker setup (#310)
*Issue #, if available:* Attempt to pin urllib3 version to fix python 3.8 runtime issue. ``` Defaulted container "my-container" out of: my-container, opentelemetry-auto-instrumentation-python (init) Error in sitecustomize; set PYTHONVERBOSE for traceback: RuntimeError: Python 3.9 or later is required Traceback (most recent call last): File "manage.py", line 23, in <module> main() File "manage.py", line 19, in main execute_from_command_line(sys.argv) File "/usr/local/lib/python3.8/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line . . . File "/usr/local/lib/python3.8/site-packages/botocore/compat.py", line 32, in <module> from urllib3 import exceptions File "/otel-auto-instrumentation-python/urllib3/__init__.py", line 14, in <module> from . import exceptions File "/otel-auto-instrumentation-python/urllib3/exceptions.py", line 26, in <module> _TYPE_REDUCE_RESULT = tuple[typing.Callable[..., object], tuple[object, ...]] TypeError: 'type' object is not subscriptable ``` *Test plan:* Tested locally on playground EKS cluster and validated the change fixes the startup runtime issue. Will monitor EK2 workflow after PR is merged to ensure it passes there as well. By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
1 parent 4bf907f commit 8345735

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

Dockerfile

+11-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,17 @@ ADD aws-opentelemetry-distro/ ./aws-opentelemetry-distro/
1818
# * https://github.com/MicrosoftDocs/azure-docs/blob/main/articles/azure-functions/recover-python-functions.md#troubleshoot-cannot-import-cygrpc
1919
RUN sed -i "/opentelemetry-exporter-otlp-proto-grpc/d" ./aws-opentelemetry-distro/pyproject.toml
2020

21-
RUN mkdir workspace && pip install --target workspace ./aws-opentelemetry-distro
21+
# urllib3 recently made a release that drops support for Python 3.8
22+
# Our sdk depends on botocore which pulls in the version of urllib3 based Python runtime it detects.
23+
# The rule is that if current pip command version is > 3.9 botocore will pick up the latest urllib3,
24+
# otherwise it picks up the older urllib3 that is compatible with Python 3.8.
25+
# https://github.com/boto/botocore/blob/develop/requirements-docs.txt
26+
# Since this Dockerfile currently uses the fixed Python 3.11 base image to pull the required dependencies,
27+
# EKS and ECS applications will encounter a runtime error for Python 3.8 compatibility.
28+
# Our fix is to temporarily restrict the urllib3 version to one that works for all supported Python versions
29+
# that we currently commit to support (notably 3.8).
30+
# TODO: Remove this temporary workaround once we deprecate Python 3.8 support since it has reached end-of-life.
31+
RUN mkdir workspace && pip install urllib3==2.2.3 --target workspace ./aws-opentelemetry-distro
2232

2333
# Stage 2: Build the cp-utility binary
2434
FROM public.ecr.aws/docker/library/rust:1.81 as builder

0 commit comments

Comments
 (0)