open-telemetry / opentelemetry-python-contrib

OpenTelemetry instrumentation for Python modules
https://opentelemetry.io
Apache License 2.0
698 stars 579 forks source link

Bazelisk build failed #2762

Open pjachowi opened 1 month ago

pjachowi commented 1 month ago

Describe your environment

OS: Ubuntu Python version: Python 3.9.19 Package version: 0.47b0

What happened?

Attempt to build a Python project using opentelemetry.instrumentation.grpc using Bazel fails. Here is the minimal project reproducing the problem: https://github.com/pjachowi/otel_intrumentation_problem

Steps to Reproduce

  1. Clone the repo https://github.com/pjachowi/otel_intrumentation_problem
  2. bazelisk run //:requirements.update
  3. bazelisk run //:test

Expected Result

Successful run

Actual Result

$ bazelisk run //:test INFO: Analyzed target //:test (73 packages loaded, 4272 targets configured). INFO: Found 1 target... Target //:test up-to-date: bazel-bin/test INFO: Elapsed time: 0.401s, Critical Path: 0.04s INFO: 1 process: 1 internal. INFO: Build completed successfully, 1 total action INFO: Running command line: bazel-bin/test Traceback (most recent call last): File "/home/nobody/.cache/bazel/_bazel_nobody/b0c935cccbea1e51f1a6303d0c0ad81d/execroot/main/bazel-out/k8-fastbuild/bin/test.runfiles/main/test.py", line 1, in from opentelemetry.instrumentation import grpc File "/home/nobody/.cache/bazel/_bazel_nobody/b0c935cccbea1e51f1a6303d0c0ad81d/execroot/main/bazel-out/k8-fastbuild/bin/test.runfiles/py_deps_opentelemetry_instrumentation_grpc/site-packages/opentelemetry/instrumentation/grpc/init.py", line 291, in from opentelemetry.instrumentation.instrumentor import BaseInstrumentor File "/home/nobody/.cache/bazel/_bazel_nobody/b0c935cccbea1e51f1a6303d0c0ad81d/execroot/main/bazel-out/k8-fastbuild/bin/test.runfiles/py_deps_opentelemetry_instrumentation/site-packages/opentelemetry/instrumentation/instrumentor.py", line 27, in from opentelemetry.instrumentation.dependencies import ( File "/home/nobody/.cache/bazel/_bazel_nobody/b0c935cccbea1e51f1a6303d0c0ad81d/execroot/main/bazel-out/k8-fastbuild/bin/test.runfiles/py_deps_opentelemetry_instrumentation/site-packages/opentelemetry/instrumentation/dependencies.py", line 4, in from pkg_resources import ( File "/home/nobody/.cache/bazel/_bazel_nobody/b0c935cccbea1e51f1a6303d0c0ad81d/execroot/main/bazel-out/k8-fastbuild/bin/test.runfiles/py_deps_setuptools/site-packages/pkg_resources/init.py", line 96, in from jaraco.text import ( File "/home/nobody/.cache/bazel/_bazel_nobody/b0c935cccbea1e51f1a6303d0c0ad81d/execroot/main/bazel-out/k8-fastbuild/bin/test.runfiles/py_deps_setuptools/site-packages/setuptools/_vendor/jaraco/text/init.py", line 231, in files(name).joinpath('Lorem ipsum.txt').read_text(encoding='utf-8') File "/home/nobody/.cache/bazel/_bazel_nobody/b0c935cccbea1e51f1a6303d0c0ad81d/external/python3_9_x86_64-unknown-linux-gnu/lib/python3.9/pathlib.py", line 1266, in read_text with self.open(mode='r', encoding=encoding, errors=errors) as f: File "/home/nobody/.cache/bazel/_bazel_nobody/b0c935cccbea1e51f1a6303d0c0ad81d/external/python3_9_x86_64-unknown-linux-gnu/lib/python3.9/pathlib.py", line 1252, in open return io.open(self, mode, buffering, encoding, errors, newline, File "/home/nobody/.cache/bazel/_bazel_nobody/b0c935cccbea1e51f1a6303d0c0ad81d/external/python3_9_x86_64-unknown-linux-gnu/lib/python3.9/pathlib.py", line 1120, in _opener return self._accessor.open(self, flags, mode) FileNotFoundError: [Errno 2] No such file or directory: '/home/nobody/.cache/bazel/_bazel_nobody/b0c935cccbea1e51f1a6303d0c0ad81d/execroot/main/bazel-out/k8-fastbuild/bin/test.runfiles/py_deps_setuptools/site-packages/setuptools/_vendor/jaraco/text/Lorem ipsum.txt'

Additional context

The problem appared with the latest release 0.47b0, however pinning opentelemetry-instrumentation-grpc==0.46b0 reproduces the problem as well.

Would you like to implement a fix?

None

xrmx commented 1 month ago

From the stacktrace this looks unrelated though, looks more like the tool is messing with some unrelated stuff in setuptools.

zeitlinger commented 1 month ago

I have the same issue - you can use can see how I fixed my example app https://github.com/grafana/docker-otel-lgtm/pull/81

pjachowi commented 1 month ago

I have the same issue - you can use can see how I fixed my example app grafana/docker-otel-lgtm#81

I managed to fix the problem by adding to requirements.in

setuptools==70.3.0