Fix permission errors: make chai_lab dirs writable for K8s
K8s runs containers as non-root. Chai-1 tries to download model weights to /opt/conda/.../downloads which fails with PermissionError. Set writable dirs and env vars for matplotlib, HF, and chai downloads. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
12
Dockerfile
12
Dockerfile
@@ -4,7 +4,10 @@ FROM pytorch/pytorch:2.6.0-cuda12.4-cudnn9-runtime
|
|||||||
# Set environment variables
|
# Set environment variables
|
||||||
ENV DEBIAN_FRONTEND=noninteractive \
|
ENV DEBIAN_FRONTEND=noninteractive \
|
||||||
PYTHONUNBUFFERED=TRUE \
|
PYTHONUNBUFFERED=TRUE \
|
||||||
PYTHONFAULTHANDLER=1
|
PYTHONFAULTHANDLER=1 \
|
||||||
|
MPLCONFIGDIR=/tmp/matplotlib \
|
||||||
|
CHAI_DOWNLOADS_DIR=/tmp/chai_downloads \
|
||||||
|
HF_HOME=/tmp/hf_home
|
||||||
|
|
||||||
# Set working directory
|
# Set working directory
|
||||||
WORKDIR /workspace
|
WORKDIR /workspace
|
||||||
@@ -14,6 +17,13 @@ RUN pip install --no-cache-dir \
|
|||||||
chai_lab==0.5.2 \
|
chai_lab==0.5.2 \
|
||||||
"transformers>=4.30.0,<5.0.0"
|
"transformers>=4.30.0,<5.0.0"
|
||||||
|
|
||||||
|
# Make package dirs writable for any user (K8s may run as non-root)
|
||||||
|
RUN chmod -R a+rw /opt/conda/lib/python3.11/site-packages/chai_lab/ && \
|
||||||
|
mkdir -p /opt/conda/lib/python3.11/site-packages/downloads && \
|
||||||
|
chmod -R a+rw /opt/conda/lib/python3.11/site-packages/downloads && \
|
||||||
|
mkdir -p /tmp/chai_downloads /tmp/hf_home /tmp/matplotlib && \
|
||||||
|
chmod -R 777 /tmp/chai_downloads /tmp/hf_home /tmp/matplotlib
|
||||||
|
|
||||||
# Verify installations
|
# Verify installations
|
||||||
RUN python -c "import torch; print(f'PyTorch: {torch.__version__}')" && \
|
RUN python -c "import torch; print(f'PyTorch: {torch.__version__}')" && \
|
||||||
python -c "import transformers; print(f'transformers: {transformers.__version__}')" && \
|
python -c "import transformers; print(f'transformers: {transformers.__version__}')" && \
|
||||||
|
|||||||
Reference in New Issue
Block a user