I tried adding pyzbar[zbar] in the requirements.txt of my Azure Function and deployed the function app in Azure Portal successfully like below:-
My requirements.txt

I used the below commands to deploy my function app to azure from local env:-
func azure functionapp publish <function-app-name>
func azure functionapp publish <app_name> --build remote
The remote build will include pyzbar package in the deployment
Output:-

pyzbar got installed successfully like below:-

Function got deployed in Azure Portal, Refer below:-

Portal:-

Function:-

As Zbar library cannot be installed with pip cause it has a dependency on the Zbar package that needs to be installed from here- https://zbar.sourceforge.net/download.html, You can create a custom function docker image and install your Zbar library like below :-
Custom docker image :-
FROM mcr.microsoft.com/azure-functions/python:3.0
# Install zbar libraries
RUN apt-get update \
&& apt-get install -y libzbar0
Build your docker image:-
docker build -t <your_image_name> .
Update your function app to use the docker image by referencing it in Host.json like below:-
{
"version": "2.0",
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[2.*, 3.0.0)"
},
"functions": [
{
"name": "MyFunction",
"docker": {
"image": "<your_image_name>"
}
}
]
}
References:-
Refer the post's below for more insights:-
python - ImportError: Unable to find zbar shared library on Flask -
Stack
Overflow
By Mise Javier Buzzi stefan Kautuk Dwivedi
Add support to load library externally · Issue #40 ·
NaturalHistoryMuseum/pyzbar ·
GitHub By
nickovs