我正在尝试用Prophet 1构建一个Docker镜像。0.1
这是我的要求。txt文件
google-cloud-bigquery
google-cloud-storage
numpy==1.21.0
pandas==1.2.0
db-dtypes
plotly==5.10.0
hampel==0.0.5
prophet==1.0.1
click
joblib
scikit-learn
这是我的docker文件
FROM python:3.8-slim-buster as base
RUN mkdir my_dir
COPY requirements.txt /my_dir/requirements.txt
COPY src /my_dir/src
WORKDIR /my_dir
RUN apt update
RUN apt-get install -y --no-install-recommends \
ca-certificates \
cmake \
build-essential \
gcc \
g++ \
git \
curl \
apt-transport-https \
ca-certificates \
gnupg
RUN python -m pip install --no-cache-dir --upgrade setuptools pip wheel pipenv
RUN pip install -r requirements.txt
WORKDIR /my_dir/src
RUN python setup.py bdist_wheel
RUN pip install dist/*
# kubectl
RUN curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
RUN chmod +x ./kubectl
RUN mv ./kubectl /usr/local/bin
ENTRYPOINT [ "sh", "run.sh" ]
当我尝试运行docker-compose up -d
命令时,本地构建失败,错误如下-
13 25.10 Building wheels for collected packages: prophet, pymeeus
#13 25.10 Building wheel for prophet (setup.py): started
#13 25.40 Building wheel for prophet (setup.py): finished with status 'error'
#13 25.41 error: subprocess-exited-with-error
#13 25.41
#13 25.41 × python setup.py bdist_wheel did not run successfully.
#13 25.41 │ exit code: 1
#13 25.41 ╰─> [49 lines of output]
#13 25.41 running bdist_wheel
#13 25.41 running build
#13 25.41 running build_py
#13 25.41 creating build
#13 25.41 creating build/lib
#13 25.41 creating build/lib/prophet
#13 25.41 creating build/lib/prophet/stan_model
#13 25.41 Traceback (most recent call last):
#13 25.41 File "<string>", line 36, in <module>
#13 25.41 File "<pip-setuptools-caller>", line 34, in <module>
#13 25.41 File "/tmp/pip-install-l_l1ynvx/prophet_2f0894fc2ee74edfa49399ff3fb20863/setup.py", line 150, in <module>
#13 25.41 long_description_content_type='text/markdown',
#13 25.41 File "/usr/local/lib/python3.7/site-packages/setuptools/__init__.py", line 108, in setup
#13 25.41 return distutils.core.setup(**attrs)
#13 25.41 File "/usr/local/lib/python3.7/site-packages/setuptools/_distutils/core.py", line 185, in setup
#13 25.41 return run_commands(dist)
#13 25.41 File "/usr/local/lib/python3.7/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
#13 25.41 dist.run_commands()
#13 25.41 File "/usr/local/lib/python3.7/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
#13 25.41 self.run_command(cmd)
#13 25.41 File "/usr/local/lib/python3.7/site-packages/setuptools/dist.py", line 1221, in run_command
#13 25.41 super().run_command(command)
#13 25.41 File "/usr/local/lib/python3.7/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
#13 25.41 cmd_obj.run()
#13 25.41 File "/usr/local/lib/python3.7/site-packages/wheel/bdist_wheel.py", line 343, in run
#13 25.41 self.run_command("build")
#13 25.41 File "/usr/local/lib/python3.7/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
#13 25.41 self.distribution.run_command(command)
#13 25.41 File "/usr/local/lib/python3.7/site-packages/setuptools/dist.py", line 1221, in run_command
#13 25.41 super().run_command(command)
#13 25.41 File "/usr/local/lib/python3.7/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
#13 25.41 cmd_obj.run()
#13 25.41 File "/usr/local/lib/python3.7/site-packages/setuptools/_distutils/command/build.py", line 131, in run
#13 25.41 self.run_command(cmd_name)
#13 25.41 File "/usr/local/lib/python3.7/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
#13 25.41 self.distribution.run_command(command)
#13 25.41 File "/usr/local/lib/python3.7/site-packages/setuptools/dist.py", line 1221, in run_command
#13 25.41 super().run_command(command)
#13 25.41 File "/usr/local/lib/python3.7/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
#13 25.41 cmd_obj.run()
#13 25.41 File "/tmp/pip-install-l_l1ynvx/prophet_2f0894fc2ee74edfa49399ff3fb20863/setup.py", line 48, in run
#13 25.41 build_models(target_dir)
#13 25.41 File "/tmp/pip-install-l_l1ynvx/prophet_2f0894fc2ee74edfa49399ff3fb20863/setup.py", line 36, in build_models
#13 25.41 from prophet.models import StanBackendEnum
#13 25.41 File "/tmp/pip-install-l_l1ynvx/prophet_2f0894fc2ee74edfa49399ff3fb20863/prophet/__init__.py", line 8, in <module>
#13 25.41 from prophet.forecaster import Prophet
#13 25.41 File "/tmp/pip-install-l_l1ynvx/prophet_2f0894fc2ee74edfa49399ff3fb20863/prophet/forecaster.py", line 14, in <module>
#13 25.41 import numpy as np
#13 25.41 ModuleNotFoundError: No module named 'numpy'
#13 25.41 [end of output]
我确实有numpy
包包含在requirements.txt
中,但它似乎不适合我。我怎样才能成功安装先知1.0.1使用Docker?
1条答案
按热度按时间2izufjch1#
先知1.01似乎需要它的一些依赖项才能构建包,因此您需要首先安装这些依赖项。您可以将
requirements.txt
更改为(Note
prophet==1.0.1
已被删除。)然后将Dockerfile
更改为或者,您可以切换到没有这个问题的新版本的先知。