Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

2.3K
Visualizações
in VS Code ImportError: cannot import name 'Mapping' from 'collections'

I am trying to connect to Postgress and create a folder test.db via Flask. When I run "python3" in the terminal and from there when I run "from app import db" I get an import error:

ImportError: cannot import name 'Mapping' from 'collections' (/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/collections/__init__.py)

I have tried all the troubleshooting but none of them worked. Please advise. Here is the full stack: full stack error

over 4 years ago · Santiago Trujillo
6 Respostas
Responde à pergunta

0

Use older version of python (eg 3.8)

over 4 years ago · Santiago Trujillo Relatório

0

As Mitra said above, change:

from collections import Mapping

to

from collections.abc import Mapping
over 4 years ago · Santiago Trujillo Relatório

0

That's about python version. in most time python 3.10 have this problems.

You can solve this problem with use python 3.9 or 3.8 version. or if error from packages like python-docx or other packages about MS you can probably solve it by using pipwin.

over 4 years ago · Santiago Trujillo Relatório

0

As stated by others, this is caused by a change in the collections interface starting with Python 3.10. As far as I can see there are three options to mitigate this issue so far:

  • Revert to Python 3.9.

  • If the error occurs in a third-party library, try to update this library first (pip install <package> --upgrade).

  • Patch the code manually.

    For patching the ImportError, see https://stackoverflow.com/a/69727802/13994294.

over 4 years ago · Santiago Trujillo Relatório

0

In my environment the problem was solved using bug fix Python version 3.10.2

over 4 years ago · Santiago Trujillo Relatório

0

I had the same problem with requests 2.7.0 ,but right now I'm using requests 2.27.1 and python 3.10.2 with no problem.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda