dockerfile changes for natten
Browse files- Dockerfile +39 -43
Dockerfile
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
FROM ubuntu:18.04
|
2 |
|
3 |
-
ENV DEBIAN_FRONTEND
|
4 |
|
5 |
# Install system dependencies
|
6 |
RUN apt-get update && apt-get install -y \
|
@@ -11,12 +11,16 @@ RUN apt-get update && apt-get install -y \
|
|
11 |
wget \
|
12 |
curl \
|
13 |
build-essential \
|
14 |
-
|
15 |
-
|
16 |
-
|
|
|
|
|
17 |
libsm6 \
|
18 |
libxext6 \
|
19 |
-
|
|
|
|
|
20 |
libgomp1 \
|
21 |
&& rm -rf /var/lib/apt/lists/*
|
22 |
|
@@ -24,62 +28,54 @@ RUN apt-get update && apt-get install -y \
|
|
24 |
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.8 1 && \
|
25 |
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1
|
26 |
|
|
|
|
|
|
|
27 |
# Create user
|
28 |
RUN useradd -m -u 1000 user
|
29 |
WORKDIR /app
|
30 |
|
31 |
-
#
|
32 |
-
RUN python -m pip install --upgrade pip==21.3.1 setuptools==59.5.0 wheel
|
33 |
-
|
34 |
-
# Install PyTorch CPU (specific version that works with detectron2)
|
35 |
RUN pip install torch==1.9.0+cpu torchvision==0.10.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
|
36 |
|
37 |
-
# Install numpy first (dependency for many packages)
|
38 |
-
RUN pip install numpy==1.21.6
|
39 |
-
|
40 |
-
# Build and install detectron2 from source for compatibility
|
41 |
-
RUN pip install cython pybind11
|
42 |
-
RUN git clone https://github.com/facebookresearch/detectron2.git && \
|
43 |
-
cd detectron2 && \
|
44 |
-
git checkout v0.6 && \
|
45 |
-
pip install -e . && \
|
46 |
-
cd .. && \
|
47 |
-
rm -rf detectron2/.git
|
48 |
-
|
49 |
# Install core dependencies with compatible versions
|
50 |
RUN pip install \
|
|
|
51 |
Pillow==8.3.2 \
|
52 |
opencv-python==4.5.3.56 \
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
scipy==1.7.1 \
|
54 |
scikit-image==0.18.3 \
|
55 |
scikit-learn==1.0.2 \
|
56 |
-
h5py==3.1.0 \
|
57 |
-
shapely==1.7.1 \
|
58 |
-
imutils==0.5.4
|
59 |
-
|
60 |
-
# Install ML dependencies with compatible versions
|
61 |
-
RUN pip install \
|
62 |
timm==0.4.12 \
|
63 |
einops==0.3.2 \
|
64 |
tqdm==4.62.3 \
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
RUN pip install \
|
69 |
-
gradio==3.1.7 \
|
70 |
-
huggingface_hub==0.10.1
|
71 |
-
|
72 |
-
# Install other dependencies
|
73 |
-
RUN pip install \
|
74 |
-
gdown==4.5.1 \
|
75 |
-
wget==3.2 \
|
76 |
-
ftfy==6.0.3 \
|
77 |
regex==2021.11.10 \
|
|
|
78 |
inflect==5.3.0 \
|
79 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
|
81 |
-
#
|
82 |
-
|
|
|
83 |
|
84 |
# Switch to user
|
85 |
USER user
|
@@ -88,7 +84,7 @@ ENV HOME=/home/user PATH=/home/user/.local/bin:$PATH
|
|
88 |
# Copy application
|
89 |
COPY --chown=user:user . /app
|
90 |
|
91 |
-
# CPU environment
|
92 |
ENV CUDA_VISIBLE_DEVICES=""
|
93 |
ENV FORCE_CUDA="0"
|
94 |
ENV OMP_NUM_THREADS=4
|
|
|
1 |
FROM ubuntu:18.04
|
2 |
|
3 |
+
ENV DEBIAN_FRONTEND=noninteractive
|
4 |
|
5 |
# Install system dependencies
|
6 |
RUN apt-get update && apt-get install -y \
|
|
|
11 |
wget \
|
12 |
curl \
|
13 |
build-essential \
|
14 |
+
libssl-dev \
|
15 |
+
libffi-dev \
|
16 |
+
libxml2-dev \
|
17 |
+
libxslt1-dev \
|
18 |
+
zlib1g-dev \
|
19 |
libsm6 \
|
20 |
libxext6 \
|
21 |
+
libxrender-dev \
|
22 |
+
libgl1-mesa-glx \
|
23 |
+
libglib2.0-0 \
|
24 |
libgomp1 \
|
25 |
&& rm -rf /var/lib/apt/lists/*
|
26 |
|
|
|
28 |
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.8 1 && \
|
29 |
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1
|
30 |
|
31 |
+
# Upgrade pip
|
32 |
+
RUN python -m pip install --upgrade pip==22.3.1 setuptools==59.5.0 wheel
|
33 |
+
|
34 |
# Create user
|
35 |
RUN useradd -m -u 1000 user
|
36 |
WORKDIR /app
|
37 |
|
38 |
+
# Install PyTorch CPU first
|
|
|
|
|
|
|
39 |
RUN pip install torch==1.9.0+cpu torchvision==0.10.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
|
40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
# Install core dependencies with compatible versions
|
42 |
RUN pip install \
|
43 |
+
numpy==1.19.5 \
|
44 |
Pillow==8.3.2 \
|
45 |
opencv-python==4.5.3.56 \
|
46 |
+
cython==0.29.24
|
47 |
+
|
48 |
+
# Install detectron2 CPU
|
49 |
+
RUN pip install detectron2==0.6 -f https://dl.fbaipublicfiles.com/detectron2/wheels/cpu/torch1.9/index.html
|
50 |
+
|
51 |
+
# Install compatible versions for Python 3.8
|
52 |
+
RUN pip install \
|
53 |
+
gradio==3.1.7 \
|
54 |
+
huggingface_hub==0.8.1 \
|
55 |
scipy==1.7.1 \
|
56 |
scikit-image==0.18.3 \
|
57 |
scikit-learn==1.0.2 \
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
timm==0.4.12 \
|
59 |
einops==0.3.2 \
|
60 |
tqdm==4.62.3 \
|
61 |
+
imutils==0.5.4 \
|
62 |
+
shapely==1.8.0 \
|
63 |
+
h5py==3.1.0 \
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
regex==2021.11.10 \
|
65 |
+
ftfy==6.0.3 \
|
66 |
inflect==5.3.0 \
|
67 |
+
gdown==4.2.0 \
|
68 |
+
wget==3.2
|
69 |
+
|
70 |
+
# Optional dependencies (skip if causing issues)
|
71 |
+
RUN pip install submitit==1.4.1 || echo "submitit failed"
|
72 |
+
RUN pip install pytorch_lightning==1.5.10 || echo "pytorch_lightning failed"
|
73 |
+
RUN pip install wandb==0.12.9 || echo "wandb failed"
|
74 |
+
RUN pip install icecream==2.1.1 || echo "icecream failed"
|
75 |
|
76 |
+
# Try NATTEN
|
77 |
+
RUN pip install natten==0.14.6 -f https://shi-labs.com/natten/wheels/cpu/torch1.9/index.html || \
|
78 |
+
echo "NATTEN installation failed"
|
79 |
|
80 |
# Switch to user
|
81 |
USER user
|
|
|
84 |
# Copy application
|
85 |
COPY --chown=user:user . /app
|
86 |
|
87 |
+
# CPU environment
|
88 |
ENV CUDA_VISIBLE_DEVICES=""
|
89 |
ENV FORCE_CUDA="0"
|
90 |
ENV OMP_NUM_THREADS=4
|