pythonscrapyscrapy-splash

When I execute this command (shub login), in python I get error. I execute this command after installing the shub package


Traceback (most recent call last):
  File "C:\Users\mohammadprgrm\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\mohammadprgrm\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\mohammadprgrm\Desktop\py\env\Scripts\shub.exe\__main__.py", line 4, in <module>
  File "C:\Users\mohammadprgrm\Desktop\py\env\lib\site-packages\shub\tool.py", line 7, in <module>
    from shub.utils import update_available
  File "C:\Users\mohammadprgrm\Desktop\py\env\lib\site-packages\shub\utils.py", line 42, in <module>
    from scrapinghub import ScrapinghubClient, ScrapinghubAPIError, HubstorageClient
  File "C:\Users\mohammadprgrm\Desktop\py\env\lib\site-packages\scrapinghub\__init__.py", line 13, in <module>
    from .hubstorage import HubstorageClient
  File "C:\Users\mohammadprgrm\Desktop\py\env\lib\site-packages\scrapinghub\hubstorage\__init__.py", line 6, in <module>
    from .client import HubstorageClient
  File "C:\Users\mohammadprgrm\Desktop\py\env\lib\site-packages\scrapinghub\hubstorage\client.py", line 8, in <module>
    from .project import Project
  File "C:\Users\mohammadprgrm\Desktop\py\env\lib\site-packages\scrapinghub\hubstorage\project.py", line 3, in <module>
    from .job import Job
  File "C:\Users\mohammadprgrm\Desktop\py\env\lib\site-packages\scrapinghub\hubstorage\job.py", line 2, in <module>
    from .resourcetype import (ItemsResourceType, DownloadableResource,
  File "C:\Users\mohammadprgrm\Desktop\py\env\lib\site-packages\scrapinghub\hubstorage\resourcetype.py", line 5, in <module>
    from collections import MutableMapping
ImportError: cannot import name 'MutableMapping' from 'collections' (C:\Users\mohammadprgrm\AppData\Local\Programs\Python\Python310\lib\collections\__init__.py)

Solution

  • That version of the scrapinghub package is evidently not compatible with Python 3.10.

    Downgrade to Python 3.9, or upgrade the package to a new, compatible version if there is one which there may not be yet: https://github.com/scrapinghub/python-scrapinghub/issues/160