Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uv pip install cannot be used with non-default venv names created by uv venv without venv activation #1625

Closed
SnoopJ opened this issue Feb 18, 2024 · 3 comments
Labels
duplicate This issue or pull request already exists

Comments

@SnoopJ
Copy link

SnoopJ commented Feb 18, 2024

uv pip install does not have a workflow for installing directly into a venv previously created by uv venv (and there is no uv entrypoint in the venv that could be used instead).

This is inconvenient when using a workflow that benefits from not activating the venv whose site is being manipulated (e.g. multiple Python versions/target environments).

uv version: (0.1.4 @ fef1956)
Platform: Ubuntu 20.04
Python version: 3.9.16 provided by pyenv

Reproduction

NOTE: this invocation points directly at the uv entrypoint as a workaround for #1623.

$ ~/.pyenv/versions/3.9.16/bin/uv venv test_venv
Using Python 3.9.16 interpreter at /home/snoopjedi/.pyenv/versions/3.9.16/bin/python3
Creating virtualenv at: test_venv
$ ~/.pyenv/versions/3.9.16/bin/uv pip install numpy
error: Failed to locate a virtualenv or Conda environment (checked: `VIRTUAL_ENV`, `CONDA_PREFIX`, and `.venv`). Run `uv venv` to create a virtualenv.
$ ~/.pyenv/versions/3.9.16/bin/uv pip install --help | grep venv  # --help does not mention any venv functionality
$ source test_venv/bin/activate
$ ~/.pyenv/versions/3.9.16/bin/uv pip install numpy  # once venv is activated, install works as expected
Resolved 1 package in 41ms
Installed 1 package in 35ms
 + numpy==1.26.4
$ ls test_venv/lib/python3.9/site-packages/
__pycache__  _virtualenv.pth  _virtualenv.py  numpy  numpy-1.26.4.dist-info  numpy.libs
@zanieb
Copy link
Member

zanieb commented Feb 18, 2024

Closing in favor of #1632 and #1422

@zanieb zanieb closed this as not planned Won't fix, can't repro, duplicate, stale Feb 18, 2024
@zanieb zanieb added the duplicate This issue or pull request already exists label Feb 18, 2024
@zanieb
Copy link
Member

zanieb commented Feb 18, 2024

Thanks for the clear issue by the way! It's nicely written

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants