I’m trying to deploy my application on LangGraph Cloud but running into issues with pymilvus library. The deployment keeps failing with this error:
ModuleNotFoundError: No module named 'pkg_resources'
The problem seems to be that pymilvus needs pkg_resources which it imports like this:
from pkg_resources import get_distribution
Looking at the error traceback, I can see it’s failing right in the pymilvus client initialization:
File "/usr/local/lib/python3.11/site-packages/pymilvus/client/__init__.py", line 6, in <module>
from pkg_resources import DistributionNotFound, get_distribution
ModuleNotFoundError: No module named 'pkg_resources'
From what I can tell in the build logs, the Docker image strips out setuptools and related packages during the build process:
#7 [langgraph-api 3/12] RUN pip uninstall -y pip wheel && \
rm -rf /usr/local/lib/python*/site-packages/pip* \
/usr/local/lib/python*/site-packages/wheel* && \
find /usr/local/bin -name "pip*" -delete
I think setuptools gets removed too which breaks pkg_resources availability.
Since I can’t modify the deployment Docker setup myself, what are my options here? Is there a way to keep setuptools available at runtime or maybe work around this dependency issue with pymilvus? Would really appreciate any suggestions on how to handle this.