I have a Python flask app that I want to deploy to an Azure Web App.
For some reason the venv that gets created during the build is not keeping the packages that get installed and I don’t understand why.
As an example, the requirements.txt has openai==1.12.0
in it.
The build job prints Successfully installed [...] openai-1.12.0 [...]
. That sounds like it should be fine.
Then in the Azure shell of the web app after the deploy is successful I run pip list
(with the antenv virtual enviroment active) to see what is installed and get a list with no openai
. If I list the contents of the venv folder it contains all packages that I wanted installed…
This is the yaml for the build job:
- script: |
sudo apt-get install python3.11-dev portaudio19-dev
ls
python -m venv antenv
source antenv/bin/activate
python -m pip install --upgrade pip
pip install -r ./requirements.txt
workingDirectory: "$(projectRoot)"
displayName: "Install requirements"
I also tried to change the pip install
line to
pip install --target="./.python_packages/lib/site-packages" -r ./requirements.txt
with no luck, the packages are in that folder but not in use by the venv.
Am I doing anything obviously wrong? Any tips?