close

[Solved] ImportError: cannot import name ‘json’ from ‘itsdangerous’

Today I am trying to deploy the flask app but I am facing the following error ImportError: cannot import name ‘json’ from ‘itsdangerous’ in Flask. We are going to Learn about All Possible Solutions So Lets Get Start with This Article.

How ImportError: cannot import name ‘json’ from ‘itsdangerous’ Error Occurs ?

I am trying to deploy the flask app but I am facing the following error.

ImportError: cannot import name 'json' from 'itsdangerous'

How To Solve ImportError: cannot import name ‘json’ from ‘itsdangerous’ Error ?

  1. How To Solve ImportError: cannot import name ‘json’ from ‘itsdangerous’ Error ?

    To Solve ImportError: cannot import name ‘json’ from ‘itsdangerous’ Error If Solution 1 not worked for you then Just Downgrade itsdangerous to 2.0.1 and it will solve your above problem. Just run this command: pip install itsdangerous==2.0.1 Now, Your error must be solved.

  2. ImportError: cannot import name ‘json’ from ‘itsdangerous’

    To Solve ImportError: cannot import name ‘json’ from ‘itsdangerous’ Error You Just need to Update Flask to 2.0+ supported versions are 2.0.1, 2.0.2, 2.0.3 You can use any of these versions and it will solve your error. Just run this command: pip install Flask==2.0.1 OR pip install Flask==2.0.2 OR pip install Flask==2.0.3 Now, Your issue must be solved.

Solution 1: Upgrade Flask to 2.0+

You Just need to Update Flask to 2.0+ supported versions are 2.0.1, 2.0.2, 2.0.3 You can use any of these versions and it will solve your error. Just run this command.

pip install Flask==2.0.1

OR

pip install Flask==2.0.2

OR

pip install Flask==2.0.3

Now, Your issue must be solved.

Solution 2: Downgrade itsdangerous

If Solution 1 not worked for you then Just Downgrade itsdangerous to 2.0.1 and it will solve your above problem. Just run this command.

pip install itsdangerous==2.0.1

Now, Your error must be solved.

Solution 3: Use this version

In my case, I used flask==1.1.4, itsdangerous==1.1.0, and markupsafe==1.1.1 which worked fine so you just need to use all versions. Just install this version with the below command. Just run this command in your terminal one by one.

pip install flask==1.1.4
pip install itsdangerous==1.1.0
pip install markupsafe==1.1.1

Now, your error must be solved.

Solution 4: Downgrade Flask

I Just downgraded Flask to 1.1.4 and the error was solved. Just run this command in your terminal.

pip install flask==1.1.4

Now, the Problem must be solved.

Summary

It’s all About this error. Hope We solved Your error. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?

Also, Read

Leave a Comment