Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

377
Views
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 answers
Answer question

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 Report

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 Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!