lolout1 commited on
Commit
af4e571
·
1 Parent(s): 18d079d

dockerfile changes for natten

Browse files
Files changed (1) hide show
  1. Dockerfile +50 -51
Dockerfile CHANGED
@@ -4,83 +4,82 @@ ENV DEBIAN_FRONTEND noninteractive
4
 
5
  # Install system dependencies
6
  RUN apt-get update && apt-get install -y \
7
- git \
8
  python3.8 \
9
  python3.8-dev \
10
  python3-pip \
11
- python3.8-distutils \
12
- build-essential \
13
- cmake \
14
  wget \
15
  curl \
 
 
16
  libgl1-mesa-glx \
17
  libglib2.0-0 \
18
  libsm6 \
19
  libxext6 \
20
- libxrender-dev \
21
  libgomp1 \
22
- libgcc-7-dev \
23
  && rm -rf /var/lib/apt/lists/*
24
 
25
  # Set python3.8 as default
26
  RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.8 1 && \
27
- update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1 && \
28
- update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1
29
 
30
  # Create user
31
  RUN useradd -m -u 1000 user
32
  WORKDIR /app
33
 
34
- # Install pip for python3.8
35
- RUN python -m pip install --upgrade pip==22.3.1 setuptools wheel
36
 
37
- # Install PyTorch CPU with specific versions that work with detectron2
38
- RUN pip install --no-cache-dir \
39
- torch==1.9.0+cpu \
40
- torchvision==0.10.0+cpu \
41
- torchaudio==0.9.0 \
42
- -f https://download.pytorch.org/whl/torch_stable.html
43
 
44
- # Install numpy and other core dependencies
45
- RUN pip install --no-cache-dir \
46
- numpy==1.21.6 \
47
- Pillow==8.3.2 \
48
- cython==0.29.35 \
49
- pycocotools
50
 
51
- # Install detectron2 - using the exact URL that works
52
- RUN pip install --no-cache-dir \
53
- detectron2==0.6 \
54
- -f https://dl.fbaipublicfiles.com/detectron2/wheels/cpu/torch1.9/index.html
 
 
 
 
55
 
56
- # Install OpenCV and other dependencies
57
- RUN pip install --no-cache-dir \
58
- opencv-python==4.5.5.64 \
59
- scipy==1.7.3 \
60
- scikit-image==0.19.3 \
 
61
  scikit-learn==1.0.2 \
62
- matplotlib==3.5.3
 
 
63
 
64
- # Install gradio and other packages
65
- RUN pip install --no-cache-dir \
66
- gradio==3.35.2 \
67
  timm==0.4.12 \
68
- einops==0.6.1 \
69
- tqdm==4.64.1 \
70
- huggingface_hub==0.14.8 \
71
- imutils==0.5.4 \
72
- shapely==1.8.5 \
73
- h5py==3.7.0
74
-
75
- # Install remaining packages (skip problematic ones)
76
- RUN pip install --no-cache-dir \
77
- icecream==2.1.3 \
78
- ftfy==6.1.1 \
79
- regex==2022.10.31 \
80
- inflect==6.0.4 \
81
- gdown==4.5.4 \
82
  wget==3.2 \
83
- submitit==1.4.5 || true
 
 
 
 
 
 
84
 
85
  # Switch to user
86
  USER user
@@ -89,7 +88,7 @@ ENV HOME=/home/user PATH=/home/user/.local/bin:$PATH
89
  # Copy application
90
  COPY --chown=user:user . /app
91
 
92
- # Set environment variables
93
  ENV CUDA_VISIBLE_DEVICES=""
94
  ENV FORCE_CUDA="0"
95
  ENV OMP_NUM_THREADS=4
 
4
 
5
  # Install system dependencies
6
  RUN apt-get update && apt-get install -y \
 
7
  python3.8 \
8
  python3.8-dev \
9
  python3-pip \
10
+ git \
 
 
11
  wget \
12
  curl \
13
+ build-essential \
14
+ cmake \
15
  libgl1-mesa-glx \
16
  libglib2.0-0 \
17
  libsm6 \
18
  libxext6 \
19
+ libxrender1 \
20
  libgomp1 \
 
21
  && rm -rf /var/lib/apt/lists/*
22
 
23
  # Set python3.8 as default
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
+ # Upgrade pip
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
+ pycocotools
66
+
67
+ # Install compatible gradio and huggingface_hub
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
+ submitit==1.4.1
80
+
81
+ # Optional: pytorch_lightning (skip if not needed for faster builds)
82
+ # RUN pip install pytorch_lightning==1.5.10
83
 
84
  # Switch to user
85
  USER user
 
88
  # Copy application
89
  COPY --chown=user:user . /app
90
 
91
+ # CPU environment variables
92
  ENV CUDA_VISIBLE_DEVICES=""
93
  ENV FORCE_CUDA="0"
94
  ENV OMP_NUM_THREADS=4