Spaces:
Runtime error
Runtime error
Commit ·
4f004a4
1
Parent(s): ae3cca0
Fixes for python 3.10
Browse files- Dockerfile +25 -23
Dockerfile
CHANGED
|
@@ -1,14 +1,20 @@
|
|
| 1 |
-
FROM
|
| 2 |
|
| 3 |
-
#
|
| 4 |
-
RUN apt-get update && apt-get
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
-
# Install
|
| 7 |
-
RUN apt-get install -y --no-install-recommends \
|
| 8 |
-
python3.10 \
|
| 9 |
-
python3.10-venv \
|
| 10 |
-
python3.10-dev \
|
| 11 |
-
python3-pip \
|
| 12 |
build-essential \
|
| 13 |
gcc \
|
| 14 |
g++ \
|
|
@@ -20,11 +26,6 @@ RUN apt-get install -y --no-install-recommends \
|
|
| 20 |
elfutils \
|
| 21 |
&& rm -rf /var/lib/apt/lists/*
|
| 22 |
|
| 23 |
-
# Force Python 3.10 as the default and fix pip
|
| 24 |
-
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.10 100 && \
|
| 25 |
-
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 100 && \
|
| 26 |
-
update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 100
|
| 27 |
-
|
| 28 |
# Verify Python version
|
| 29 |
RUN python --version && pip --version
|
| 30 |
|
|
@@ -34,18 +35,19 @@ WORKDIR /code
|
|
| 34 |
COPY requirements.txt .
|
| 35 |
|
| 36 |
# Install Python packages with pip upgrade
|
| 37 |
-
RUN pip install --no-cache-dir --upgrade pip setuptools wheel && \
|
| 38 |
-
pip install --no-cache-dir -r requirements.txt
|
| 39 |
|
| 40 |
-
# Fix executable stack issue in onnxruntime binary
|
| 41 |
-
RUN find /usr/local/lib/python3.10/site-packages/onnxruntime -name "*.so" -type f
|
| 42 |
-
|
|
|
|
| 43 |
|
| 44 |
# Fix CUDA library symlinks for onnxruntime compatibility
|
| 45 |
-
RUN find /usr/local/cuda/lib64 -name "libcublas*" -o -name "libcudnn*" && \
|
| 46 |
-
ln -sf /usr/local/cuda/lib64/libcublasLt.so.12.* /usr/local/cuda/lib64/libcublasLt.so.12 || true && \
|
| 47 |
-
ln -sf /usr/local/cuda/lib64/libcublas.so.12.* /usr/local/cuda/lib64/libcublas.so.12 || true && \
|
| 48 |
-
ln -sf /usr/local/cuda/lib64/libcudart.so.12.* /usr/local/cuda/lib64/libcudart.so.12 || true
|
| 49 |
|
| 50 |
COPY . .
|
| 51 |
|
|
|
|
| 1 |
+
FROM python:3.10-slim
|
| 2 |
|
| 3 |
+
# Add CUDA repository and install CUDA toolkit
|
| 4 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 5 |
+
wget \
|
| 6 |
+
gnupg2 \
|
| 7 |
+
&& wget -qO - https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/3bf863cc.pub | apt-key add - \
|
| 8 |
+
&& echo "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64 /" > /etc/apt/sources.list.d/cuda.list \
|
| 9 |
+
&& apt-get update \
|
| 10 |
+
&& apt-get install -y --no-install-recommends \
|
| 11 |
+
cuda-toolkit-12-4 \
|
| 12 |
+
libcudnn8 \
|
| 13 |
+
libcublas-12-4 \
|
| 14 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 15 |
|
| 16 |
+
# Install build tools and system dependencies
|
| 17 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
build-essential \
|
| 19 |
gcc \
|
| 20 |
g++ \
|
|
|
|
| 26 |
elfutils \
|
| 27 |
&& rm -rf /var/lib/apt/lists/*
|
| 28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
# Verify Python version
|
| 30 |
RUN python --version && pip --version
|
| 31 |
|
|
|
|
| 35 |
COPY requirements.txt .
|
| 36 |
|
| 37 |
# Install Python packages with pip upgrade
|
| 38 |
+
RUN python3.10 -m pip install --no-cache-dir --upgrade pip setuptools wheel && \
|
| 39 |
+
python3.10 -m pip install --no-cache-dir -r requirements.txt
|
| 40 |
|
| 41 |
+
# Fix executable stack issue in onnxruntime binary
|
| 42 |
+
RUN find /usr/local/lib/python3.10/site-packages/onnxruntime -name "*.so" -type f 2>/dev/null | while read f; do \
|
| 43 |
+
execstack -c "$f" 2>/dev/null || true; \
|
| 44 |
+
done || true
|
| 45 |
|
| 46 |
# Fix CUDA library symlinks for onnxruntime compatibility
|
| 47 |
+
RUN find /usr/local/cuda/lib64 -name "libcublas*" -o -name "libcudnn*" 2>/dev/null && \
|
| 48 |
+
ln -sf /usr/local/cuda/lib64/libcublasLt.so.12.* /usr/local/cuda/lib64/libcublasLt.so.12 2>/dev/null || true && \
|
| 49 |
+
ln -sf /usr/local/cuda/lib64/libcublas.so.12.* /usr/local/cuda/lib64/libcublas.so.12 2>/dev/null || true && \
|
| 50 |
+
ln -sf /usr/local/cuda/lib64/libcudart.so.12.* /usr/local/cuda/lib64/libcudart.so.12 2>/dev/null || true
|
| 51 |
|
| 52 |
COPY . .
|
| 53 |
|