I have a python azure functions app deployed via azure devops in an api_env virtual environment. Similarly, I have a python flask app i.e. python backend and typescript frontend. The python backend is deployed by activate a different virtual environment called backend_env. The application backend code calls an api i.e. that was deployed as azure function. However, some of the packages used such as openai, langchain etc are in requirements.txt and are in the api_env folder on the azure function app when i look at it via debug console but the azure functions is throwing module not found error for these packages. I tried various options i.e. in addition to activating the api_env via the devops pipeline, I also added the setting in the config setting but nothing seems to help. Can anyone point me in the right direction?
`YAML code steps: - script: | python3.9 -m venv api_env source api_env/bin/activate pip install --upgrade setuptools pip3.9 install -r requirements.txt workingDirectory: $(Build.SourcesDirectory)/api/python displayName: 'Install Python dependencies for api'
- task: AzureFunctionApp@1
inputs:
azureSubscription: 'spn'
appType: 'functionAppLinux'
appName: '$(knowbot-funcapp-name)'
package: '$(System.DefaultWorkingDirectory)/api/python'
startUpCommand: |
source api_env/bin/activate
func start --python
workingDirectory: '$(System.DefaultWorkingDirectory)/api/python'
displayName: 'Deploy Function App'`
Also tried adding the below in the function init.py
sys.path.append('/home/site/wwwroot/api_env/lib/python3.9/site-packages')
I am expecting the api call to succeed.
