ImportError: cannot import name '_ExtendedAttributes' from 'opentelemetry.util.types'

未关闭
#4,811 5 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
25/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
停滞
技术栈
azure, python

调研方向

从 requirements.txt 中的版本以及 opentelemetry/exporter/otlp/proto/common/_internal/init.py 和 opentelemetry/util/types.py 中 traceback 的入口点开始。在 Python 3.13 的 Azure 风格环境中重现导入失败,然后确定固定版本的 OpenTelemetry 软件包是否彼此兼容;当 Chainlit 启动命令能够在不出现此错误的情况下成功导入时,即视为完成。

由索引模型根据 Issue 内容生成。

描述

bug
Describe your environment

OS: Linux
Python version: 3.13
SDK version: 1.38.0
API version: 1.38.0

What happened?

I'm facing the same exact issue described on a previous issue https://github.com/open-telemetry/opentelemetry-python/issues/4698

When publishing a python web app on azure i get the following error _"ImportError: cannot import name 'ExtendedAttributes' from 'opentelemetry.util.types'".

Steps to Reproduce

create a app.py file with the following code

import chainlit as cl

@cl.on_message
async def main(message: cl.Message):
    # Your custom logic goes here...

    # Send a response back to the user
    await cl.Message(
        content=f"Received: {message.content}",
    ).send()

this is the content of requirements.txt

chainlit

publish to azure web app with startup command "chainlit run app.py", and then the mentioned error occurs

Expected Result

no error regarding the import

Actual Result
Connected!
2025-11-19T16:39:44.760417754Z     _____
2025-11-19T16:39:44.760462270Z    /  _  \ __________ _________   ____
2025-11-19T16:39:44.760465700Z   /  /_\  \\___   /  |  \_  __ \_/ __ \
2025-11-19T16:39:44.760468104Z  /    |    \/    /|  |  /|  | \/\  ___/
2025-11-19T16:39:44.760470152Z  \____|__  /_____ \____/ |__|    \___  >
2025-11-19T16:39:44.760472939Z          \/      \/                  \/
2025-11-19T16:39:44.760474933Z  A P P   S E R V I C E   O N   L I N U X
2025-11-19T16:39:44.760476876Z
2025-11-19T16:39:44.760478635Z  Documentation    : http://aka.ms/webapp-linux
2025-11-19T16:39:44.760480650Z  Python quickstart: https://aka.ms/python-qs
2025-11-19T16:39:44.760482617Z  Python version   : 3.13.8
2025-11-19T16:39:44.760484602Z  Instance Name    : ......
2025-11-19T16:39:44.760486581Z  Instance Id      : .......
2025-11-19T16:39:44.760488644Z
2025-11-19T16:39:44.760490431Z  Note: Any data outside '/home' is not persisted
2025-11-19T16:39:47.009221736Z  Starting OpenBSD Secure Shell server: sshd.
2025-11-19T16:39:47.023552521Z  WEBSITES_INCLUDE_CLOUD_CERTS is not set to true.
2025-11-19T16:39:47.055093829Z  Updating certificates in /etc/ssl/certs...
2025-11-19T16:39:59.381429905Z  rehash: warning: skipping duplicate certificate in azl_SSL.com_TLS_ECC_Root_CA_2022.pem
2025-11-19T16:39:59.381485567Z  rehash: warning: skipping duplicate certificate in azl_SSL.com_TLS_RSA_Root_CA_2022.pem
2025-11-19T16:39:59.607221791Z  rehash: warning: skipping ca-certificates.crt,it does not contain exactly one certificate or CRL
2025-11-19T16:39:59.639143114Z  4 added, 0 removed; done.
2025-11-19T16:39:59.639696215Z  Running hooks in /etc/ca-certificates/update.d...
2025-11-19T16:39:59.649180317Z  done.
2025-11-19T16:39:59.666629622Z  CA certificates copied and updated successfully.
2025-11-19T16:39:59.727779800Z  Site's appCommandLine: chainlit run app.py --headless --host 0.0.0.0 --port 8000 --no-cache
2025-11-19T16:39:59.727822159Z  Launching oryx with: create-script -appPath /home/site/wwwroot -output /opt/startup/startup.sh -virtualEnvName antenv -defaultApp /opt/defaultsite -userStartupCommand 'chainlit run app.py --headless --host 0.0.0.0 --port 8000 --no-cache'
2025-11-19T16:39:59.788402346Z  Found build manifest file at '/home/site/wwwroot/oryx-manifest.toml'. Deserializing it...
2025-11-19T16:39:59.792693843Z  Build Operation ID: d45a0d2a4b4136ff
2025-11-19T16:39:59.794845285Z  Oryx Version: 0.2.20251017.2, Commit: 482d4c55e818733ab33b9d2131f9dc485a21fd03, ReleaseTagName: 20251017.2
2025-11-19T16:39:59.795131180Z  Output is compressed. Extracting it...
2025-11-19T16:39:59.797776530Z  Extracting '/home/site/wwwroot/output.tar.gz' to directory '/tmp/8de2789981789ab'...
2025-11-19T16:40:13.982955260Z  App path is set to '/tmp/8de2789981789ab'
2025-11-19T16:40:13.987692381Z  Writing output script to '/opt/startup/startup.sh'
2025-11-19T16:40:19.218828594Z  Using packages from virtual environment antenv located at /tmp/8de2789981789ab/antenv.
2025-11-19T16:40:19.218855184Z  Updated PYTHONPATH to '/agents/python:/opt/startup/app_logs:/tmp/8de2789981789ab/antenv/lib/python3.13/site-packages'
2025-11-19T16:40:42.231390866Z  Traceback (most recent call last):
2025-11-19T16:40:42.232232336Z    File "/tmp/8de2789981789ab/antenv/bin/chainlit", line 3, in <module>
2025-11-19T16:40:42.232244016Z      from chainlit.cli import cli
2025-11-19T16:40:42.232246585Z    File "/tmp/8de2789981789ab/antenv/lib/python3.13/site-packages/chainlit/__init__.py", line 18, in <module>
2025-11-19T16:40:42.232248990Z      from literalai import ChatGeneration, CompletionGeneration, GenerationMessage
2025-11-19T16:40:42.233040097Z    File "/tmp/8de2789981789ab/antenv/lib/python3.13/site-packages/literalai/__init__.py", line 1, in <module>
2025-11-19T16:40:42.233449544Z      from literalai.client import AsyncLiteralClient, LiteralClient
2025-11-19T16:40:42.233453153Z    File "/tmp/8de2789981789ab/antenv/lib/python3.13/site-packages/literalai/client.py", line 7, in <module>
2025-11-19T16:40:42.233455718Z      from traceloop.sdk import Traceloop
2025-11-19T16:40:42.233457816Z    File "/tmp/8de2789981789ab/antenv/lib/python3.13/site-packages/traceloop/sdk/__init__.py", line 17, in <module>
2025-11-19T16:40:42.233460268Z      from traceloop.sdk.metrics.metrics import MetricsWrapper
2025-11-19T16:40:42.233462592Z    File "/tmp/8de2789981789ab/antenv/lib/python3.13/site-packages/traceloop/sdk/metrics/metrics.py", line 4, in <module>
2025-11-19T16:40:42.233464922Z      from opentelemetry.exporter.otlp.proto.grpc.metric_exporter import (
2025-11-19T16:40:42.233467099Z          OTLPMetricExporter as GRPCExporter,
2025-11-19T16:40:42.233469276Z      )
2025-11-19T16:40:42.233471255Z    File "/tmp/8de2789981789ab/antenv/lib/python3.13/site-packages/opentelemetry/exporter/otlp/proto/grpc/metric_exporter/__init__.py", line 23, in <module>
2025-11-19T16:40:42.233473530Z      from opentelemetry.exporter.otlp.proto.common._internal.metrics_encoder import (
2025-11-19T16:40:42.233475591Z          OTLPMetricExporterMixin,
2025-11-19T16:40:42.234708849Z      )
2025-11-19T16:40:42.235135948Z    File "/tmp/8de2789981789ab/antenv/lib/python3.13/site-packages/opentelemetry/exporter/otlp/proto/common/_internal/__init__.py", line 46, in <module>
2025-11-19T16:40:42.235144416Z      from opentelemetry.util.types import _ExtendedAttributes
2025-11-19T16:40:42.235146691Z  ImportError: cannot import name '_ExtendedAttributes' from 'opentelemetry.util.types' **(/agents/python/opentelemetry/util/types.py)**
Additional context

this is the full requirements.txt after the virtual environment has been created

aiofiles==24.1.0 aiohappyeyeballs==2.6.1 aiohttp==3.13.2 aiosignal==1.4.0 annotated-doc==0.0.4 annotated-types==0.7.0 anthropic==0.74.0 anyio==4.11.0 asyncer==0.0.10 attrs==25.4.0 backoff==2.2.1 bidict==0.23.1 certifi==2025.11.12 cffi==2.0.0 chainlit==2.9.0 charset-normalizer==3.4.4 chevron==0.14.0 click==8.3.1 colorama==0.4.6 cryptography==46.0.3 cuid==0.4 dataclasses-json==0.6.7 Deprecated==1.3.1 distro==1.9.0 docstring_parser==0.17.0 fastapi==0.121.2 filelock==3.20.0 filetype==1.2.0 frozenlist==1.8.0 fsspec==2025.10.0 googleapis-common-protos==1.72.0 grpcio==1.76.0 h11==0.16.0 hf-xet==1.2.0 httpcore==1.0.9 httpx==0.28.1 httpx-sse==0.4.3 huggingface_hub==1.1.4 idna==3.11 importlib_metadata==8.7.0 inflection==0.5.1 Jinja2==3.1.6 jiter==0.12.0 jsonschema==4.25.1 jsonschema-specifications==2025.9.1 Lazify==0.4.0 literalai==0.1.201 MarkupSafe==3.0.3 marshmallow==3.26.1 mcp==1.21.2 monotonic==1.6 multidict==6.7.0 mypy_extensions==1.1.0 nest-asyncio==1.6.0 opentelemetry-api==1.38.0 opentelemetry-exporter-otlp-proto-common==1.38.0 opentelemetry-exporter-otlp-proto-grpc==1.38.0 opentelemetry-exporter-otlp-proto-http==1.38.0 opentelemetry-instrumentation==0.59b0 opentelemetry-instrumentation-alephalpha==0.48.1 opentelemetry-instrumentation-anthropic==0.48.1 opentelemetry-instrumentation-bedrock==0.48.1 opentelemetry-instrumentation-chromadb==0.48.1 opentelemetry-instrumentation-cohere==0.48.1 opentelemetry-instrumentation-crewai==0.48.1 opentelemetry-instrumentation-google-generativeai==0.48.1 opentelemetry-instrumentation-groq==0.48.1 opentelemetry-instrumentation-haystack==0.48.1 opentelemetry-instrumentation-lancedb==0.48.1 opentelemetry-instrumentation-langchain==0.48.1 opentelemetry-instrumentation-llamaindex==0.48.1 opentelemetry-instrumentation-logging==0.59b0 opentelemetry-instrumentation-marqo==0.48.1 opentelemetry-instrumentation-mcp==0.48.1 opentelemetry-instrumentation-milvus==0.48.1 opentelemetry-instrumentation-mistralai==0.48.1 opentelemetry-instrumentation-ollama==0.48.1 opentelemetry-instrumentation-openai==0.48.1 opentelemetry-instrumentation-openai-agents==0.48.1 opentelemetry-instrumentation-pinecone==0.48.1 opentelemetry-instrumentation-qdrant==0.48.1 opentelemetry-instrumentation-redis==0.59b0 opentelemetry-instrumentation-replicate==0.48.1 opentelemetry-instrumentation-requests==0.59b0 opentelemetry-instrumentation-sagemaker==0.48.1 opentelemetry-instrumentation-sqlalchemy==0.59b0 opentelemetry-instrumentation-threading==0.59b0 opentelemetry-instrumentation-together==0.48.1 opentelemetry-instrumentation-transformers==0.48.1 opentelemetry-instrumentation-urllib3==0.59b0 opentelemetry-instrumentation-vertexai==0.48.1 opentelemetry-instrumentation-watsonx==0.48.1 opentelemetry-instrumentation-weaviate==0.48.1 opentelemetry-instrumentation-writer==0.48.1 opentelemetry-proto==1.38.0 opentelemetry-sdk==1.38.0 opentelemetry-semantic-conventions==0.59b0 opentelemetry-semantic-conventions-ai==0.4.13 opentelemetry-util-http==0.59b0 packaging==25.0 posthog==3.25.0 propcache==0.4.1 protobuf==6.33.1 pycparser==2.23 pydantic==2.12.4 pydantic-settings==2.12.0 pydantic_core==2.41.5 PyJWT==2.10.1 python-dateutil==2.9.0.post0 python-dotenv==1.2.1 python-engineio==4.12.3 python-multipart==0.0.20 python-socketio==5.14.3 pywin32==311 PyYAML==6.0.3 referencing==0.37.0 requests==2.32.5 rpds-py==0.29.0 shellingham==1.5.4 simple-websocket==1.1.0 six==1.17.0 sniffio==1.3.1 sse-starlette==3.0.3 starlette==0.49.3 syncer==2.0.3 tenacity==9.1.2 tokenizers==0.22.1 tomli==2.3.0 tqdm==4.67.1 traceloop-sdk==0.48.1 typer-slim==0.20.0 typing-inspect==0.9.0 typing-inspection==0.4.2 typing_extensions==4.15.0 urllib3==2.5.0 uvicorn==0.38.0 watchfiles==0.24.0 wrapt==1.17.3 wsproto==1.3.1 yarl==1.22.0 zipp==3.23.0

Would you like to implement a fix?

None

Tip

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.

主要语言
Python
星标
2.7k
派生
1.1k
平均合并
3 天 12 小时
30 天内合并 PR
16

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

open-telemetry/opentelemetry-python 的其他 Issue

查看 open-telemetry/opentelemetry-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。