uv icon indicating copy to clipboard operation
uv copied to clipboard

`uv pip install` and `uv pip sync` both perform each uninstall twice causing the second one to fail

Open Daverball opened this issue 1 year ago • 3 comments

I'm running into some really strange behavior where running uv pip install causes each package to be uninstalled twice, causing a missing RECORD file error on the second uninstall. Considering I'm not passing --reinstall it shouldn't even do a single uninstall.

As far as I can tell it doesn't cause any real issues and is still a lot faster than pip this way, but it is very noisy.

I'm on Linux x86_64 (OpenSUSE Tumbleweed) with uv 0.1.28

uv pip install uv --verbose

Details

INFO Found a virtualenv through VIRTUAL_ENV at: /home/david/git/ocqms/venv
DEBUG Cached interpreter info for Python 3.10.14, skipping probing: venv/bin/python
DEBUG Using Python 3.10.14 environment at venv/bin/python
DEBUG Using registry request timeout of 300s
DEBUG Solving with target Python version 3.10.14
DEBUG Adding direct dependency: uv*
DEBUG Found fresh response for: https://pypi.org/simple/uv/
DEBUG Ignoring installed versions of uv: multiple distributions found
DEBUG Searching for a compatible version of uv (*)
DEBUG Ignoring installed versions of uv: multiple distributions found
DEBUG Selecting: uv==0.1.28 (uv-0.1.28-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl)
DEBUG Found fresh response for: https://files.pythonhosted.org/packages/bf/23/e65d0f8cd4d9904a82a616c265bb30ccc802b16226b964e9f668da26dc2b/uv-0.1.28-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata
Resolved 1 package in 2ms
DEBUG Preserving seed package: pip==23.0.1
DEBUG Preserving seed package: setuptools==69.2.0
DEBUG Preserving seed package: pip==23.0.1
DEBUG Preserving seed package: setuptools==69.2.0
DEBUG Uninstalled uv (11 files, 3 directories)
warning: Failed to uninstall package at venv/lib64/python3.10/site-packages/uv-0.1.28.dist-info due to missing RECORD file. Installation may result in an incomplete environment.
Installed 1 package in 63ms
 - uv==0.1.28
 - uv==0.1.28
 + uv==0.1.28

To me it looks like uv gets confused by there being both a lib and lib64 folder, the latter of which is a symbolic link to the former. As soon as I remove the symbolic link uv starts to behave normally. Having lib64 as an alias for lib inside virtual environments is an OpenSUSE thing as far as I am aware.

Daverball avatar Apr 03 '24 07:04 Daverball

Oh interesting. Thanks for raising!

zanieb avatar Apr 03 '24 14:04 zanieb

@zanieb - Perhaps when we iterate over site_packages, we filter out symlinks, not just duplicate paths...?

charliermarsh avatar Apr 03 '24 14:04 charliermarsh

@Daverball I put up https://github.com/astral-sh/uv/pull/2806 if you want to give it a try — I'm having a hard time constructing a test case.

zanieb avatar Apr 03 '24 14:04 zanieb

I was able to reproduce in a container.

charliermarsh avatar Apr 11 '24 22:04 charliermarsh

Fixed (with a test) in https://github.com/astral-sh/uv/pull/3002.

charliermarsh avatar Apr 11 '24 23:04 charliermarsh