3

Today I've tried to import an inventory management flask app and i have faced many errors. Hope you can help me, with this project, It's from github https://github.com/marination/Inventory-Manager

and these are the errors:

Traceback (most recent call last):
File "C:\workspace\Inventory-Manager\run.py", line 1, in <module>
from flaskinventory import app
File "C:\workspace\Inventory-Manager\flaskinventory\__init__.py", line 1, in <module>
from flask import Flask
File "C:\workspace\Inventory-Manager\ven\lib\site-packages\flask\__init__.py", line 19, in  <module>
from jinja2 import Markup, escape
File "C:\workspace\Inventory-Manager\ven\lib\site-packages\jinja2\__init__.py", line 33, in  <module>
from jinja2.environment import Environment, Template
File "C:\workspace\Inventory-Manager\ven\lib\site-packages\jinja2\environment.py", line 16, in <module>
from jinja2.defaults import BLOCK_START_STRING, \
File "C:\workspace\Inventory-Manager\ven\lib\site-packages\jinja2\defaults.py", line 32, in  <module>
from jinja2.tests import TESTS as DEFAULT_TESTS
File "C:\workspace\Inventory-Manager\ven\lib\site-packages\jinja2\tests.py", line 13, in  <module>
from collections import Mapping
ImportError: cannot import name 'Mapping' from 'collections' 
(C:\Python310\lib\collections\__init__.py)
0

1 Answer 1

8

collections.Mapping has been deprecated since Python 3.3 and was removed from the collections module In Python 3.10. In Python 3.3 - 3.9 you should see something like the following warning:

DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.10 it will stop working

These imports need to be updated for Python 3.10 to import Mapping from collections.abc

In this case, the import is happening in jinja2. To resolve this, use an updated version of jinja2 which fixes this issue or use Python 3.9 or earlier.

Sign up to request clarification or add additional context in comments.

3 Comments

To extend the @sytech answer - this package requirements.txt explicitly asks for jinja2 version 2.10.1. This is quite outdated version and they should have updated their requirments.txt, i.e. it looks this package is not maintained.
Updating Jinja2 with pip install -U Jinja2 worked like charming !
In my case updating to Jinja 2.10.2 fixed this problem (updating to 3.x caused other breakages in my environment)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.