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

FR: List and repair broken uv tool venvs (e.g. after a python upgrade). #8028

Open
ilyagr opened this issue Oct 9, 2024 · 2 comments
Open
Labels
enhancement New feature or improvement to existing functionality uv tool Related to the uv tool interface

Comments

@ilyagr
Copy link
Contributor

ilyagr commented Oct 9, 2024

In the transcript below, I upgrade from Python 3.12.6 to 3.12.7 and all my uv tool install-ed tools break because the symlinks to python are broken. The problem is that uv can't handle these broken environments very well.

Currently, uv tool upgrade does not work as seen in the transcript. uv tool install works, but does not remember how the tool was installed originally, which is a problem if the tool needs a non-trivial command line to be installed correctly, e.g.:

# Commands like these are needed to work around `uv tool upgrade`
# not working.
uv tool install xonsh[full]
uv tool install marimo[sql] --with polars --with pandas  --with pyarrow \
                            --with matplotlib --with altair --with ruff
uv tool install --from \
   https://github.com/jjlee/git-meld-index/archive/release.zip git-meld-index

I would like either a uv tool repair command to repair such tools or for uv tool upgrade to be able to repair them. I'd also like uv tool list to work better for such tools.

Fortunately, the uv-receipt.toml file in the tool's venv already has all the needed info, so I'm guessing some feature like this was planned. (Let me know if there's already a way to do it that I missed!)

Related: #1640, #7287. I feel like, even if those issues are solved, it'd still be nice if uv handled broken tool venvs better.

Also related: #7892

Transcript illustrating the problem

$ uv --version  # I'm on Mac OS on ARM
uv 0.4.20 (0e1b25a53 2024-10-08)
$ uv tool list
git-meld-index v0.2.4
- git-meld-index
- git-meld-index-run-merge-tool
marimo v0.9.4
- marimo
poetry v1.8.3
- poetry
pxpx v3.6.5
- ptop
- px
- pxtree
xonsh v0.18.3
- xonsh
- xonsh-cat
- xonsh-uname
- xonsh-uptime
$ uv python install 3.12
Searching for Python versions matching: Python 3.12
Found existing installation for Python 3.12: cpython-3.12.6-macos-aarch64-none
$ uv python install 3.12 --reinstall
Searching for Python versions matching: Python 3.12
Found existing installation for Python 3.12: cpython-3.12.6-macos-aarch64-none
Installed Python 3.12.7 in 1.38s
 - cpython-3.12.6-macos-aarch64-none
 + cpython-3.12.7-macos-aarch64-none
$ marimo
exec: Failed to execute process '/Users/ilyagr/.local/bin/marimo': The file specified the interpreter '/Users/ilyagr/.local/share/uv/tools/marimo/bin/python', which is not an executable command.
$ uv tool upgrade marimo --python 3.12
`marimo` is not installed; run `uv tool install marimo` to install
$ uv tool list
Python interpreter not found at `/Users/ilyagr/.local/share/uv/tools/git-meld-index/bin/python3`
Python interpreter not found at `/Users/ilyagr/.local/share/uv/tools/marimo/bin/python3`
Python interpreter not found at `/Users/ilyagr/.local/share/uv/tools/poetry/bin/python3`
Python interpreter not found at `/Users/ilyagr/.local/share/uv/tools/pxpx/bin/python3`
Python interpreter not found at `/Users/ilyagr/.local/share/uv/tools/xonsh/bin/python3`
$ uv tool upgrade --all --python 3.12
Failed to upgrade `git-meld-index`: `git-meld-index` is not installed; run `uv tool install git-meld-index` to install
Failed to upgrade `marimo`: `marimo` is not installed; run `uv tool install marimo` to install
Failed to upgrade `poetry`: `poetry` is not installed; run `uv tool install poetry` to install
Failed to upgrade `pxpx`: `pxpx` is not installed; run `uv tool install pxpx` to install
Failed to upgrade `xonsh`: `xonsh` is not installed; run `uv tool install xonsh` to install
@ilyagr ilyagr changed the title FR: Better handling for broken uv tool venvs (e.g. after a python upgrade). FR: List and repair broken uv tool venvs (e.g. after a python upgrade). Oct 9, 2024
@zanieb
Copy link
Member

zanieb commented Oct 9, 2024

@zanieb
Copy link
Member

zanieb commented Oct 9, 2024

uv tool repair sounds kind of cool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or improvement to existing functionality uv tool Related to the uv tool interface
Projects
None yet
Development

No branches or pull requests

2 participants