You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Wonderful tutorial -- thanks so much. I ran into an import error on the catnip example, in the run command:
sudo docker run -p 8888:5000 <username>/catnip
#ImportError: cannot import name 'url_quote' from 'werkzeug.urls' (/usr/local/lib/python3.8/site-packages/werkzeug/urls.py)
I second this, great tutorial so far, but I also get ImportError: cannot import name 'url_quote' from 'werkzeug.urls' (/usr/local/lib/python3.10/site-packages/werkzeug/urls.py) when I run the docker file.
As you might see, even changing from python 3.9 in your example to 3.10 doesn't fix the issue.
I run Docker Engine on Ubuntu
Full error: Traceback (most recent call last): File "/usr/scr/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 7, in <module> from .app import Flask as Flask File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 28, in <module> from . import cli File "/usr/local/lib/python3.10/site-packages/flask/cli.py", line 18, in <module> from .helpers import get_debug_flag File "/usr/local/lib/python3.10/site-packages/flask/helpers.py", line 16, in <module> from werkzeug.urls import url_quote ImportError: cannot import name 'url_quote' from 'werkzeug.urls' (/usr/local/lib/python3.10/site-packages/werkzeug/urls.py)
Alas did not solve the issue for me. Gives me an error:
2.481 ERROR: Could not find a version that satisfies the requirement Werzeug==3.0.0 (from versions: none)
2.482 ERROR: No matching distribution found for Werzeug==3.0.0
Saw a mention of werzeug version 2.2.2, tried that version to, same error.
To bad, really liked the way this tutorial was going
* in your docker-curriculum / flask-app there is a file called requirements.txt
* change the Flask version to 3.0.0 and set the Werkzeug version to 3.0.0.
The file looks like this now:
Flask==3.0.0
Werkzeug==3.0.0
* Save and exit.
* again run docker build -t /catnip .
* there will be a red warning about this is a development server which you can ignore.
* type in your browser 127.0.0.1:5000
* enjoy cat gif :)
Hi @dwolf42 I wasn't able to solve the problem with this approach. Could you help me? I have tried all possible ways that I have found. I am using Ubuntu, Python 3.10.12, Flask 3.0.3, Werkzeug 3.0.2
Hey @Programador04, sorry for the late reply.
I would love to help you out here, but unfortunately I’m just someone who happens to find a workaround by chance.
If changing the stuff I mentioned inside the requirements.txt didn’t work for you, only @prakhar1989 could be able to give a helping hand.
Activity
dwolf42 commentedon Oct 2, 2023
I second this, great tutorial so far, but I also get
ImportError: cannot import name 'url_quote' from 'werkzeug.urls' (/usr/local/lib/python3.10/site-packages/werkzeug/urls.py)
when I run the docker file.As you might see, even changing from python 3.9 in your example to 3.10 doesn't fix the issue.
I run Docker Engine on Ubuntu
Full error:
Traceback (most recent call last): File "/usr/scr/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 7, in <module> from .app import Flask as Flask File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 28, in <module> from . import cli File "/usr/local/lib/python3.10/site-packages/flask/cli.py", line 18, in <module> from .helpers import get_debug_flag File "/usr/local/lib/python3.10/site-packages/flask/helpers.py", line 16, in <module> from werkzeug.urls import url_quote ImportError: cannot import name 'url_quote' from 'werkzeug.urls' (/usr/local/lib/python3.10/site-packages/werkzeug/urls.py)
dwolf42 commentedon Oct 2, 2023
@jcpayne jcpayne I found a workaround:
The file looks like this now:
jcpayne commentedon Oct 2, 2023
That's great @dwolf42 , thanks! It works for me too.
yozsoy commentedon Oct 3, 2023
@dwolf42 fixed the issue for me
peter-kaagman commentedon Dec 1, 2023
Alas did not solve the issue for me. Gives me an error:
2.481 ERROR: Could not find a version that satisfies the requirement Werzeug==3.0.0 (from versions: none)
2.482 ERROR: No matching distribution found for Werzeug==3.0.0
Saw a mention of werzeug version 2.2.2, tried that version to, same error.
To bad, really liked the way this tutorial was going
Peter
rgibbins commentedon Dec 3, 2023
The following worked for me in the requirements.txt file:
Flask==2.0.2
Werkzeug==2.2.2
AlvaroBesadaFerrer commentedon Apr 29, 2024
Hi @dwolf42 I wasn't able to solve the problem with this approach. Could you help me? I have tried all possible ways that I have found. I am using Ubuntu, Python 3.10.12, Flask 3.0.3, Werkzeug 3.0.2
dwolf42 commentedon May 6, 2024
Hey @Programador04, sorry for the late reply.
I would love to help you out here, but unfortunately I’m just someone who happens to find a workaround by chance.
If changing the stuff I mentioned inside the
requirements.txt
didn’t work for you, only @prakhar1989 could be able to give a helping hand.bluereena commentedon Jul 5, 2024
You can change the Python version to 3.6 in the Dockerfile, it will work.
effel4105 commentedon Oct 23, 2024
this all not work... :(
mira-mirai commentedon Aug 8, 2025
oof. I thought docker was supposed to help with dependency hell.