1

I am trying to deploy an azure function written using python to an azure function app. The function is using pyzbar library. The pyzbar library documentation says that in a Linux environment, the below command needs to be executed so that the pyzbar can work.

sudo apt-get install libzbar0

How can I execute this command on the consumption plan. Please note that I can get this to work if I deploy the function with a container approach using a premium or a dedicated plan. But I want to get this to work using the consumption plan.

Any help is highly appreciated.

1 Answers1

0
  • I have a work around where every time you trigger your function it will run a script that will install the required packages using the command prompt.

  • This can be achieved using subprocess module

code :

subprocess.run(["apt-get"," install"," libzbar0"])

for Example in the following code I am installing pandas using pip and returning it's version.

enter image description here

  • But this will increase your execution time as even if you have added the packages it will continue to execute the installation commands every time you trigger the function.
Mohit Ganorkar
  • 1,917
  • 2
  • 6
  • 11