Unable to deploy a python flask wervice

I am trying to creatre a webservice out of flask python , its failing with fillowing error message
ImportError: cannot import name ‘soft_unicode’ from ‘markupsafe’ (/opt/render/project/src/.venv/lib/python3.11/site-packages/markupsafe/init.py)

i have these in my requirements.txt
flask==1.1.2

jinja2==2.11.2

requests==2.24.0

jsonify==0.5

thanks

Hi there,

These kind of errors are typically caused by dependency and/or language version conflicts/mismatches. Here’s a Stack Overflow thread that discusses this very error: https://stackoverflow.com/questions/72191560/importerror-cannot-import-name-soft-unicode-from-markupsafe.

Let us know if you have any further questions.

Regards,
Mike


Render Support Engineer, MT (UTC-7)

No I see this error message
Error: module ‘inspect’ has no attribute ‘getargspec’

Hi!
Make sure your render instance has the same python version as your Venv. you can specifyit using the instance environment variables: PYTHON_VERSION

Hi there,

The new error looks like a variation of the same problem as before.

Pime Panama (thanks for contributing!) has the right idea here: you need to ensure the Python version is compatible with all the dependency versions you’ve specified. If this is working in your local environment, be sure all the versions on the Render service match the versions being used locally.

Regards,
Mike


Render Support Engineer, MT (UTC-7)

I’m having the same issue: Error: module ‘inspect’ has no attribute ‘getargspec’

How do we change our python version? is it in Docker? because that isn’t helping

Hi there,

You can set the Python version for a native environment by following these instructions: https://docs.render.com/python-version. With Docker, you have complete control over the environment, so I would defer to a Python/Docker community regarding the best way there.

Regards,
Mike


Render Support Engineer, MT (UTC-7)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.