-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fix Dockerfile to install chromadb from local wheel instead of PyPI #5841
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Fix Dockerfile to install chromadb from local wheel instead of PyPI #5841
Conversation
Changes pip install to use direct wheel path (target/wheels/chromadb*.whl) instead of --find-links flag which only provides a preference hint. Previously, despite --find-links suggesting the local directory, pip could still download chromadb from PyPI. This ensures the locally-built wheel is always used during Docker image builds. Fixes chroma-core#5835
Reviewer ChecklistPlease leverage this checklist to ensure your code review is thorough before approving Testing, Bugs, Errors, Logs, Documentation
System Compatibility
Quality
|
|
Ensure Docker installs local Replaces the Key Changes• Deleted Affected Areas• This summary was automatically generated by @propel-code-bot |
| RUN python3 -m maturin build | ||
| RUN pip uninstall chromadb -y | ||
| RUN pip install --prefix="/install" --find-links target/wheels/ --upgrade chromadb | ||
| RUN pip install --prefix="/install" target/wheels/chromadb*.whl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[BestPractice]
The wildcard pattern target/wheels/chromadb*.whl could fail if multiple wheel files exist or no wheel files are found. If maturin build produces multiple wheels (e.g., for different Python versions) or fails to create any wheels, this command will either install the wrong version or fail entirely.
Consider being more explicit:
RUN pip install --prefix="/install" target/wheels/chromadb-*.whlOr add error handling:
RUN pip install --prefix="/install" target/wheels/chromadb*.whl || (echo "No chromadb wheel found in target/wheels/" && exit 1)Context for Agents
[**BestPractice**]
The wildcard pattern `target/wheels/chromadb*.whl` could fail if multiple wheel files exist or no wheel files are found. If `maturin build` produces multiple wheels (e.g., for different Python versions) or fails to create any wheels, this command will either install the wrong version or fail entirely.
Consider being more explicit:
```dockerfile
RUN pip install --prefix="/install" target/wheels/chromadb-*.whl
```
Or add error handling:
```dockerfile
RUN pip install --prefix="/install" target/wheels/chromadb*.whl || (echo "No chromadb wheel found in target/wheels/" && exit 1)
```
File: Dockerfile
Line: 52
Summary
Fixes the Dockerfile to ensure chromadb is installed from the locally-built wheel instead of potentially downloading from PyPI.
Problem
The current Dockerfile uses
--find-links target/wheels/which only provides a preference hint to pip. Despite this flag, pip can still download chromadb from the public PyPI repository instead of using the locally-built wheel.Current problematic line (Line 52):
Solution
Changed to directly specify the local wheel file path:
This explicitly installs from the locally-built wheel files, eliminating ambiguity and ensuring the Docker build uses the local code.
Impact
Testing
The fix follows standard Docker/pip best practices for installing from local wheel files. The wildcard pattern
chromadb*.whlwill match the wheel built bymaturin buildin the previous step.Fixes #5835