leonsimon23 commited on
Commit
4f1c174
·
verified ·
1 Parent(s): 8a9542e

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +7 -9
Dockerfile CHANGED
@@ -10,8 +10,6 @@ COPY app.R .
10
  COPY gmqrkl.xlsx .
11
 
12
  # 确保系统包更新和安装必要的开发工具(对于 R 包编译可能需要)
13
- # IMPORTANT: Added libpython3-dev for robust Python C-extensions compilation
14
- # Also added build-essential and gfortran which are crucial for pystan/fbprophet
15
  RUN apt-get update && apt-get install -y --no-install-recommends \
16
  sudo \
17
  curl \
@@ -31,19 +29,19 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
31
  python3-pip \
32
  python3-dev \
33
  build-essential \
34
- # Ensure python development headers are explicitly there
35
  libpython3-dev \
36
- # Added python3-venv and python3-wheel as good practices
37
  python3-venv \
38
  python3-wheel \
39
  && rm -rf /var/lib/apt/lists/*
40
 
41
  # 为 prophet 包安装 Python 依赖
42
- # 注意:Prophet R 包在内部调用了 Python Prophet 库
43
- # 移除了 pip 自身升级的步骤,因为 apt 管理的 pip 不应由 pip 自身升级
44
- # 再次尝试安装 pystan 和 fbprophet,确保所有依赖到位
45
- RUN pip3 install pystan==2.19.1.1 # Pin a specific stable pystan version
46
- RUN pip3 install fbprophet==0.7.1 # Pin a specific stable fbprophet version
 
 
47
 
48
  # 安装所有必需的 R 包
49
  # 分开安装一些可能相互依赖或安装耗时的包,增加稳定性
 
10
  COPY gmqrkl.xlsx .
11
 
12
  # 确保系统包更新和安装必要的开发工具(对于 R 包编译可能需要)
 
 
13
  RUN apt-get update && apt-get install -y --no-install-recommends \
14
  sudo \
15
  curl \
 
29
  python3-pip \
30
  python3-dev \
31
  build-essential \
 
32
  libpython3-dev \
 
33
  python3-venv \
34
  python3-wheel \
35
  && rm -rf /var/lib/apt/lists/*
36
 
37
  # 为 prophet 包安装 Python 依赖
38
+ # 使用虚拟环境安装 pystan fbprophet,以避免 'externally-managed-environment' 错误
39
+ ENV VIRTUAL_ENV=/opt/venv
40
+ ENV PATH="$VIRTUAL_ENV/bin:$PATH"
41
+
42
+ RUN python3 -m venv $VIRTUAL_ENV && \
43
+ pip install --upgrade pip && \
44
+ pip install pystan==2.19.1.1 fbprophet==0.7.1
45
 
46
  # 安装所有必需的 R 包
47
  # 分开安装一些可能相互依赖或安装耗时的包,增加稳定性