这个社区在过去给了我很大的帮助,所以我再次转向你。我有一个Pyomo模型,我可以在本地成功地运行它。但是,当我尝试用Flask在docker容器中运行它时,它失败了,并显示以下错误:
pyutilib.common._exceptions.ApplicationError: No executable found for solver 'glpk'. 我的requirements.txt是:
flask
requests
simplejson
flask-cors
Pyomo当我尝试将glpk添加到requirements.txt时,我得到了另一个错误:
E: Unable to locate package glpk我的Dockerfile:
FROM python:3.8
RUN mkdir /backend
WORKDIR /backend
COPY requirements.txt /backend/requirements.txt
RUN pip install -r requirements.txt
CMD ["python", "app.py"]我在网上搜索了几个小时,但似乎没有什么帮助。有什么线索吗?
发布于 2021-07-22 22:01:23
你必须安装glpk,在我的例子中,我是用蟒蛇镜像来安装的。我的Dockerfile示例:
FROM continuumio/anaconda3
WORKDIR /src
COPY requirements.txt requirements.txt
RUN pip3 install -r requirements.txt
RUN conda config --set channel_priority false
RUN conda update --all --yes
RUN conda install -c conda-forge/label/gcc7 glpk
COPY . .
ENV PYTHONPATH "${PYTHONPATH}:/src"
CMD [ "python3", "src/app.py"]https://stackoverflow.com/questions/65825664
复制相似问题