Open Hemanath78 opened 2 years ago
The "ImportError: cannot import name 'json' from 'itsdangerous'" error occurs due to incompatibility between Flask and itsdangerous package
. The json module has been removed from the itsdangerous package, which causes this error
. To fix this error, you can upgrade your version of Flask to version 2 or higher, which uses the TimedJSONWebSignatureSerializer method from itsdangerous instead of json
. Alternatively, you can downgrade your version of itsdangerous to version 2.0.1
pip uninstall itsdangerous
pip install itsdangerous==2.0.1
brother im getting this error everytime i run this code using flask run command
C:\Users\praty\AppData\Local\Programs\Python\Python310\lib\site-packages\sklearn\base.py:376: InconsistentVersionWarning: Trying to unpickle estimator DecisionTreeClassifier from version 0.24.1 when using version 1.4.2. This might lead to breaking code or invalid results. Use at your own risk. For more info please refer to:
https://scikit-learn.org/stable/model_persistence.html#security-maintainability-limitations
warnings.warn(
Traceback (most recent call last):
File "C:\Users\praty\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\praty\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Users\praty\AppData\Local\Programs\Python\Python310\Scripts\flask.exe__main.py", line 7, in
can you help please
Traceback (most recent call last): File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\Scripts\flask.exe__main.py", line 4, in
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\flask__init.py", line 19, in
from . import json
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\flask\json\ init__.py", line 15, in
from itsdangerous import json as _json
ImportError: cannot import name 'json' from 'itsdangerous' (C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\itsdangerous\ init__.py)