prakhar1989/docker-curriculum

flask has some issues with python 3.10

peking84 opened this issue ยท 6 comments

https://docker-curriculum.com/#dockerfile

Flask has some problems with the current latest python (3.10)

Traceback (most recent call last):
  File "/usr/src/app/./app.py", line 1, in <module>
    from flask import Flask, render_template
  File "/usr/local/lib/python3.10/site-packages/flask/__init__.py", line 21, in <module>
    from .app import Flask, Request, Response
  File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 34, in <module>
    from .sessions import SecureCookieSessionInterface
  File "/usr/local/lib/python3.10/site-packages/flask/sessions.py", line 14, in <module>
    from collections import MutableMapping
ImportError: cannot import name 'MutableMapping' from 'collections' (/usr/local/lib/python3.10/collections/__init__.py)

To overcome this as a remedy, i changed the Dockerfile to use python 3.9
"FROM python:3.9"

Please review whenever you have a chance.
Cheers
Mark

Thanks, I had the same problem, python3.9 fixed it!

Had the same issue but I was able to run with Python 3.9. Thank you!

Just adding my thanks. I had the same issue and changing to 3.9 fixed the problem.

worked for me too,
I would add to a beginner that the page you have to search for is http://localhost:8888/ and not http://172.17.0.3:5000/ which the terminal said to me to go to.

I just ran into this issue as well. It's the version of flask. To fix it just update the requirement.txt file and change the following:

From
Flask == 1.0

To
Flask >= 2.0

Hi, I also had this issue and you solved it for me. This needs to be updated.