lxdui
lxdui copied to clipboard
json package error on fresh install
Summary
Found this issue at runtime: ImportError: cannot import name 'json' from 'itsdangerous' on Ubuntu 20.04 LTS Server ... and found a workaround to fix it
Full Error Message
(lxdui) sa@hive:~/lxdui$ python3 run.py
Traceback (most recent call last):
File "run.py", line 1, in <module>
from app.cli.cli import lxdui
File "/home/sa/lxdui/app/cli/cli.py", line 6, in <module>
from app.api import core
File "/home/sa/lxdui/app/api/core.py", line 3, in <module>
from flask import Flask, redirect
File "/home/sa/lxdui/lib/python3.8/site-packages/Flask-1.0.2-py3.8.egg/flask/__init__.py", line 21, in <module>
from .app import Flask, Request, Response
File "/home/sa/lxdui/lib/python3.8/site-packages/Flask-1.0.2-py3.8.egg/flask/app.py", line 25, in <module>
from . import cli, json
File "/home/sa/lxdui/lib/python3.8/site-packages/Flask-1.0.2-py3.8.egg/flask/json/__init__.py", line 21, in <module>
from itsdangerous import json as _json
ImportError: cannot import name 'json' from 'itsdangerous' (/home/sa/lxdui/lib/python3.8/site-packages/itsdangerous-2.1.0-py3.8.egg/itsdangerous/__init__.py)
Workaround
Noticed this message on this page: itsdangerous Changelog "Importing itsdangerous.json is deprecated. Import Python’s json module instead."
Modified: /home/sa/lxdui/lib/python3.8/site-packages/Flask-1.0.2-py3.8.egg/flask/json/init.py
# Use the same json implementation as itsdangerous on which we
# depend anyways.
# mod by DJ
# from itsdangerous import json as _json
import json as _json
It's a bit of a hack but it seems to work. Happens on fresh install with Ubuntu 20.04 LTS Server.
Dave
Yea got the same error,
ImportError: cannot import name 'json' from 'itsdangerous' (/usr/local/lib/python3.9/dist-packages/itsdangerous-2.1.2-py3.9.egg/itsdangerous/__init__.py)
Ubuntu Server 21.10 "Impish Indri" (64bits)
I was able to fix it by manually installing itsdangerous==2.0.1
and Werkzeug==2.0.0
Try running the pip commands below
pip3 install itsdangerous==2.0.1
pip3 install Werkzeug==2.0.0
Same issue ubuntu server 21.10