Skip to content

[Python/uv] Installed packages not available in PATH at runtime on Azure Web Apps #2703

@anguzo

Description

@anguzo

Bug Report

  • At what date and time did you most recently experience the problem?

November 11-13, 2025 (after refactoring the project to use Oryx uv build with pyproject.toml and uv.lock)


  • Where did you experience the problem?

Azure Web Apps with OneDeploy deployment


  • If your repo is publicly available please share its URL:

Not publicly available (proprietary codebase)


  • What happened?

After migrating from pip-based dependency management (requirements.txt with a single wheel dependency) to Oryx uv build with pyproject.toml and uv.lock, the FastAPI application startup command using uvicorn fails with command not found errors. The command uvicorn --host 0.0.0.0 --timeout-keep-alive 600 api.app:app no longer works, and when attempting to reference fastapi or uvicorn in the startup command, they are not detected by Oryx.

The workaround is to use gunicorn (which is part of Oryx's default env it seems) with the UvicornWorker: gunicorn --bind 0.0.0.0 --worker-class uvicorn.workers.UvicornWorker --timeout 600 app_api.app:app


  • What did you expect or want to happen?

Expected Oryx to properly resolve and install all dependencies from uv.lock/pyproject.toml, making uvicorn and fastapi available in the environment PATH and accessible as startup commands, similar to how Gunicorn works by default. The uvicorn command worked before with requirements.txt with a single wheel dependency approach.


  • How can we reproduce it?
  1. Create a FastAPI application and build it as wheel (initialize uv project, add FastAPI as dependency and create simple app, build using uv)
  2. Set up pyproject.toml with a local path source pointing to the FastAPI wheel file
    Example:
[project]
name = "app-api-env"
version = "1.0.0"
requires-python = ">=3.11,<3.12"
dependencies = [
    "app-api"
]

[tool.uv.sources]
app-api = { path = "./app_api-1.0.0-py3-none-any.whl" }
  1. Add .python-version file (e.g., 3.11.14)
  2. Generate uv.lock using uv lock
  3. Create a zip archive with: .python-version, pyproject.toml, uv.lock, and the wheel file
  4. Deploy to Azure Web Apps via OneDeploy
  5. Configure startup command to use uvicorn directly
  6. Observe that uvicorn is not found, while gunicorn works

  • Do you have log output?

Oryx build logs:

Command: oryx build /tmp/zipdeploy/extracted -o /home/site/wwwroot --platform python --platform-version 3.11 -p virtualenv_name=antenv --log-file /tmp/build-debug.log  -i /tmp/8de2221eb1a7684 --compress-destination-dir | tee /tmp/oryx-build.log
Operation performed by Microsoft Oryx, https://github.com/Microsoft/Oryx
You can report issues at https://github.com/Microsoft/Oryx/issues

Oryx Version: 0.2.20251022.1+bef98bc7139feefaa74be16de9d835e2c85385d4, Commit: bef98bc7139feefaa74be16de9d835e2c85385d4, ReleaseTagName: 20251022.1

Build Operation ID: 7e77f12a21092fa2
Repository Commit : 32711c8d-5481-43dc-81d1-890d2599a096
OS Type           : bullseye
Image Type        : githubactions

Primary SDK Storage URL: https://oryx-cdn.microsoft.io
Backup SDK Storage URL: 
Detecting platforms...
External SDK provider is enabled.
Requesting metadata for platform python from external SDK provider
Requesting metadata for platform python from external SDK provider
Detected following platforms:
  python: 3.11.14

Using intermediate directory '/tmp/8de2221eb1a7684'.

Copying files to the intermediate directory...
Done in 0 sec(s).

Source directory     : /tmp/8de2221eb1a7684
Destination directory: /home/site/wwwroot

Python Version: /tmp/oryx/platforms/python/3.11.14/bin/python3.11
Creating directory for command manifest file if it does not exist
Removing existing manifest file
Python Virtual Environment: antenv
Detected uv.lock (and no requirements.txt); creating virtual environment with uv...
Installing uv...
Requirement already satisfied: uv in /tmp/oryx/platforms/python/3.11.14/lib/python3.11/site-packages (0.9.8)
WARNING: You are using pip version 21.2.4; however, version 25.3 is available.
You should consider upgrading via the '/tmp/oryx/platforms/python/3.11.14/bin/python3.11 -m pip install --upgrade pip' command.
Creating virtual environment...
Executing: uv venv --link-mode=copy --system-site-packages antenv
Using CPython 3.11.14 interpreter at: /tmp/oryx/platforms/python/3.11.14/bin/python3.11
Creating virtual environment at: antenv
Activating virtual environment...
Activate with: source antenv/bin/activate
Detected uv.lock. Installing dependencies with uv...
Resolved 147 packages in 305ms
Installed 144 packages in 22.73s
...
 + fastapi==0.119.0
 + fastapi-cli==0.0.13
 + uvicorn==0.37.0
 + uvloop==0.22.1
 + pydantic==2.11.9
 + pydantic-core==2.33.2
 + pydantic-settings==2.11.0
...
Not a vso image, so not writing build commands
Preparing output...

Copying files to destination directory '/tmp/_preCompressedDestinationDir'...
Done in 8 sec(s).
Compressing content of directory '/tmp/_preCompressedDestinationDir'...
Copied the compressed output to '/home/site/wwwroot'

Removing existing manifest file
Creating a manifest file...
Manifest file created.
Copying .ostype to manifest output directory.

Done in 77 sec(s).

App startup log stream:

2025-11-13T09:46:44.6478428Z    _____
2025-11-13T09:46:45.1088439Z   /  _  \ __________ _________   ____
2025-11-13T09:46:45.1088521Z  /  /_\  \\___   /  |  \_  __ \_/ __ \
2025-11-13T09:46:45.1088545Z /    |    \/    /|  |  /|  | \/\  ___/
2025-11-13T09:46:45.1088566Z \____|__  /_____ \____/ |__|    \___  >
2025-11-13T09:46:45.1088594Z         \/      \/                  \/
2025-11-13T09:46:45.1088645Z A P P   S E R V I C E   O N   L I N U X
2025-11-13T09:46:45.1088684Z
2025-11-13T09:46:45.1088712Z Documentation    : http://aka.ms/webapp-linux
2025-11-13T09:46:45.1088736Z Python quickstart: https://aka.ms/python-qs
2025-11-13T09:46:45.1088759Z Python version   : 3.11.14
2025-11-13T09:46:45.1088782Z Instance Name    : lw1sdlwk000440
2025-11-13T09:46:45.1088824Z Instance Id      : 06ee8e058892d3bcc0310bd0877b1f58ac68a9b24a958d6e7c43ecc45755d8c3
2025-11-13T09:46:45.1088861Z
2025-11-13T09:46:45.1088883Z Note: Any data outside '/home' is not persisted
2025-11-13T09:46:47.7077712Z Starting OpenBSD Secure Shell server: sshd.
2025-11-13T09:46:47.7685242Z WEBSITES_INCLUDE_CLOUD_CERTS is not set to true.
2025-11-13T09:46:48.020871Z Updating certificates in /etc/ssl/certs...
2025-11-13T09:47:23.3373568Z rehash: warning: skipping duplicate certificate in azl_Sectigo_Public_Server_Authentication_Root_R46.pem
2025-11-13T09:47:23.3622631Z rehash: warning: skipping duplicate certificate in azl_Sectigo_Public_Server_Authentication_Root_E46.pem
2025-11-13T09:47:23.3790077Z rehash: warning: skipping duplicate certificate in azl_SSL.com_TLS_RSA_Root_CA_2022.pem
2025-11-13T09:47:23.4630908Z rehash: warning: skipping duplicate certificate in azl_SSL.com_TLS_ECC_Root_CA_2022.pem
2025-11-13T09:47:23.6432126Z 4 added, 0 removed; done.
2025-11-13T09:47:23.6777688Z Running hooks in /etc/ca-certificates/update.d...
2025-11-13T09:47:23.710653Z done.
2025-11-13T09:47:23.7627653Z CA certificates copied and updated successfully.
2025-11-13T09:47:24.0997768Z Site's appCommandLine: uvicorn --host 0.0.0.0 --timeout-keep-alive 600 app_api.app:app
2025-11-13T09:47:25.4968413Z Starting periodic command scheduler: cron.
2025-11-13T09:47:25.4969217Z Launching oryx with: create-script -appPath /home/site/wwwroot -output /opt/startup/startup.sh -virtualEnvName antenv -defaultApp /opt/defaultsite -userStartupCommand 'uvicorn --host 0.0.0.0 --timeout-keep-alive 600 app_api.app:app'
2025-11-13T09:47:25.8488339Z Found build manifest file at '/home/site/wwwroot/oryx-manifest.toml'. Deserializing it...
2025-11-13T09:47:25.8657318Z Build Operation ID: 7e77f12a21092fa2
2025-11-13T09:47:25.9379167Z Oryx Version: 0.2.20251017.2, Commit: 482d4c55e818733ab33b9d2131f9dc485a21fd03, ReleaseTagName: 20251017.2
2025-11-13T09:47:25.9650799Z Output is compressed. Extracting it...
2025-11-13T09:47:25.9651209Z Extracting '/home/site/wwwroot/output.tar.gz' to directory '/tmp/8de2221eb1a7684'...
2025-11-13T09:48:03.4675273Z App path is set to '/tmp/8de2221eb1a7684'
2025-11-13T09:48:03.5013687Z Writing output script to '/opt/startup/startup.sh'
2025-11-13T09:48:03.949212Z Using packages from virtual environment antenv located at /tmp/8de2221eb1a7684/antenv.
2025-11-13T09:48:04.5740047Z Updated PYTHONPATH to '/opt/startup/app_logs:/tmp/8de2221eb1a7684/antenv/lib/python3.11/site-packages'
2025-11-13T09:48:04.5740785Z /opt/startup/startup.sh: 26: uvicorn: not found

Additional context: The app successfully deploys, and the dependencies appear to be installed (since gunicorn can use the UvicornWorker), suggesting this is an environment resolution or PATH issue within Oryx's uv integration rather than a dependency resolution failure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions