[英]How to install certain packages before building wheels for other packages in requirements.txt using pip?
Here is a section of my requirements.txt
file.这是我的
requirements.txt
文件的一部分。
pystan
cython
lunardate
holidays
convertdate
plotly
fbprophet
While using pip install, all the packages are downloaded, built and installed in the same order as expected.在使用 pip install 时,所有的包都按照预期的顺序下载、构建和安装。
However, for building the wheel of fbprophet
, it needs pystan
as a dependency.但是,为了构建
fbprophet
的轮子,它需要pystan
作为依赖项。 And since pystan
is in a "built" stage then and not yet installed , the fbprophet
install always fails.而且由于
pystan
处于“构建”阶段并且尚未安装,因此fbprophet
安装总是失败。
On using pip on the above requirements.txt I get this log:在上述 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'
I got the same error message when I ran what you had above, but was able to pip install -r requirements.txt
with this as my requirements.txt
:当我运行上面的内容时,我收到了相同的错误消息,但能够
pip install -r requirements.txt
将此作为我的requirements.txt
:
pystan==2.19.1.1
cython
lunardate
holidays
convertdate
plotly
fbprophet
pip was likely using an unsupported version of pystan
. pip 可能使用了不受支持的
pystan
版本。 According to the fbprophet installation documentation , as of January 20th 2022 (when I am writing this), ' fbprophet
currently does not support pystan
>=3.0.'根据fbprophet 安装文档,截至 2022 年 1 月 20 日(我写这篇文章时),“
fbprophet
目前不支持pystan
>=3.0。”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.