WebashalarForML commited on
Commit
d2b0c04
·
verified ·
1 Parent(s): 1a609a3

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +21 -8
Dockerfile CHANGED
@@ -4,7 +4,8 @@ FROM python:3.9-slim
4
  # Set environment variables for Python and Numba
5
  ENV PYTHONDONTWRITEBYTECODE=1 \
6
  PYTHONUNBUFFERED=1 \
7
- NUMBA_DISABLE_JIT=1 \
 
8
  NUMBA_CACHE_DIR=/tmp/numba_cache
9
 
10
  # Set the working directory
@@ -14,6 +15,7 @@ WORKDIR /app
14
  COPY requirements.txt /app/
15
 
16
  # Install build dependencies
 
17
  RUN apt-get update && \
18
  apt-get install -y --no-install-recommends \
19
  llvm \
@@ -27,16 +29,28 @@ RUN apt-get update && \
27
  libxrender1 \
28
  libglib2.0-0 \
29
  ffmpeg \
 
 
 
30
  && rm -rf /var/lib/apt/lists/*
31
 
32
- # Set LLVM_CONFIG before building llvmlite (if needed)
33
- ENV LLVM_CONFIG=/usr/bin/llvm-config-14
 
 
 
34
 
35
- RUN pip install librosa==0.9.2 numba==0.55.2 llvmlite==0.38.0
36
- # Install numpy first for numba compatibility
37
- RUN pip install --no-cache-dir numpy==1.22.4
 
 
 
 
 
38
 
39
- # Install Python dependencies
 
40
  RUN pip install --no-cache-dir -r requirements.txt
41
 
42
  # Copy the rest of the application
@@ -57,5 +71,4 @@ ENV FLASK_APP=app.py \
57
  FLASK_ENV=production
58
 
59
  # Start the application with Gunicorn
60
-
61
  CMD ["gunicorn", "--bind", "0.0.0.0:7860", "app:app"]
 
4
  # Set environment variables for Python and Numba
5
  ENV PYTHONDONTWRITEBYTECODE=1 \
6
  PYTHONUNBUFFERED=1 \
7
+ # Remove NUMBA_DISABLE_JIT=1 here. We want Numba to work if versions are compatible.
8
+ # NUMBA_DISABLE_JIT=1 \
9
  NUMBA_CACHE_DIR=/tmp/numba_cache
10
 
11
  # Set the working directory
 
15
  COPY requirements.txt /app/
16
 
17
  # Install build dependencies
18
+ # Keep these as they are essential for various Python packages including those with C extensions
19
  RUN apt-get update && \
20
  apt-get install -y --no-install-recommends \
21
  llvm \
 
29
  libxrender1 \
30
  libglib2.0-0 \
31
  ffmpeg \
32
+ # Ensure you have these for audio processing if they are not covered by librosa's dependencies
33
+ libsndfile1 \
34
+ libsndfile1-dev \
35
  && rm -rf /var/lib/apt/lists/*
36
 
37
+ # Set LLVM_CONFIG before building llvmlite (if needed) - crucial for older numba/llvmlite
38
+ # For numba 0.48.0, often llvm-config-8 or llvm-config-9 is needed.
39
+ # Let's try llvm-config-9, as Python 3.9 is relatively new for 0.48.0, but it often works.
40
+ # If this fails, try installing llvm-9-dev and setting LLVM_CONFIG=/usr/bin/llvm-config-9
41
+ ENV LLVM_CONFIG=/usr/bin/llvm-config
42
 
43
+ # Explicitly install compatible versions of core audio/Numba stack
44
+ # Order matters: numpy -> llvmlite -> numba -> resampy -> librosa
45
+ RUN pip install --no-cache-dir \
46
+ numpy==1.22.4 \
47
+ llvmlite==0.35.0 \
48
+ numba==0.48.0 \
49
+ resampy==0.2.2 \
50
+ librosa==0.8.1 # librosa 0.8.1 is often good with resampy 0.2.2
51
 
52
+ # Install other Python dependencies from requirements.txt
53
+ # This will pick up all other packages, assuming they don't conflict with the explicitly installed ones.
54
  RUN pip install --no-cache-dir -r requirements.txt
55
 
56
  # Copy the rest of the application
 
71
  FLASK_ENV=production
72
 
73
  # Start the application with Gunicorn
 
74
  CMD ["gunicorn", "--bind", "0.0.0.0:7860", "app:app"]