Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Python packages in Azure function code

I've created an Azure function and want to be able to use various packages in the Python code for the function; take Numpy, for example. Obviously, the code is not going to run from my local machine once it's published to Azure. This means I can't install Numpy to whatever infrastructure it runs on, so I can't import Numpy in my code. How can I use a package like Numpy in the code?

like image 769
supernova Avatar asked Nov 29 '25 19:11

supernova


1 Answers

From the official doc:

Dependencies are obtained remotely based on the contents of the requirements.txt file

All you need to do is create that file and upload it together with your Function code

https://learn.microsoft.com/en-us/azure/azure-functions/functions-reference-python#python-version-and-package-management

like image 199
Thiago Custodio Avatar answered Dec 01 '25 21:12

Thiago Custodio



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!