Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't import 'escape' from 'jinja2' #121

Open
UnderCurve opened this issue May 18, 2023 · 11 comments
Open

Can't import 'escape' from 'jinja2' #121

UnderCurve opened this issue May 18, 2023 · 11 comments

Comments

@UnderCurve
Copy link

Hey there so I'm trying to get the web ui to run and I'm just getting this:

user@server:~ $ sudo nxbt webapp
Traceback (most recent call last):
  File "/usr/local/bin/nxbt", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.9/dist-packages/nxbt/cli.py", line 321, in main
    from .web import start_web_app
  File "/usr/local/lib/python3.9/dist-packages/nxbt/web/__init__.py", line 1, in <module>
    from .app import start_web_app
  File "/usr/local/lib/python3.9/dist-packages/nxbt/web/app.py", line 9, in <module>
    from flask import Flask, render_template, request
  File "/usr/local/lib/python3.9/dist-packages/flask/__init__.py", line 14, in <module>
    from jinja2 import escape
ImportError: cannot import name 'escape' from 'jinja2' (/usr/local/lib/python3.9/dist-packages/jinja2/__init__.py)

and I'm not really sure what to do as I don't know anything about python so yeah please help

@ThatOneOcto
Copy link

bump, happening to me too

@Apocalypse0
Copy link

same to me

@Dummydud3
Copy link
Contributor

I had this problem myself, but i solved it by changing the Flask depencancy version inside of METADATA to 2.2.2

@Telain
Copy link

Telain commented May 19, 2023

This just gave me another error with the webapp. I ended up needing to go down to: Flask-2.0.3 & Werkzeug-2.0.3

Traceback (most recent call last):
File "/usr/local/bin/nxbt", line 8, in
sys.exit(main())
File "/usr/local/lib/python3.9/dist-packages/nxbt/cli.py", line 321, in main
from .web import start_web_app
File "/usr/local/lib/python3.9/dist-packages/nxbt/web/init.py", line 1, in
from .app import start_web_app
File "/usr/local/lib/python3.9/dist-packages/nxbt/web/app.py", line 10, in
from flask_socketio import SocketIO, emit
File "/usr/local/lib/python3.9/dist-packages/flask_socketio/init.py", line 24, in
from werkzeug.serving import run_with_reloader
ImportError: cannot import name 'run_with_reloader' from 'werkzeug.serving' (/usr/local/lib/python3.9/dist-packages/werkzeug/serving.py)

@Naibaowjk
Copy link

thank you for ur solution

@Dummydud3
Copy link
Contributor

@Telain Are you running this on a Virtual Machine or a standard installation?

@Telain
Copy link

Telain commented May 22, 2023

Standard install, on a rpi4.

@Dummydud3
Copy link
Contributor

this seems to be a problem with the source code, not being updated to python 3.10, I'm going to make a branch that fixes this soon

@Dummydud3
Copy link
Contributor

Dummydud3 commented May 22, 2023

alright so i was able to fix it the long way, this is what i did.

pip install https://github.com/eventlet/eventlet/archive/master.zip

this istalls eventlet. fixes problem 1. but this now leads to another problem.

now run sudo gedit /usr/local/lib/python3.10/dist-packages/dns/namedict.py

go to line 35, and change collections.MutableMappingto instead collections.abc.MutableMapping

Boom! Fixed! this worked for me running Ubuntu 22.04.2.

@UnderCurve
Copy link
Author

ok so what I did is I just went through it with chatgpt and yeah I got it working so just try that

@Dummydud3
Copy link
Contributor

this issue was solved, so i think we can close this issue. @Brikwerk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants