Home > Back-end >  How to change MarkUpSafe version in virtual environment?
How to change MarkUpSafe version in virtual environment?

Time:02-27

I am trying to make an application using python and gRPC as shown in this article - link

I am able to run the app successfully on my terminal but to run with a frontend I need to run it as a flask app, codebase. And I am doing all this in a virtual environment.

when I run my flask command FLASK_APP=marketplace.py flask run

This is the error I get

ImportError: cannot import name 'soft_unicode' from 'markupsafe' (/Users/alex/Desktop/coding/virt/lib/python3.8/site-packages/markupsafe/__init__.py)

On researching about this error I found this link - it basically tells us that currently I am using a higher version of MarkUpSafe library than required.

So I did pip freeze --local inside the virtualenv and got MarkUpSafe version to be MarkupSafe==2.1.0

I think if I change the version of this library from 2.1.0 to 2.0.1 then the flask app might run.

How can I change this library's version from the terminal?

PS: If you think changing the version of the library won't help in running the flask app, please let me know what else can I try in this.

CodePudding user response:

If downgrading will solve the issue for you try the following code inside your virtual environment.

pip install MarkupSafe==2.0.1

  • Related