【发布时间】:2022-01-21 03:54:22
【问题描述】:
这是我的requirements.txt 文件的一部分。
pystan
cython
lunardate
holidays
convertdate
plotly
fbprophet
在使用 pip install 时,所有的包都按照预期以相同的顺序下载、构建和安装。
但是,为了构建fbprophet 的wheel,它需要pystan 作为依赖项。并且由于pystan当时处于“已构建”阶段并且尚未安装,因此fbprophet安装总是失败。
在上面的 requirements.txt 上使用 pip 我得到了这个日志:
Collecting pystan (from -r requirements.txt (line 2))
Downloading https://files.pythonhosted.org/packages/7b/ea/c004537cd92c7dcc0112756d2cbc99707e3f67966e57285cdaca68b2e364/pystan-2.19.0.0-cp37-cp37m-manylinux1_x86_64.whl (67.2MB)
Saved /tmp/tmpKl0DOi/wheel/pystan-2.19.0.0-cp37-cp37m-manylinux1_x86_64.whl
Collecting cython (from -r requirements.txt (line 18))
Downloading https://files.pythonhosted.org/packages/f1/d3/03a01bcf424eb86d3e9d818e2082ced2d512001af89183fca6f550c32bc2/Cython-0.29.13-cp37-cp37m-manylinux1_x86_64.whl (2.1MB)
Saved /tmp/tmpKl0DOi/wheel/Cython-0.29.13-cp37-cp37m-manylinux1_x86_64.whl
Collecting lunardate (from -r requirements.txt (line 19))
Downloading https://files.pythonhosted.org/packages/4e/7e/377a3cbba646ec0cf79433ef858881d809a3b87eb887b0901cb83c66a758/lunardate-0.2.0-py3-none-any.whl
Saved /tmp/tmpKl0DOi/wheel/lunardate-0.2.0-py3-none-any.whl
Collecting holidays (from -r requirements.txt (line 20))
Downloading https://files.pythonhosted.org/packages/d0/17/a452275a0b3e811a381137ff6a61649086af4c5bf2a25755f518cc64b39e/holidays-0.9.11.tar.gz (81kB)
Collecting convertdate (from -r requirements.txt (line 21))
Downloading https://files.pythonhosted.org/packages/74/83/d0fa07078f4d4ae473a89d7d521aafc66d82641ea0af0ef04a47052e8f17/convertdate-2.1.3-py2.py3-none-any.whl
Saved /tmp/tmpKl0DOi/wheel/convertdate-2.1.3-py2.py3-none-any.whl
Collecting plotly (from -r requirements.txt (line 22))
Downloading https://files.pythonhosted.org/packages/63/2b/4ca10995bfbdefd65c4238f9a2d3fde33705d18dd50914dd13302ec1daf1/plotly-4.1.0-py2.py3-none-any.whl (7.1MB)
Saved /tmp/tmpKl0DOi/wheel/plotly-4.1.0-py2.py3-none-any.whl
Collecting fbprophet (from -r requirements.txt (line 23))
Downloading https://files.pythonhosted.org/packages/33/fb/ad98d46773929079657706e6b2b6e366ba6c282bc2397d8f9b0ea8e5614c/fbprophet-0.5.tar.gz (49kB)
Skipping pystan, due to already being wheel.
Skipping cython, due to already being wheel.
Skipping lunardate, due to already being wheel.
Skipping convertdate, due to already being wheel.
Skipping plotly, due to already being wheel.
Building wheels for collected packages: fbprophet
Building wheel for fbprophet (setup.py): started
Building wheel for fbprophet (setup.py): finished with status 'error'
Complete output from command /env/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/tmp/pip-wheel-0mthcx8p/fbprophet/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-gp8dl1oz:
running bdist_wheel
running build
running build_py
creating build
creating build/lib
creating build/lib/fbprophet
creating build/lib/fbprophet/stan_model
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-wheel-0mthcx8p/fbprophet/setup.py", line 120, in <module>
"""
File "/env/lib/python3.7/site-packages/setuptools/__init__.py", line 145, in setup
return distutils.core.setup(**attrs)
File "/opt/python3.7/lib/python3.7/distutils/core.py", line 148, in setup
dist.run_commands()
File "/opt/python3.7/lib/python3.7/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/opt/python3.7/lib/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/env/lib/python3.7/site-packages/wheel/bdist_wheel.py", line 192, in run
self.run_command('build')
File "/opt/python3.7/lib/python3.7/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/opt/python3.7/lib/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/opt/python3.7/lib/python3.7/distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/opt/python3.7/lib/python3.7/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/opt/python3.7/lib/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/tmp/pip-wheel-0mthcx8p/fbprophet/setup.py", line 44, in run
build_stan_model(target_dir)
File "/tmp/pip-wheel-0mthcx8p/fbprophet/setup.py", line 27, in build_stan_model
from pystan import StanModel
ModuleNotFoundError: No module named 'pystan'
【问题讨论】:
-
我认为没有办法一次性安装所有内容。将
requirements.txt拆分为两个阶段——首先,安装pystan(可能还有cython),然后安装fbprophet。 -
或者在安装
requirements.txt文件之前运行命令pip install pystan -
我正在尝试构建一个 Google App Engine。在标准环境中,我只能提供这个
requirements.txt文件,它会处理其余部分。不能真正编写命令(需要一个灵活的又名付费环境)。所以我真的很想知道是否有办法在 GAE 中为标准运行时做到这一点 -
@SayanSil 你能解决这个问题吗?我遇到了同样的问题
标签: python build pip google-cloud-build requirements.txt