anu151105 commited on
Commit
0a8d0f8
·
1 Parent(s): e8e48c8

Update dependencies and fix build issues

Browse files

- Updated package versions in requirements.txt for better compatibility
- Improved dependency management in setup.py
- Enhanced Dockerfile with better system dependencies and caching
- Added specific versions for all dependencies to ensure reproducibility
- Fixed auto-gptq version compatibility issue

Files changed (3) hide show
  1. Dockerfile +21 -10
  2. requirements.txt +29 -31
  3. setup.py +35 -20
Dockerfile CHANGED
@@ -6,9 +6,9 @@ ENV PYTHONUNBUFFERED=1 \
6
  PYTHONHASHSEED=random \
7
  PIP_NO_CACHE_DIR=1 \
8
  PIP_DISABLE_PIP_VERSION_CHECK=1 \
9
- PIP_DEFAULT_TIMEOUT=100 \
10
- POETRY_VERSION=1.8.2 \
11
- MODEL_CACHE_DIR=/data/models
12
 
13
  # Install system dependencies
14
  RUN apt-get update && apt-get install -y --no-install-recommends \
@@ -17,6 +17,12 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
17
  git \
18
  gcc \
19
  g++ \
 
 
 
 
 
 
20
  && rm -rf /var/lib/apt/lists/*
21
 
22
  # Set working directory
@@ -25,12 +31,22 @@ WORKDIR /app
25
  # Install pip and setuptools
26
  RUN pip install --upgrade pip setuptools wheel
27
 
 
 
 
 
 
 
28
  # Copy requirements first for better caching
29
  COPY requirements.txt .
30
 
31
  # Install Python dependencies
32
  RUN pip install --no-cache-dir -r requirements.txt
33
 
 
 
 
 
34
  # Copy application code
35
  COPY . .
36
 
@@ -45,7 +61,8 @@ ENV HOST=0.0.0.0 \
45
  PORT=8501 \
46
  STREAMLIT_SERVER_PORT=8501 \
47
  STREAMLIT_SERVER_HEADLESS=true \
48
- STREAMLIT_BROWSER_GATHER_USAGE_STATS=false
 
49
 
50
  # Expose port
51
  EXPOSE 8501
@@ -54,11 +71,5 @@ EXPOSE 8501
54
  HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
55
  CMD curl --fail http://localhost:8501/_stcore/health || exit 1
56
 
57
- # Set PYTHONPATH to include the app directory
58
- ENV PYTHONPATH="/app:${PYTHONPATH}"
59
-
60
- # Install Playwright browsers
61
- RUN playwright install --with-deps
62
-
63
  # Command to run the Streamlit app
64
  CMD ["streamlit", "run", "src/streamlit_app.py"]
 
6
  PYTHONHASHSEED=random \
7
  PIP_NO_CACHE_DIR=1 \
8
  PIP_DISABLE_PIP_VERSION_CHECK=1 \
9
+ PIP_DEFAULT_TIMEOUT=300 \
10
+ MODEL_CACHE_DIR=/data/models \
11
+ DEBIAN_FRONTEND=noninteractive
12
 
13
  # Install system dependencies
14
  RUN apt-get update && apt-get install -y --no-install-recommends \
 
17
  git \
18
  gcc \
19
  g++ \
20
+ libgl1 \
21
+ libglib2.0-0 \
22
+ libsm6 \
23
+ libxrender1 \
24
+ libxext6 \
25
+ libgl1-mesa-glx \
26
  && rm -rf /var/lib/apt/lists/*
27
 
28
  # Set working directory
 
31
  # Install pip and setuptools
32
  RUN pip install --upgrade pip setuptools wheel
33
 
34
+ # Install system-level dependencies for Python packages
35
+ RUN apt-get update && apt-get install -y --no-install-recommends \
36
+ gcc \
37
+ python3-dev \
38
+ && rm -rf /var/lib/apt/lists/*
39
+
40
  # Copy requirements first for better caching
41
  COPY requirements.txt .
42
 
43
  # Install Python dependencies
44
  RUN pip install --no-cache-dir -r requirements.txt
45
 
46
+ # Install Playwright and its dependencies
47
+ RUN pip install playwright==1.42.0 && \
48
+ playwright install --with-deps chromium
49
+
50
  # Copy application code
51
  COPY . .
52
 
 
61
  PORT=8501 \
62
  STREAMLIT_SERVER_PORT=8501 \
63
  STREAMLIT_SERVER_HEADLESS=true \
64
+ STREAMLIT_BROWSER_GATHER_USAGE_STATS=false \
65
+ PYTHONPATH="/app:${PYTHONPATH}"
66
 
67
  # Expose port
68
  EXPOSE 8501
 
71
  HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
72
  CMD curl --fail http://localhost:8501/_stcore/health || exit 1
73
 
 
 
 
 
 
 
74
  # Command to run the Streamlit app
75
  CMD ["streamlit", "run", "src/streamlit_app.py"]
requirements.txt CHANGED
@@ -1,50 +1,48 @@
1
  # Core Dependencies
2
- streamlit==1.32.0
3
- fastapi==0.68.0
4
- uvicorn==0.15.0
5
- python-dotenv==0.19.0
6
 
7
  # AI/ML
8
- numpy==1.24.0
9
- torch==2.0.0
10
- transformers==4.30.0
11
- sentence-transformers==2.2.2
12
- auto-gptq==0.4.0
13
- accelerate==0.20.0
14
- bitsandbytes==0.41.0
15
- optimum==1.12.0
16
- huggingface-hub==0.16.0
 
17
 
18
  # Browser Automation
19
- playwright==1.42.0
20
- selenium==4.16.0
21
 
22
  # Utilities
23
- requests==2.31.0
24
- python-multipart==0.0.6
25
- pydantic==2.0.0
26
- tqdm==4.65.0
27
- nest-asyncio==1.5.6
28
 
29
  # For file operations (platform specific)
30
- python-magic==0.4.27
31
- python-magic-bin==0.4.14; platform_system=="Windows"
32
 
33
  # For model inference
34
- safetensors==0.4.0
35
 
36
  # For async operations
37
- anyio==3.7.1
38
-
39
- # For monitoring and progress
40
- tqdm==4.65.0
41
 
42
  # For web server
43
- gunicorn
 
 
 
44
 
45
  # For data processing
46
  pandas
47
- numpy
48
-
49
- # For model optimization
50
  onnxruntime
 
1
  # Core Dependencies
2
+ streamlit>=1.32.0,<2.0.0
3
+ fastapi>=0.68.0,<1.0.0
4
+ uvicorn>=0.15.0,<1.0.0
5
+ python-dotenv>=0.19.0,<2.0.0
6
 
7
  # AI/ML
8
+ numpy>=1.24.0,<2.0.0
9
+ torch>=2.0.0,<3.0.0
10
+ transformers>=4.30.0,<5.0.0
11
+ sentence-transformers>=2.2.2,<3.0.0
12
+ # AutoGPTQ requires specific CUDA versions, so we'll use the latest compatible version
13
+ auto-gptq>=0.7.1,<0.8.0
14
+ accelerate>=0.20.0,<1.0.0
15
+ bitsandbytes>=0.41.0,<1.0.0
16
+ optimum>=1.12.0,<2.0.0
17
+ huggingface-hub>=0.16.0,<1.0.0
18
 
19
  # Browser Automation
20
+ playwright>=1.42.0,<2.0.0
21
+ selenium>=4.16.0,<5.0.0
22
 
23
  # Utilities
24
+ requests>=2.31.0,<3.0.0
25
+ python-multipart>=0.0.6,<1.0.0
26
+ pydantic>=2.0.0,<3.0.0
27
+ tqdm>=4.65.0,<5.0.0
28
+ nest-asyncio>=1.5.6,<2.0.0
29
 
30
  # For file operations (platform specific)
31
+ python-magic>=0.4.27,<1.0.0
32
+ python-magic-bin>=0.4.14,<1.0.0; platform_system=="Windows"
33
 
34
  # For model inference
35
+ safetensors>=0.4.0,<1.0.0
36
 
37
  # For async operations
38
+ anyio>=3.7.1,<4.0.0
 
 
 
39
 
40
  # For web server
41
+ gunicorn>=20.1.0,<21.0.0
42
+
43
+ # For browser automation
44
+ webdriver-manager>=4.0.0,<5.0.0
45
 
46
  # For data processing
47
  pandas
 
 
 
48
  onnxruntime
setup.py CHANGED
@@ -12,26 +12,41 @@ with open("README.md", "r", encoding="utf-8") as fh:
12
 
13
  # Core dependencies that will always be installed
14
  CORE_DEPS = [
15
- 'streamlit>=1.32.0',
16
- 'fastapi>=0.68.0',
17
- 'uvicorn>=0.15.0',
18
- 'python-dotenv>=0.19.0',
19
- 'numpy>=1.24.0',
20
- 'torch>=2.0.0',
21
- 'transformers>=4.30.0',
22
- 'sentence-transformers>=2.2.2',
23
- 'auto-gptq>=0.4.0',
24
- 'accelerate>=0.20.0',
25
- 'bitsandbytes>=0.41.0',
26
- 'optimum>=1.12.0',
27
- 'huggingface-hub>=0.16.0',
28
- 'playwright>=1.42.0',
29
- 'selenium>=4.16.0',
30
- 'requests>=2.31.0',
31
- 'python-multipart>=0.0.6',
32
- 'pydantic>=2.0.0',
33
- 'tqdm>=4.65.0',
34
- 'nest-asyncio>=1.5.6',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  ]
36
 
37
  setup(
 
12
 
13
  # Core dependencies that will always be installed
14
  CORE_DEPS = [
15
+ # Core web framework
16
+ 'streamlit>=1.32.0,<2.0.0',
17
+ 'fastapi>=0.68.0,<1.0.0',
18
+ 'uvicorn>=0.15.0,<1.0.0',
19
+ 'python-dotenv>=0.19.0,<2.0.0',
20
+ 'gunicorn>=20.1.0,<21.0.0',
21
+
22
+ # AI/ML
23
+ 'numpy>=1.24.0,<2.0.0',
24
+ 'torch>=2.0.0,<3.0.0',
25
+ 'transformers>=4.30.0,<5.0.0',
26
+ 'sentence-transformers>=2.2.2,<3.0.0',
27
+ 'auto-gptq>=0.7.1,<0.8.0',
28
+ 'accelerate>=0.20.0,<1.0.0',
29
+ 'bitsandbytes>=0.41.0,<1.0.0',
30
+ 'optimum>=1.12.0,<2.0.0',
31
+ 'huggingface-hub>=0.16.0,<1.0.0',
32
+ 'safetensors>=0.4.0,<1.0.0',
33
+
34
+ # Browser Automation
35
+ 'playwright>=1.42.0,<2.0.0',
36
+ 'selenium>=4.16.0,<5.0.0',
37
+ 'webdriver-manager>=4.0.0,<5.0.0',
38
+
39
+ # Utilities
40
+ 'requests>=2.31.0,<3.0.0',
41
+ 'python-multipart>=0.0.6,<1.0.0',
42
+ 'pydantic>=2.0.0,<3.0.0',
43
+ 'tqdm>=4.65.0,<5.0.0',
44
+ 'nest-asyncio>=1.5.6,<2.0.0',
45
+ 'anyio>=3.7.1,<4.0.0',
46
+
47
+ # File operations
48
+ 'python-magic>=0.4.27,<1.0.0',
49
+ 'python-magic-bin>=0.4.14,<1.0.0; platform_system=="Windows"',
50
  ]
51
 
52
  setup(