python - 尝试部署到 Scrapy Cloud 时出现需求错误

标签 python web-scraping scrapy scrapinghub

我正在尝试使用 shub 将我的蜘蛛部署到 Scrapy Cloud,但我不断遇到以下错误:

$ shub deploy
Packing version 2df64a0-master
Deploying to Scrapy Cloud project "164526"
Deploy log last 30 lines:
---> Using cache
---> 55d64858a2f3
Step 11 : RUN mkdir /app/python && chown nobody:nogroup /app/python
---> Using cache
---> 2ae4ff90489a
Step 12 : RUN sudo -u nobody -E PYTHONUSERBASE=$PYTHONUSERBASE pip install --user --no-cache-dir -r /app/requirements.txt
---> Using cache
---> 51f233d54a01
Step 13 : COPY *.egg /app/
---> e2aa1fc31f89
Removing intermediate container 5f0a6cb53597
Step 14 : RUN if [ -d "/app/addons_eggs" ]; then rm -f /app/*.dash-addon.egg; fi
---> Running in 3a2b2bbc1a73
---> af8905101e32
Removing intermediate container 3a2b2bbc1a73
Step 15 : ENV PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
---> Running in ccffea3009a4
---> b4882513b76e
Removing intermediate container ccffea3009a4
Successfully built b4882513b76e
>>> Checking python dependencies
scrapinghub 1.9.0 has requirement six>=1.10.0, but you have six 1.7.3.
monkeylearn 0.3.5 has requirement requests>=2.8.1, but you have requests 2.3.0.
monkeylearn 0.3.5 has requirement six>=1.10.0, but you have six 1.7.3.
hubstorage 0.23.6 has requirement six>=1.10.0, but you have six 1.7.3.
Warning: Pip checks failed, please fix the conflicts.
Process terminated with exit code 1, signal None, status=0x0100
{"message": "Dependencies check exit code: 193", "details": "Pip checks failed, please fix the conflicts", "error": "requirements_error"}
{"message": "Requirements error", "status": "error"}
Deploy log location: /var/folders/w0/5w7rddxn28l2ywk5m6jwp7380000gn/T/shub_deploy_xi_w3xx8.log
Error: Deploy failed: b'{"message": "Requirements error", "status": "error"}'

这看起来像是一个过时软件包的简单问题(六)。然而,安装的软件包实际上是最新的:

$ pip show six
Name: six
Version: 1.10.0
Summary: Python 2 and 3 compatibility utilities
Home-page: http://pypi.python.org/pypi/six/
Author: Benjamin Peterson
Author-email: benjamin@python.org
License: MIT
Location: /Users/mac/.pyenv/versions/3.6.0/lib/python3.6/site-packages
Requires:

我在 Mac 上通过 pyenv 运行 python 3.6。 有什么想法吗?

编辑:

我的requirements.txt 文件仅包含以下依赖项:

newspaper==0.0.9.8

编辑2:scrapinghub.yml

projects:
  default: 164526
requirements_file: requirements.txt

谢谢, 西蒙!

最佳答案

通过将以下代码添加到 scrapinghub.yml 中,设法解决了这个问题(在 scrapinghub 支持论坛的帮助下):

stacks:
  default: scrapy:1.3-py3

并更改requirements.txt以使用newspaper的python3分支:

newspaper3k==0.1.9

关于python - 尝试部署到 Scrapy Cloud 时出现需求错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42651044/

相关文章:

python - scrapy中通过回调函数传递元元素

python - Scrapy爬取同一页面上的多个XPathSelector

python - Scrapy - 在一个 scrapy 脚本中抓取不同的网页

python - 指定 Automator 中运行哪个版本的 Python?

python - 如何访问与该属性名称对应的给定字符串的对象属性

python - Apache Nutch 的任何替代品?

python - 在 scrapy 网络爬虫中获取错误

python - 有 Pandas 解决方案吗? : with numba, 或 Cython - 到 `transform`/`apply` 带有索引,MultiIndexed DataFrame?

python - Pandas 数据框 : how to permute rows and create new groups of combinations

python - 我应该如何将数据从公共(public)谷歌存储桶下载到Python中?