scrapinghub部署失败“可调用”没有属性“ _abc_registry”

问题描述

我正在尝试使用以下命令将scrapy项目部署到scrapinghub:

shub deploy 470662

版本:

  • Scrapy版本2.2.1
  • shub版本2.11.0
  • python3.8

它会产生以下错误

/usr/local/lib/python3.8/site-packages/setuptools/distutils_patch.py:25: UserWarning: distutils was imported before Setuptools. This usage is discouraged and may exhibit undesirable behaviors or errors. Please use Setuptools' objects directly or at least import Setuptools first.
  warnings.warn(
Packing version 1.0
deploying to Scrapy Cloud project "470662"
Deploy log last 30 lines:
  File "/app/python/lib/python3.8/site-packages/scrapy/http/__init__.py",line 15,in <module>
    from scrapy.http.response import Response
  File "/app/python/lib/python3.8/site-packages/scrapy/http/response/__init__.py",line 7,in <module>
    from typing import Generator
  File "/app/python/lib/python3.8/site-packages/typing.py",line 1359,in <module>
    class Callable(extra=collections_abc.Callable,Metaclass=CallableMeta):
  File "/app/python/lib/python3.8/site-packages/typing.py",line 1007,in __new__
    self._abc_registry = extra._abc_registry
AttributeError: type object 'Callable' has no attribute '_abc_registry'
Traceback (most recent call last):
  File "/usr/local/bin/shub-image-info",line 8,in <module>
    sys.exit(shub_image_info())
  File "/usr/local/lib/python3.8/site-packages/sh_scrapy/crawl.py",line 200,in shub_image_info
    from scrapy.exceptions import ScrapyDeprecationWarning
  File "/app/python/lib/python3.8/site-packages/scrapy/__init__.py",line 12,in <module>
    from scrapy.spiders import Spider
  File "/app/python/lib/python3.8/site-packages/scrapy/spiders/__init__.py",line 10,in <module>
    from scrapy.http import Request
  File "/app/python/lib/python3.8/site-packages/scrapy/http/__init__.py",in __new__
    self._abc_registry = extra._abc_registry
AttributeError: type object 'Callable' has no attribute '_abc_registry'
{"message": "shub-image-info exit code: 1","details": null,"error": "image_info_error"}

{"status": "error","message": "Internal error"}
Deploy log location: /var/folders/rp/xxjnjsvn70g2ndh68l0g10bh0000gn/T/shub_deploy_6h9fra1k.log
Error: Deploy Failed: b'{"status": "error","message": "Internal error"}'

这是requirements.txtscrapinghub.yml

requirements.txt:

itemadapter==0.1.0
requests==2.23.0
Scrapy==2.2.1
scrapy-user-agents==0.1.1
scrapy-rotating-proxies==0.6.2

scrapinghub.yml

projects:
  default: 470662
requirements:
  file: requirements.txt

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)