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

376
Visualizações
ImportError: cannot import name 'MutableMapping' from 'collections' (/usr/local/lib/python3.10/collections/__init__.py)

I'm running this simple flask app in vs code. Dockerized it and loaded to ECS. The task is exiting with the following error:

ImportError: cannot import name 'MutableMapping' from 'collections' (/usr/local/lib/python3.10/collections/init.py)

The base image I'm using is python3.10.

Following is the dockerfile code:

FROM python:3.10
WORKDIR /usr/src/app
COPY . .
RUN pip install --no-cache-dir -r requirements.txt
EXPOSE 5000

Why am I getting this error?

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

0

Trying the following in python 3.9:

>>> from collections import MutableMapping
<stdin>:1: 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

So I'm guessing your problem is you're using python 3.10 where you need to do:

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

0

if you update the flask package to >=2.0 it will import it correctly also in python 3.10

over 4 years ago · Santiago Trujillo Relatório

0

Looks like you're doing the same docker tutorial that I am.

@geza.denes is right, we need flask 2.0 or greater.

you can update this in flask-app/requirements.txt

Rebuild your docker image and run it again, should work!

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