Skip to content

Issue using index-url for seeding during @test.virtualenv intialization #65131

@jguthrie100

Description

@jguthrie100

Under which category would you file this issue?

Airflow Core

Apache Airflow version

3.0.6

What happened and how to reproduce it?

When using the @task.virtualenv tag, we get an expected error failing to fetch pip, due to company firewall rules:

[2026-04-13, 11:46:55] INFO - Executing cmd: uv venv --allow-existing --seed --python python --system-site-packages /tmp/venvvb7fapaz: source="airflow.utils.process_utils"
[2026-04-13, 11:46:55] INFO - Output:: source="airflow.utils.process_utils"
[2026-04-13, 11:46:55] INFO - Using CPython 3.12.11 interpreter at: /usr/local/bin/python: source="airflow.utils.process_utils"
[2026-04-13, 11:46:55] INFO - Creating virtual environment with seed packages at: /tmp/venvvb7fapaz: source="airflow.utils.process_utils"
[2026-04-13, 11:48:59] INFO - error: Failed to install seed packages into virtual environment: source="airflow.utils.process_utils"
[2026-04-13, 11:48:59] INFO -   Caused by: No solution found when resolving: `pip`: source="airflow.utils.process_utils"
[2026-04-13, 11:48:59] INFO -   Caused by: Failed to fetch: `https://pypi.org/simple/pip/`: source="airflow.utils.process_utils"
[2026-04-13, 11:48:59] INFO -   Caused by: Request failed after 3 retries: source="airflow.utils.process_utils"
[2026-04-13, 11:48:59] INFO -   Caused by: error sending request for url (https://pypi.org/simple/pip/): source="airflow.utils.process_utils"
[2026-04-13, 11:48:59] INFO -   Caused by: operation timed out: source="airflow.utils.process_utils"

I've tried numerous ways to mitigate this, including:

Setting index_url in the tag
@task.virtualenv(task_id="test1", system_site_packages=True, index_urls=["company_pip_url"])

Setting $UV_INDEX_URL env var
Setting $UV_INDEX_URL on the server where uv is run from, to our pip uri

None of those work.

The underlying command is uv venv --allow-existing --seed --python python --system-site-packages /tmp/venvvb7fapaz which doesn't work (also when I run it manually)

But if I manually run the following then it works:
uv venv --allow-existing --seed --python python --system-site-packages /tmp/venv_12345 --index-url https://pip_url

It also works if I manually set $UV_INDEX_URL and run the already-standard command:
uv venv --allow-existing --seed --python python --system-site-packages /tmp/venv_12345


I would be happy to create a fix of sorts by setting --index-url when the uv command is generated (

cmd = ["uv", "venv", "--allow-existing", "--seed", "--python", python_bin]
), but I'm assuming there is already a way to make this work?

What you think should happen instead?

I would expect the initial uv command to use the index-url stored in either an environment variable, or set via index_urls.

Operating System

Debian GNU/Linux 12 (bookworm)

Deployment

None

Apache Airflow Provider(s)

No response

Versions of Apache Airflow Providers

No response

Official Helm Chart version

Not Applicable

Kubernetes Version

No response

Helm Chart configuration

No response

Docker Image customizations

No response

Anything else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind:bugThis is a clearly a bugneeds-triagelabel for new issues that we didn't triage yet

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions