endpoints
endpoints

Reputation: 15

Azure function app failed to deployment because of spacy-transformer module

torch is not installing and getting failed and I need that module so is there any option to get it done with requirement.txt

enter image description here

Upvotes: 0

Views: 658

Answers (1)

Jahnavi
Jahnavi

Reputation: 8008

Torch is not installing and getting failed, and I need that module so is there any option to get it done with requirement.txt:

This seems to be an issue with oryx build releases and that is why deployment patch is failing with an error oryx deployment files doesn't exists and unable to fetch the logs also.

After I've done a workaround,

To avoid this, I added ENABLE_ORYX_BUILD = false in function app->Configuration-> Application Settings (App that will deploy my function) Portal as shown:

enter image description here

After doing it, I've installed torch & torchvision modules with the compatible versions by using:

pip install torch===1.8.0 torchvision===0.9.0 -f https://download.pytorch.org/whl/torch_stable.html

Note: If the provided torch & torch_vision versions are not compatible then it throws an error asking us to check the dependencies to avoid conflicts.

enter image description here

And

pip install -r requirements.txt

requirements.txt:

azure-functions==1.12.0 //Give latest version
requests==2.28.1
torch==1.8.0
torchvision==0.9.0 
typing_extensions==4.4.0

Sometimes requirements.txt file will not get properly configured. To avoid that, Freeze the requirements by using terminal:

pip freeze > requirements.txt

I created an Azure function with python runtime stack, it worked for me and deployment got succeeded:

enter image description here

Triggered successfully after deployment and function app is running:

enter image description here

Verification in Azure Portal:

enter image description here

Version_check:

Python_Version: Python 3.9.3 (taken)

Upgrade pip to the latest version if prompted.

PyTorch: pytorch.org

Restart the Visual Studio code (ctrl + shift + p) by viewing command palette -> Reload the window and clear cache to avoid module conflicts if needed.

Upvotes: 1

Related Questions