Summary
Since v4.20.5, weaviate-client imports from packaging import version at module load (in weaviate/exceptions.py) but packaging is not declared in the project's install requirements. In environments that don't already have packaging installed transitively, every import weaviate raises ModuleNotFoundError: No module named 'packaging'.
This is most visible in slim/minimal Python container images (e.g. python:3.12-slim, python:3.14-slim), where packaging is not preinstalled.
Reproduction
FROM python:3.12.8-slim
RUN pip install --no-cache-dir weaviate-client==4.21.0
RUN python -c "import weaviate"
Result:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/lib/python3.12/site-packages/weaviate/__init__.py", line 13, in <module>
from . import (
File "/usr/local/lib/python3.12/site-packages/weaviate/backup/__init__.py", line 3, in <module>
from .async_ import _BackupAsync
File "/usr/local/lib/python3.12/site-packages/weaviate/backup/async_.py", line 1, in <module>
from weaviate.backup.executor import _BackupExecutor
File "/usr/local/lib/python3.12/site-packages/weaviate/backup/executor.py", line 20, in <module>
from weaviate.connect import executor
File "/usr/local/lib/python3.12/site-packages/weaviate/connect/__init__.py", line 3, in <module>
from .base import ConnectionParams, ProtocolParams
File "/usr/local/lib/python3.12/site-packages/weaviate/connect/base.py", line 13, in <module>
from weaviate.util import is_weaviate_domain
File "/usr/local/lib/python3.12/site-packages/weaviate/util.py", line 19, in <module>
from weaviate.exceptions import (
File "/usr/local/lib/python3.12/site-packages/weaviate/exceptions.py", line 9, in <module>
from packaging import version
ModuleNotFoundError: No module named 'packaging'
Reproducible on weaviate-client==4.20.5, 4.20.6, ..., 4.21.0. Not reproducible on weaviate-client==4.20.4 and earlier.
Suspected cause
In v4.20.5, PR #1999 dropped the unmaintained deprecation dependency in favor of stdlib (fix(deps): remove unmaintained deprecation package, use stdlib instead).
The deprecation package depends on packaging. When it was removed from weaviate-client's declared deps, packaging was no longer reaching the install environment transitively — but weaviate/exceptions.py still imports packaging.version directly.
Expected behavior
packaging should be declared as a direct dependency of weaviate-client (in pyproject.toml / setup.py), so any environment that installs weaviate-client gets packaging automatically.
Why this slips through CI
Most CI environments already have packaging installed because pip itself depends on it, or because an unrelated package in the test env pulls it in transitively. The bug only surfaces in minimal Python images where import weaviate is the first thing that needs packaging.
Workaround
Add packaging explicitly to your own requirements file:
weaviate-client==4.21.0
packaging>=23.0
Suggested fix
Add to pyproject.toml:
[project]
dependencies = [
...
"packaging>=21.0", # used in weaviate.exceptions
]
Happy to send a PR if that helps.
Summary
Since v4.20.5,
weaviate-clientimportsfrom packaging import versionat module load (inweaviate/exceptions.py) butpackagingis not declared in the project's install requirements. In environments that don't already havepackaginginstalled transitively, everyimport weaviateraisesModuleNotFoundError: No module named 'packaging'.This is most visible in slim/minimal Python container images (e.g.
python:3.12-slim,python:3.14-slim), wherepackagingis not preinstalled.Reproduction
Result:
Reproducible on
weaviate-client==4.20.5,4.20.6, ...,4.21.0. Not reproducible onweaviate-client==4.20.4and earlier.Suspected cause
In v4.20.5, PR #1999 dropped the unmaintained
deprecationdependency in favor of stdlib (fix(deps): remove unmaintained deprecation package, use stdlib instead).The
deprecationpackage depends onpackaging. When it was removed fromweaviate-client's declared deps,packagingwas no longer reaching the install environment transitively — butweaviate/exceptions.pystill importspackaging.versiondirectly.Expected behavior
packagingshould be declared as a direct dependency ofweaviate-client(inpyproject.toml/setup.py), so any environment that installsweaviate-clientgetspackagingautomatically.Why this slips through CI
Most CI environments already have
packaginginstalled because pip itself depends on it, or because an unrelated package in the test env pulls it in transitively. The bug only surfaces in minimal Python images whereimport weaviateis the first thing that needspackaging.Workaround
Add
packagingexplicitly to your own requirements file:Suggested fix
Add to
pyproject.toml:Happy to send a PR if that helps.