1

I am getting the error when i deploy my python function code from azure devops pipeline. When i try from VS code, I am nnot getting this error message. I've tried a solution given in this link and still not able to resolve it.

Arun7even
  • 67
  • 1
  • 8
  • are you having the function in python? – Sajeetharan Nov 24 '20 at 13:05
  • Please share your code with us – Krzysztof Madej Nov 24 '20 at 13:12
  • @Sajeetharan - yes i have python function – Arun7even Nov 24 '20 at 15:23
  • @KrzysztofMadej - Sorry i am restricted to do that – Arun7even Nov 24 '20 at 15:23
  • Could you please share your `requirements.txt` ? – Hury Shen Nov 25 '20 at 01:20
  • @HuryShen - please find the below names, azure-functions azure-storage-blob azure-keyvault azure-identity pandas pyodbc azure-storage-file-datalake – Arun7even Nov 25 '20 at 06:17
  • May I know how did you deploy the function from local to azure ? – Hury Shen Nov 25 '20 at 06:22
  • Could you please check if the `requirements.txt` was also deployed when you deploy the function from local to azure ? And please check if the `requirements.txt` exists under correct path. – Hury Shen Nov 25 '20 at 06:25
  • @HuryShen - I am deploying the function using Azure Devops. I verified the files in the function app.. The requirements.txt file was present inside the wwwroot folder – Arun7even Nov 25 '20 at 07:16
  • Could you please have a try with this command `func azure functionapp publish --build remote` in VS code to deploy your function. – Hury Shen Nov 25 '20 at 07:19
  • If you run the command in previous comment, azure cloud will install the modules according to `requirements.txt`. You can also try this command `func azure functionapp publish --build local`. This command is used to pack all of the modules from local and deploy them to cloud. – Hury Shen Nov 25 '20 at 08:00
  • @HuryShen - From VS code, i am not getting this error. Only when i try from the devops pipeline, I am getting this error – Arun7even Nov 25 '20 at 08:04
  • I mean you can try to deploy your function from VS code by the commands I provided above, instead of deploy by devops. – Hury Shen Nov 25 '20 at 08:05
  • Or your requirement is you must deploy by devops ? – Hury Shen Nov 25 '20 at 08:08
  • I must use devops to do it – Arun7even Nov 25 '20 at 08:33
  • Ok, could you please share your YAML for Azure pipeline build ? – Hury Shen Nov 25 '20 at 08:41
  • @HuryShen - I was able to resolve the issue with the link below, [link](https://stackoverflow.com/questions/58860947/how-to-make-a-continuous-delivery-of-a-python-function-app-deployed-in-azure). Thanks! – Arun7even Nov 25 '20 at 10:25
  • Ok, could you please summarize the solution from the link as an answer for this post for other communities reference ? – Hury Shen Nov 26 '20 at 01:37
  • We have a Bash script task that install the python libraries present in the requirements.txt. python3.6 -m venv worker_venv source worker_venv/bin/activate pip3.6 install setuptools pip3.6 install -r requirements.txt I changed the above script to a new one as mentioned below pip3.6 install --target .python_packages/lib/site-packages -r requirements.txt – Arun7even Nov 26 '20 at 06:27

1 Answers1

1

Summarize the solution from the comments above for other communities reference:

Op has a Bash script task that install the python libraries present in the requirements.txt.

python3.6 -m venv worker_venv
source worker_venv/bin/activate
pip3.6 install setuptools
pip3.6 install -r requirements.txt

Just change the above script to:

pip3.6 install --target .python_packages/lib/site-packages -r requirements.txt
Hury Shen
  • 14,948
  • 1
  • 9
  • 18