Search code examples
pythonpython-3.xvisual-studio-codeazure-functionsazure-function-async

VSCode issue with setting python version to 3.10 on Azure function sample


I am trying to run the Azure python function with Fast API locally and hit into this issue

https://github.com/Azure-Samples/fastapi-on-azure-functions/issues/7

The last one suggests upgrading to the 3.10 version of python to solve the issue. However when i try to upgrade in vs code , i get the errors below

enter image description here

When i try to manually add the path

enter image description here

I am not that familiar with all python ENV setups, any suggestions will be helpful

EDIT:

Yes, Here are all the versions I have on the machine

enter image description here


Solution

  • Below are the python versions installed in my windows system: enter image description here

    When creating the Azure Function Python App in the VS code, it is not showing the Python 3.10.x version interpreter:

    enter image description here

    In this step, click on Skip virtual environment and create the required trigger function.

    You can select the Python 3.10.x version interpret after creating the trigger function:

    enter image description here

    py -m pip install --user virtualenv
    py -m venv env
    .\env\Scripts\activate
    py -m pip install -r requirements.txt
    

    Run the above cmdlets to activate virtual environment taken, taken from the Python Packages Source.

    So that you can be able to see the current python version for the current Azure Function in VS Code:

    enter image description here