我有一个PythonFlask 应用程序,我想将其部署到Azure Web应用程序.
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.
然后,部署成功后,我在Web应用程序的Azure shell中运行pip list
(antenv虚拟环境处于活动状态)以查看已安装的内容并获得没有openai
的列表.如果我列出venv文件夹的内容,它将包含我想要安装的所有包.
这是构建作业(job)的yaml:
- 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?
编辑:
这是我完成pip install
步后的pip list
分:
h11 0.14.0
httpcore 1.0.3
httpx 0.26.0
idna 3.6
isodate 0.6.1
itsdangerous 2.1.2
Jinja2 3.1.3
langdetect 1.0.9
MarkupSafe 2.1.5
msrest 0.7.1
numpy 1.26.4
oauthlib 3.2.2
openai 1.12.0
openpyxl 3.1.2
pandas 2.2.0
pip 24.0
PyAudio 0.2.14
pydantic 2.6.1
pydantic_core 2.16.2
python-dateutil 2.8.2
python-dotenv 1.0.1
pytz 2024.1
requests 2.31.0
requests-oauthlib 1.4.0
setuptools 65.5.0
six 1.16.0
sniffio 1.3.0
SpeechRecognition 3.10.1
tqdm 4.66.2
typing_extensions 4.9.0
tzdata 2024.1
urllib3 2.2.0
waitress 3.0.0
Werkzeug 3.0.1
WTForms 3.1.2
这是在Azure SSH shell的venv中运行pip list
的结果:
Package Version
-------------------- -------
appsvc-code-profiler 1.0.0
blinker 1.7.0
click 8.1.7
debugpy 1.8.1
distlib 0.3.8
filelock 3.13.1
Flask 3.0.2
gunicorn 21.2.0
itsdangerous 2.1.2
Jinja2 3.1.3
markdown-it-py 3.0.0
MarkupSafe 2.1.5
mdurl 0.1.2
objprint 0.2.3
orjson 3.8.10
packaging 24.0
pip 24.0
platformdirs 4.2.0
psutil 5.9.8
Pygments 2.17.2
rich 13.7.1
setuptools 69.1.0
subprocess32 3.5.4
virtualenv 20.25.1
vizplugins 0.1.3
viztracer 0.15.6
Werkzeug 3.0.1
wheel 0.42.0