You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using CrewAI inside of an Open WebUI plugin. When I am trying to setup my Python code that uses Crew AI inside of an open webui function, I get this super bizarre opentelemetry error. This only happens when I run it in a docker container -- not when I am running Open WebUI outside of a docker container, despite having identical Python package versions of just about everything, including Opentelemetry. Any thoughts here?
The error: cannot import name 'SpanFlags' from 'opentelemetry.proto.trace.v1.trace_pb2
The stack trace:
2025-02-28 21:22:48.705 | ERROR | open_webui.utils.plugin:load_function_module_by_id:159 - Error loading module: a: cannot import name 'SpanFlags' from 'opentelemetry.proto.trace.v1.trace_pb2' (/usr/local/lib/python3.11/site-packages/opentelemetry/proto/trace/v1/trace_pb2.py) - {}
2025-02-28 21:22:48.707 | ERROR | open_webui.routers.functions:create_new_function:88 - Failed to create a new function: cannot import name 'SpanFlags' from 'opentelemetry.proto.trace.v1.trace_pb2' (/usr/local/lib/python3.11/site-packages/opentelemetry/proto/trace/v1/trace_pb2.py) - {}
Traceback (most recent call last):
File "/usr/local/bin/uvicorn", line 10, in <module>
sys.exit(main())
$ │ │ └ <Command main>
' │ └ <built-in function exit>
" └ <module 'sys' (built-in)>
File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1161, in __call__
return self.main(*args, **kwargs)
+ │ │ │ └ {}
! │ │ └ ()
D │ └ <function BaseCommand.main at 0xffffa34edda0>
└ <Command main>
File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1082, in main
rv = self.invoke(ctx)
K │ │ └ <click.core.Context object at 0xffffa447c210>
@ │ └ <function Command.invoke at 0xffffa34ee980>
└ <Command main>
File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1443, in invoke
return ctx.invoke(self.callback, **ctx.params)
� │ │ │ │ │ └ {'host': '0.0.0.0', 'port': 8080, 'forwarded_allow_ips': '*', 'app': 'open_webui.main:app', 'uds': None, 'fd': None, 'reload'...
a │ │ │ │ └ <click.core.Context object at 0xffffa447c210>
G │ │ │ └ <function main at 0xffffa314ade0>
- │ │ └ <Command main>
A │ └ <function Context.invoke at 0xffffa34ed300>
= └ <click.core.Context object at 0xffffa447c210>
File "/usr/local/lib/python3.11/site-packages/click/core.py", line 788, in invoke
return __callback(*args, **kwargs)
� │ └ {'host': '0.0.0.0', 'port': 8080, 'forwarded_allow_ips': '*', 'app': 'open_webui.main:app', 'uds': None, 'fd': None, 'reload'...
└ ()
File "/usr/local/lib/python3.11/site-packages/uvicorn/main.py", line 410, in main
run(
) └ <function run at 0xffffa350fce0>
File "/usr/local/lib/python3.11/site-packages/uvicorn/main.py", line 577, in run
server.run()
9 │ └ <function Server.run at 0xffffa3331080>
9 └ <uvicorn.server.Server object at 0xffffa396edd0>
File "/usr/local/lib/python3.11/site-packages/uvicorn/server.py", line 65, in run
return asyncio.run(self.serve(sockets=sockets))
; │ │ │ │ └ None
P │ │ │ └ <function Server.serve at 0xffffa3331120>
P │ │ └ <uvicorn.server.Server object at 0xffffa396edd0>
: │ └ <function run at 0xffffa39b4b80>
W └ <module 'asyncio' from '/usr/local/lib/python3.11/asyncio/__init__.py'>
File "/usr/local/lib/python3.11/asyncio/runners.py", line 190, in run
return runner.run(main)
P │ │ └ <coroutine object Server.serve at 0xffffa311df30>
@ │ └ <function Runner.run at 0xffffa3764720>
A └ <asyncio.runners.Runner object at 0xffffa3157bd0>
File "/usr/local/lib/python3.11/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
� │ │ │ └ <Task pending name='Task-1' coro=<Server.serve() running at /usr/local/lib/python3.11/site-packages/uvicorn/server.py:69> wai...
U │ │ └ <cyfunction Loop.run_until_complete at 0xffffa2c102b0>
J │ └ <uvloop.Loop running=True closed=False debug=False>
A └ <asyncio.runners.Runner object at 0xffffa3157bd0>
File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 141, in coro
await self.app(scope, receive_or_disconnect, send_no_error)
� │ │ │ │ └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.send_no_error at 0xffff23e1fe20>
� │ │ │ └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0xffff23e1fc40>
� │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'server': ('10.88.0.12', 8080), 'c...
d │ └ <starlette.middleware.exceptions.ExceptionMiddleware object at 0xffff642f1390>
L └ <open_webui.main.RedirectMiddleware object at 0xffff282e7850>
File "/usr/local/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 62, in __call__
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
� │ │ │ │ │ │ └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.send_no_error at 0xffff23e1fe20>
� │ │ │ │ │ └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0xffff23e1fc40>
� │ │ │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'server': ('10.88.0.12', 8080), 'c...
q │ │ │ └ <starlette.requests.Request object at 0xffff23eccb10>
i │ │ └ <fastapi.routing.APIRouter object at 0xffff5de1ddd0>
| │ └ <starlette.middleware.exceptions.ExceptionMiddleware object at 0xffff642f1390>
H └ <function wrap_app_handling_exceptions at 0xffffa01b65c0>
File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
await app(scope, receive, sender)
� │ │ │ └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0xffff23e1fce0>
� │ │ └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0xffff23e1fc40>
� │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'server': ('10.88.0.12', 8080), 'c...
C └ <fastapi.routing.APIRouter object at 0xffff5de1ddd0>
File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 715, in __call__
await self.middleware_stack(scope, receive, send)
� │ │ │ │ └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0xffff23e1fce0>
� │ │ │ └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0xffff23e1fc40>
� │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'server': ('10.88.0.12', 8080), 'c...
g │ └ <bound method Router.app of <fastapi.routing.APIRouter object at 0xffff5de1ddd0>>
C └ <fastapi.routing.APIRouter object at 0xffff5de1ddd0>
File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 735, in app
await route.handle(scope, receive, send)
� │ │ │ │ └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0xffff23e1fce0>
� │ │ │ └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0xffff23e1fc40>
� │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'server': ('10.88.0.12', 8080), 'c...
@ │ └ <function Route.handle at 0xffffa01b7c40>
f └ APIRoute(path='/api/v1/functions/create', name='create_new_function', methods=['POST'])
File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 288, in handle
await self.app(scope, receive, send)
� │ │ │ │ └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0xffff23e1fce0>
� │ │ │ └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0xffff23e1fc40>
� │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'server': ('10.88.0.12', 8080), 'c...
P │ └ <function request_response.<locals>.app at 0xffff2814c220>
f └ APIRoute(path='/api/v1/functions/create', name='create_new_function', methods=['POST'])
File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 76, in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
� │ │ │ │ │ └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0xffff23e1fce0>
� │ │ │ │ └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0xffff23e1fc40>
� │ │ │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'server': ('10.88.0.12', 8080), 'c...
j │ │ └ <starlette.requests.Request object at 0xffff23ecc110>
u │ └ <function request_response.<locals>.app.<locals>.app at 0xffff23e1d940>
H └ <function wrap_app_handling_exceptions at 0xffffa01b65c0>
File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 42, in wrapped_app
await app(scope, receive, sender)
� │ │ │ └ <function wrap_app_handling_exceptions.<locals>.wrapped_app.<locals>.sender at 0xffff23e1fba0>
� │ │ └ <function BaseHTTPMiddleware.__call__.<locals>.call_next.<locals>.receive_or_disconnect at 0xffff23e1fc40>
� │ └ {'type': 'http', 'asgi': {'version': '3.0', 'spec_version': '2.4'}, 'http_version': '1.1', 'server': ('10.88.0.12', 8080), 'c...
V └ <function request_response.<locals>.app.<locals>.app at 0xffff23e1d940>
File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 73, in app
response = await f(request)
S │ └ <starlette.requests.Request object at 0xffff23ecc110>
W └ <function get_request_handler.<locals>.app at 0xffff2814cf40>
File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 301, in app
raw_response = await run_endpoint_function(
P └ <function run_endpoint_function at 0xffffa0401a80>
File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 212, in run_endpoint_function
return await dependant.call(**values)
� │ │ └ {'user': UserModel(id='94c5f253-0813-4290-8a56-fbbc83414a53', name='k', email='[email protected]', role='admin', profile_image...
R │ └ <function create_new_function at 0xffff5f14f7e0>
� └ Dependant(path_params=[], query_params=[], header_params=[], cookie_params=[], body_params=[ModelField(field_info=Body(Pydant...
> File "/app/backend/open_webui/routers/functions.py", line 66, in create_new_function
function_module, function_type, frontmatter = load_function_module_by_id(
n └ <function load_function_module_by_id at 0xffff5f4f0f40>
File "/app/backend/open_webui/utils/plugin.py", line 163, in load_function_module_by_id
raise e
File "/app/backend/open_webui/utils/plugin.py", line 145, in load_function_module_by_id
exec(content, module.__dict__)
I │ │ └ <member '__dict__' of 'module' objects>
F │ └ <module 'function_a' from '/tmp/tmpf64t81of'>
� └ '"""\nrequirements: crewai==0.102.0, crewai-tools==0.33.0\n"""\n\nimport logging\nfrom typing import Optional, Callable, Awai...
File "<string>", line 8, in <module>
File "/usr/local/lib/python3.11/site-packages/crewai/__init__.py", line 3, in <module>
from crewai.agent import Agent
File "/usr/local/lib/python3.11/site-packages/crewai/agent.py", line 10, in <module>
from crewai.agents.crew_agent_executor import CrewAgentExecutor
File "/usr/local/lib/python3.11/site-packages/crewai/agents/crew_agent_executor.py", line 18, in <module>
from crewai.tools.tool_usage import ToolUsage, ToolUsageErrorException
File "/usr/local/lib/python3.11/site-packages/crewai/tools/tool_usage.py", line 15, in <module>
from crewai.task import Task
File "/usr/local/lib/python3.11/site-packages/crewai/task.py", line 39, in <module>
from crewai.telemetry.telemetry import Telemetry
File "/usr/local/lib/python3.11/site-packages/crewai/telemetry/__init__.py", line 1, in <module>
from .telemetry import Telemetry
File "/usr/local/lib/python3.11/site-packages/crewai/telemetry/telemetry.py", line 21, in <module>
from opentelemetry.exporter.otlp.proto.http.trace_exporter import (
� File "/usr/local/lib/python3.11/site-packages/opentelemetry/exporter/otlp/proto/http/trace_exporter/__init__.py", line 28, in <module>
from opentelemetry.exporter.otlp.proto.common.trace_encoder import (
� File "/usr/local/lib/python3.11/site-packages/opentelemetry/exporter/otlp/proto/common/trace_encoder.py", line 16, in <module>
from opentelemetry.exporter.otlp.proto.common._internal.trace_encoder import (
� File "/usr/local/lib/python3.11/site-packages/opentelemetry/exporter/otlp/proto/common/_internal/trace_encoder/__init__.py", line 34, in <module>
from opentelemetry.proto.trace.v1.trace_pb2 import SpanFlags as PB2SpanFlags
�ImportError: cannot import name 'SpanFlags' from 'opentelemetry.proto.trace.v1.trace_pb2' (/usr/local/lib/python3.11/site-packages/opentelemetry/proto/trace/v1/trace_pb2.py)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am using CrewAI inside of an Open WebUI plugin. When I am trying to setup my Python code that uses Crew AI inside of an open webui function, I get this super bizarre opentelemetry error. This only happens when I run it in a docker container -- not when I am running Open WebUI outside of a docker container, despite having identical Python package versions of just about everything, including Opentelemetry. Any thoughts here?
The error:
cannot import name 'SpanFlags' from 'opentelemetry.proto.trace.v1.trace_pb2
The stack trace:
Beta Was this translation helpful? Give feedback.
All reactions