0

I've just updated my python version to 3.10 and received following error:

from flask_sitemap import Sitemap
/usr/local/lib/python3.10/site-packages/flask_sitemap/__init__.py:32: in <module>
from collections import Mapping
E   ImportError: cannot import name 'Mapping' from 'collections' (/usr/local/lib/python3.10/collections/__init__.py)
davidism
  • 121,510
  • 29
  • 395
  • 339
Nazar
  • 11
  • 1

1 Answers1

1

have a look at this thread https://stackoverflow.com/a/59636876/12368419

so you have two options:

  1. downgrade your python to 3.8, not advisable
  2. you can make a small tweak/patch/fix directly in the package source code in venv/Lib/site-packages/flask_sitemap/__ init__.py so have a look at this discussion on github

change this line:

from collections import Mapping

to:

from collections.abc import Mapping
cizario
  • 3,995
  • 3
  • 13
  • 27
  • 1
    There are already PR https://github.com/inveniosoftware/flask-sitemap/pull/48 So probably it will be merged soon. – Nazar Oct 27 '21 at 11:40