<@ULVA73B9P> pip show prefect returns the list of ...
# marvin-ai
i
@Marvin pip show prefect returns the list of libraries without importlib_metadata. It is, however, used in prefect, at lease in workers/base.py without conditions. So
prefect version
fails Name: prefect Version: 3.6.28 Summary: Workflow orchestration and management. Home-page: Author: Author-email: "Prefect Technologies, Inc." <help@prefect.io> License: Apache-2.0 Location: /nfs/ub-03/iramskyi/Projects/Prefect/venv/lib/python3.10/site-packages Requires: aiosqlite, alembic, amplitude-analytics, anyio, apprise, asgi-lifespan, asyncpg, cachetools, click, cloudpickle, coolname, cryptography, cyclopts, dateparser, docker, exceptiongroup, fastapi, fsspec, graphviz, griffe, httpcore, httpx, humanize, jinja2, jinja2-humanize-extension, jsonpatch, jsonschema, opentelemetry-api, orjson, packaging, pathspec, pendulum, pluggy, prometheus-client, pydantic, pydantic-core, pydantic-extra-types, pydantic-settings, pydocket, python-dateutil, python-slugify, pytz, pyyaml, readchar, rfc3339-validator, rich, ruamel-yaml, ruamel-yaml-clib, semver, sniffio, sqlalchemy, toml, typing-extensions, uvicorn, websockets Required-by:
m
thought for 176.7 seconds
Yes — this looks like a real bug in Prefect
3.6.28
. What’s happening Prefect
3.6.28
imports
importlib_metadata
directly in
prefect/workers/base.py
, but that package is not listed as an install requirement. On Python
3.10
, that’s especially incorrect because the stdlib module
importlib.metadata
should be used instead. The problematic import is effectively:
Copy code
from importlib_metadata import distributions
But for Python 3.10+, it should be:
Copy code
from importlib.metadata import distributions
Why
prefect version
can fail
Although
prefect version
itself uses the stdlib import correctly in the CLI code, importing other Prefect modules can still trigger the bad import path from
workers/base.py
, causing the command to fail if
importlib_metadata
is not installed. Confirmed status This was fixed upstream in Prefect `3.7.2`: PR #22012 - use stdlib importlib.metadata instead of importlib_metadata backport Recommended fix Upgrade Prefect:
Copy code
pip install --upgrade 'prefect>=3.7.2'
Temporary workaround If you need to stay on
3.6.28
, install the backport explicitly:
Copy code
pip install importlib-metadata
Summary -
prefect 3.6.28
has an undeclared dependency bug -
importlib_metadata
is imported unconditionally in
workers/base.py
- On Python
3.10+
, this should use
importlib.metadata
- Fixed in
3.7.2+
If you want, I can also help you identify the exact import chain that makes
prefect version
hit
workers/base.py
in your environment.