Skip to content

pip falls back to the global environment when it’s not installed in the uv virtual environment #6593

@FBen3

Description

@FBen3

platform: macOS Sonoma
uv version: uv 0.3.1 (be17d132a 2024-08-21)
reproduce:

~/Developer/Python/virtual_envs % uv venv my-venv
Using Python 3.12.2 interpreter at: /opt/homebrew/opt/python@3.12/bin/python3.12
Creating virtualenv at: my-venv
Activate with: source my-venv/bin/activate

~/Developer/Python/virtual_envs % source my-venv/bin/activate
(my-venv) ~/Developer/Python/virtual_envs % uv pip list
(my-venv) ~/Developer/Python/virtual_envs % pip list
Package    Version
---------- ---------
certifi    2021.10.8
pip        22.1.2
setuptools 58.1.0

(my-venv) ~/Developer/Python/virtual_envs % which pip
/Library/Frameworks/Python.framework/Versions/3.10/bin/pip

Can someone clarify whether this is intended behaviour?

I would expect the virtual environments to be isolated. If pip isn’t installed, trying to use it should either fail outright or provide a clear message that pip isn’t available, instead of silently falling back to the global environment. This would improve user experience and prevent mistakenly polluting the global environment.

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