astral-sh / setup-uv

Set up your GitHub Actions workflow with a specific version of https://docs.astral.sh/uv/
MIT License
157 stars 10 forks source link

Confused about how to use without a virtualenv #124

Open ngoldbaum opened 2 hours ago

ngoldbaum commented 2 hours ago

I feel like I'm going against the grain here and maybe that's the issue.

I'd like to replace setup-python with setup-uv. Our existing CI uses python from setup-python directly, without setting up a virtualenv.

Is it possible to use uv in a similar way? Basically, I'd like to install directly into the global environment associated with a uv python install command. When I try to actually do that, I see errors like:

Run uv pip install --python=3.13t -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple cython

error: No virtual environment found for Python 3.13t; run `uv venv` to create an environment, or pass `--system` to install into a non-virtual environment

Is the right thing to do here to put uv's python at the front of the PATH and then pass --system? Or just use a virtualenv? If it's the latter, then this is not quite a drop-in replacement for setup-python, since that's not necessary with setup-python.

ngoldbaum commented 2 hours ago

And if I put the path to the uv-managed python at the front of my PATH environment variable, and then try to install something into its environment with uv pip install --system, I get errors like:

  error: The interpreter at /home/runner/.local/share/uv/python/cpython-3.12.7-linux-x86_64-gnu is externally managed, and indicates the following:

    This Python installation is managed by uv and should not be modified.

  Consider creating a virtual environment with `uv venv`.