happy-kitchen-89482
05/29/2025, 10:03 PM__init__.py
?kind-knife-49817
05/29/2025, 10:45 PMLibrary/Caches/pex/installed_wheels/04478aac471824d84810668118ad087271f7acc28f03850793592f9511290f0d/azure_monitor_opentelemetry-1.6.9-py3-none-any.whl/azure/monitor/opentelemetry
is the only nested folder in that and I don't know what I should be looking for in __init__.py
this is those contents
cat __init__.py
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License in the project root for
# license information.
# -------------------------------------------------------------------------
from azure.monitor.opentelemetry._configure import configure_azure_monitor
from ._version import VERSION
__all__ = [
"configure_azure_monitor",
]
__version__ = VERSION
happy-kitchen-89482
05/29/2025, 10:52 PMazure
packages then that is presumably not the issuehappy-kitchen-89482
05/29/2025, 10:52 PM--keep-sandboxes=always
and look at the pex building command in the relevant sandbox’s __run.sh
happy-kitchen-89482
05/29/2025, 10:52 PMhappy-kitchen-89482
05/29/2025, 10:54 PMazure.core.tracing.ext.opentelemetry_span
is indeed not present?happy-kitchen-89482
05/29/2025, 10:55 PMazure.monitor.opentelemetry
incorrectly fails to declare a dep on azure.core.tracing
or whatever?kind-knife-49817
05/29/2025, 10:55 PMhappy-kitchen-89482
05/29/2025, 10:55 PMazure.core.tracing
should either be in this wheel (and it isn’t) or more likely in another azure-related wheel (and you’re saying there are none)happy-kitchen-89482
05/29/2025, 10:56 PMhappy-kitchen-89482
05/29/2025, 10:56 PMkind-knife-49817
05/29/2025, 10:57 PMhappy-kitchen-89482
05/29/2025, 10:58 PMhappy-kitchen-89482
05/29/2025, 10:58 PMhappy-kitchen-89482
05/29/2025, 10:58 PMhappy-kitchen-89482
05/29/2025, 10:59 PMhappy-kitchen-89482
05/29/2025, 10:59 PMkind-knife-49817
05/29/2025, 11:01 PMinterpreter_constraints = ["CPython==3.12.*"]
kind-knife-49817
05/29/2025, 11:02 PMhappy-kitchen-89482
05/29/2025, 11:03 PMhappy-kitchen-89482
05/29/2025, 11:03 PMhappy-kitchen-89482
05/29/2025, 11:04 PMpex azure-monitor-opentelemetry
fails where pip
succeeds:
$ python3.11 -m pex azure-monitor-opentelemetry
Failed to resolve compatible distributions for 1 target:
1: cp311-cp311-macosx_14_0_arm64 interpreter at /Users/benjyw/.pyenv/versions/3.11.9/bin/python3.11 is not compatible with:
opentelemetry-sdk 1.31.1 requires opentelemetry-api==1.31.1 but 1 incompatible dist was resolved:
opentelemetry_api-1.33.1-py3-none-any.whl
opentelemetry-semantic-conventions 0.52b1 requires opentelemetry-api==1.31.1 but 1 incompatible dist was resolved:
opentelemetry_api-1.33.1-py3-none-any.whl
happy-kitchen-89482
05/29/2025, 11:04 PMkind-knife-49817
05/29/2025, 11:04 PMpython3.9
which is different than the called out pants python. as i look though thishappy-kitchen-89482
05/29/2025, 11:05 PMhappy-kitchen-89482
05/29/2025, 11:05 PMkind-knife-49817
05/29/2025, 11:06 PMpants_version = "2.23.1"
happy-kitchen-89482
05/29/2025, 11:07 PMhappy-kitchen-89482
05/29/2025, 11:07 PMkind-knife-49817
05/29/2025, 11:08 PM./pex --tmpdir .tmp --no-emit-warnings --pip-version 24.0 --python-path "<LONG PATH> --interpreter-constraint $'CPython==3.12.*' -- -c $'import hashlib, os, sys
python = os.path.realpath(sys.executable)
print(python)
hasher = hashlib.sha256()
with open(python, "rb") as fp:
for chunk in iter(lambda: fp.read(8192), b""):
hasher.update(chunk)
print(hasher.hexdigest())
'
im trying to find the pex command in that shell, am I on the right track here?happy-kitchen-89482
05/29/2025, 11:10 PMhappy-kitchen-89482
05/29/2025, 11:10 PMpip
version, to handle that package’s deps correctlyhappy-kitchen-89482
05/29/2025, 11:10 PMhappy-kitchen-89482
05/29/2025, 11:10 PMhappy-kitchen-89482
05/29/2025, 11:11 PMhappy-kitchen-89482
05/29/2025, 11:11 PM[python]
pip_version = "latest"
kind-knife-49817
05/29/2025, 11:15 PMazure-monitor-opentelemetry-exporter 1.0.0b36 --> 1.0.0b37
but then same error.kind-knife-49817
05/29/2025, 11:15 PMkind-knife-49817
05/29/2025, 11:21 PMkind-knife-49817
05/29/2025, 11:21 PMkind-knife-49817
05/29/2025, 11:21 PMhappy-kitchen-89482
05/29/2025, 11:22 PMhappy-kitchen-89482
05/29/2025, 11:22 PMkind-knife-49817
05/29/2025, 11:25 PM./pex --tmpdir .tmp --jobs 10 --no-emit-warnings --pip-version latest --python-path $'<?MY_PATH?>' --output-file custom.pex --emit-warnings $'--check=warn' --requirements-pex local_dists.pex --interpreter-constraint $'CPython==3.12.*' --entry-point <SNIP>.manage $'--sources-directory=source_files' $'Flask==3.1.*' $'JPype1[numpy]==1.5.0' $'azure-monitor-opentelemetry==1.6.*' $'celery[redis]==5.4.*' $'flask-cors==5.0.*' $'fpdf2==2.8.*' $'pusher==3.*' $'pydantic==2.10.*' $'requests==2.32.*' $'types-requests==2.32.*' --lock 3rdparty/python/lockfiles/default.txt --no-pypi $'--index=<https://pypi.org/simple/>' --manylinux manylinux2014 --layout zipapp
kind-knife-49817
05/29/2025, 11:40 PMpants run src/python/<SNIP>/manage.py --
and the pex target is:
pex_binary(
name="<SNIP>-pex",
entry_point="manage.py",
dependencies=[
":manage",
],
)
kind-knife-49817
05/29/2025, 11:47 PMkind-knife-49817
05/30/2025, 12:38 AM[GLOBAL]
pants_version = "2.23.1"
backend_packages = [
"pants.backend.python",
]
[source]
root_patterns = ["src/python"]
[python]
interpreter_constraints = ["CPython==3.12.*"]
enable_resolves = true
run_against_entire_lockfile = true
default_resolve = "python-default"
pip_version = "latest"
[python.resolves]
python-default = "3rdparty/python/lockfiles/default.txt"
[python-bootstrap]
search_path = ["<PYENV>", "<PATH>", "/usr/bin/python", "/usr/bin/python3"]
src/python/manage.py
from azure.monitor.opentelemetry import configure_azure_monitor
def main():
configure_azure_monitor(
logger_name="app",
)
if __name__ == "__main__":
main()
src/python/BUILD
python_sources(
name="manage",
sources=[
"manage.py",
],
)
pex_binary(
name="the-pex",
entry_point="manage.py",
dependencies=[
":manage",
],
)
kind-knife-49817
05/30/2025, 12:39 AMazure-monitor-opentelemetry==1.6.*
3rdparty/python/BUILD
python_requirements(
name="python-default",
source="requirements.txt",
)
kind-knife-49817
05/30/2025, 12:39 AMpants generate-lockfiles
Lockfile diff: 3rdparty/python/lockfiles/default.txt [python-default]
== Added dependencies ==
asgiref 3.8.1
azure-core 1.34.0
azure-core-tracing-opentelemetry 1.0.0b12
azure-identity 1.23.0
azure-monitor-opentelemetry 1.6.9
azure-monitor-opentelemetry-exporter 1.0.0b37
certifi 2025.4.26
cffi 1.17.1
charset-normalizer 3.4.2
cryptography 45.0.3
deprecated 1.2.18
fixedint 0.1.6
idna 3.10
importlib-metadata 8.6.1
isodate 0.7.2
msal 1.32.3
msal-extensions 1.3.1
msrest 0.7.1
oauthlib 3.2.2
opentelemetry-api 1.31.1
opentelemetry-instrumentation 0.52b1
opentelemetry-instrumentation-asgi 0.52b1
opentelemetry-instrumentation-dbapi 0.52b1
opentelemetry-instrumentation-django 0.52b1
opentelemetry-instrumentation-fastapi 0.52b1
opentelemetry-instrumentation-flask 0.52b1
opentelemetry-instrumentation-psycopg2 0.52b1
opentelemetry-instrumentation-requests 0.52b1
opentelemetry-instrumentation-urllib 0.52b1
opentelemetry-instrumentation-urllib3 0.52b1
opentelemetry-instrumentation-wsgi 0.52b1
opentelemetry-resource-detector-azure 0.1.5
opentelemetry-sdk 1.31.1
opentelemetry-semantic-conventions 0.52b1
opentelemetry-util-http 0.52b1
packaging 25.0
psutil 7.0.0
pycparser 2.22
pyjwt 2.10.1
requests 2.32.3
requests-oauthlib 2.0.0
six 1.17.0
typing-extensions 4.13.2
urllib3 2.4.0
wrapt 1.17.2
zipp 3.22.0
kind-knife-49817
05/30/2025, 12:40 AMpants package src/python:the-pex
- has the deps problemkind-knife-49817
05/30/2025, 12:40 AMpants run src/python/manage.py --
- has a diff problem but it can do the deps correctlyhappy-kitchen-89482
05/30/2025, 3:11 PMpex
cmd line that you sent was the keyhappy-kitchen-89482
05/30/2025, 3:12 PMpython -m pex --pip-version latest --output-file custom.pex --interpreter-constraint $'CPython==3.12.*' azure-monitor-opentelemetry==1.6.*
happy-kitchen-89482
05/30/2025, 3:12 PMhappy-kitchen-89482
05/30/2025, 3:12 PM$ ./custom.pex
Pex 2.40.1 hermetic environment with 1 requirement and 46 activated distributions.
Python 3.12.2 (main, Aug 30 2024, 14:24:04) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "pex", "copyright", "credits" or "license" for more information.
>>> from azure.monitor.opentelemetry._configure import configure_azure_monitor
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/Users/benjyw/Library/Caches/pex/installed_wheels/0/3e3ae4b4f8f048df7b7056510f75dbcf41055cdd433cc9425a5b7f7d1a0163c3/azure_monitor_opentelemetry-1.6.9-py3-none-any.whl/azure/monitor/opentelemetry/__init__.py", line 7, in <module>
from azure.monitor.opentelemetry._configure import configure_azure_monitor
File "/Users/benjyw/Library/Caches/pex/installed_wheels/0/3e3ae4b4f8f048df7b7056510f75dbcf41055cdd433cc9425a5b7f7d1a0163c3/azure_monitor_opentelemetry-1.6.9-py3-none-any.whl/azure/monitor/opentelemetry/_configure.py", line 36, in <module>
from azure.core.tracing.ext.opentelemetry_span import OpenTelemetrySpan
ModuleNotFoundError: No module named 'azure.core.tracing.ext.opentelemetry_span'
>>>
happy-kitchen-89482
05/30/2025, 3:14 PMhappy-kitchen-89482
05/30/2025, 3:14 PM$ unzip -t custom.pex | grep opentelemetry_span
testing: .deps/azure_core_tracing_opentelemetry-1.0.0b12-py3-none-any.whl/azure/core/tracing/ext/opentelemetry_span/ OK
testing: .deps/azure_core_tracing_opentelemetry-1.0.0b12-py3-none-any.whl/azure/core/tracing/ext/opentelemetry_span/__init__.py OK
testing: .deps/azure_core_tracing_opentelemetry-1.0.0b12-py3-none-any.whl/azure/core/tracing/ext/opentelemetry_span/_schema.py OK
testing: .deps/azure_core_tracing_opentelemetry-1.0.0b12-py3-none-any.whl/azure/core/tracing/ext/opentelemetry_span/_version.py OK
testing: .deps/azure_core_tracing_opentelemetry-1.0.0b12-py3-none-any.whl/azure/core/tracing/ext/opentelemetry_span/py.typed OK
happy-kitchen-89482
05/30/2025, 3:16 PMhappy-kitchen-89482
05/30/2025, 3:16 PM--layout packed
happy-kitchen-89482
05/30/2025, 3:17 PMglamorous-tiger-7918
05/30/2025, 4:38 PMazure
import from ./custom.pex
. It looks like it has a reference to all the right wheels.
>>> pprint(azure.__path__._path)
['/home/seb/.cache/pex/installed_wheels/0/04478/azure_monitor_opentelemetry-1.6.9-py3-none-any.whl/azure',
'/home/seb/.cache/pex/installed_wheels/0/d44e4/azure_core-1.34.0-py3-none-any.whl/azure',
'/home/seb/.cache/pex/installed_wheels/0/f0420/azure_core_tracing_opentelemetry-1.0.0b12-py3-none-any.whl/azure',
'/home/seb/.cache/pex/installed_wheels/0/cabb3/azure_monitor_opentelemetry_exporter-1.0.0b37-py2.py3-none-any.whl/azure',
'/home/seb/.cache/pex/installed_wheels/0/3ae0d/azure_identity-1.23.0-py3-none-any.whl/azure']
azure_core_tracing_opentelemetry
has the code we are trying to import, but I believe our import ends up in azure_core
, because it also contains the a`azure/core/tracing/ext` path:
Directory /home/seb/.cache/pex/installed_wheels/0/f0420/azure_core_tracing_opentelemetry-1.0.0b12-py3-none-any.whl/azure/core/tracing/ext contains: ['opentelemetry_span']
Directory /home/seb/.cache/pex/installed_wheels/0/d44e4a/azure_core-1.34.0-py3-none-any.whl/azure/core/tracing/ext contains: ['__pycache__', '__init__.py']
It seems to me that python can't tell between these two and the order of paths matters.
However when using pants run ...
>>> pprint(azure.__path__._path)
['/home/seb/.cache/pants/named_caches/pex_root/venvs/1/s/d8411b35/venv/lib/python3.12/site-packages/azure']
and in that path it seems it has combined all the different libraries into a single azure directory
book-builder$ ls -la /home/seb/.cache/pants/named_caches/pex_root/venvs/1/s/d8411b35/venv/lib/python3.12/site-packages | grep azure
drwxr-xr-x 5 seb seb 4096 May 30 12:32 azure
drwxr-xr-x 2 seb seb 4096 May 30 12:32 azure_core-1.34.0.dist-info
drwxr-xr-x 2 seb seb 4096 May 30 12:32 azure_core_tracing_opentelemetry-1.0.0b12.dist-info
drwxr-xr-x 2 seb seb 4096 May 30 12:32 azure_identity-1.23.0.dist-info
drwxr-xr-x 2 seb seb 4096 May 30 12:32 azure_monitor_opentelemetry-1.6.9.dist-info
drwxr-xr-x 2 seb seb 4096 May 30 12:32 azure_monitor_opentelemetry_exporter-1.0.0b37.dist-info
drwxr-xr-x 3 seb seb 4096 May 30 12:32 opentelemetry_resource_detector_azure-0.1.5.dist-info
so then my questions would be; can pex merge these separate wheels into one? should it? can we configure the python azure
path to guide it to the right wheel?happy-kitchen-89482
05/30/2025, 9:31 PM--venv
and --venv-site-packages-copies
for this to workhappy-kitchen-89482
05/30/2025, 9:31 PMhappy-kitchen-89482
05/30/2025, 9:32 PMhappy-kitchen-89482
05/30/2025, 9:32 PMglamorous-tiger-7918
06/02/2025, 2:09 PMkind-knife-49817
06/02/2025, 6:01 PMhappy-kitchen-89482
06/03/2025, 3:38 PMhappy-kitchen-89482
06/03/2025, 3:38 PMhappy-kitchen-89482
06/03/2025, 3:39 PM