-
Notifications
You must be signed in to change notification settings - Fork 614
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 uninstall uv
does not remove the uv script from a venv
#2330
Comments
How is which uv resolving to the version in your virtualenv? You use uv in the first line, but then the subsequent invocations hit the version in your virtualenv without activating it? |
The venv is loaded on |
This doesn't happen if uv is installed with pip:
Comparing the RECORD written by pip vs uv's: diff --git a/pip.diff b/uv.diff
index ece3d6a..2d5861c 100644
--- a/pip.diff
+++ b/uv.diff
@@ -1,13 +1,12 @@
-../../../bin/uv,sha256=Z70VmXLN-6IZ7SX3CeSNyxB0cMW4f-Gmx_pCt5zm2gk,24062288
-uv-0.1.16.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+/Users/dimitris/code/python-packaging/build/venv/bin/uv,sha256=bkGzI3Chbexd_nreYkHHjVyq-FS8BkdywctL1ZRs6_Y,46890608
+uv-0.1.16.dist-info/INSTALLER,sha256=5hhM4Q4mYTT9z6QB6PGpUAW81PGNFrYrdXMj4oM_6ak,2
+uv-0.1.16.dist-info/INSTALLER,sha256=5seyjfYzlik3jO5wuNTen-ixJCoE5KfxUnhni_eb_Oc,16
uv-0.1.16.dist-info/METADATA,sha256=lJtEXoPUCoaPaOmvua6SfL9ZLtnrNpycmhY9_ukSVGk,20860
uv-0.1.16.dist-info/RECORD,,
uv-0.1.16.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
-uv-0.1.16.dist-info/WHEEL,sha256=XZs7YqiZZBVwjUJFDH_4SF9SM8QS2rSqm6iPIRrU0Oc,103
+uv-0.1.16.dist-info/WHEEL,sha256=UKfJlVeDYE_8s37Vzf6MLY2dQV893BQmlKJY1DZ8Qbk,145
uv-0.1.16.dist-info/license_files/LICENSE-APACHE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
uv-0.1.16.dist-info/license_files/LICENSE-MIT,sha256=F5Z0Cpu8QWyblXwXhrSo0b9WmYXQxd1LwLjVLJZwbiI,1077
uv/__init__.py,sha256=zlgkDW2Sj6yTQT9qLPSSoQfVbPPwFT7edvToFy0xUK8,806
uv/__main__.py,sha256=LlzA8yRVILsEFDn5drFaTiopWuZ1K-_lnb2DK4P81qw,927
-uv/__pycache__/__init__.cpython-312.pyc,,
-uv/__pycache__/__main__.cpython-312.pyc,,
uv/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 The two notable differences appear to be that the script path is absolute for uv and that it has a duplicate INSTALLER record (though obviously only one file on disk). The shasums are different because pip installs the x64 wheel whereas uv opts for universal2. |
Thanks! |
Found the duplicate INSTALLER, just an oversight. I need to figure out how we could end up with an absolute path there. I don’t think it happens in general because we have a debug assert that the path is relative… I’ll look into it today. |
I have one idea for how it happens. |
Also, I think we should be preferring the x86 wheels, right? That seems wrong too. |
Struggling to see how this would happen. Would you mind running
|
{
"markers": {
"implementation_name": "cpython",
"implementation_version": "3.12.1",
"os_name": "posix",
"platform_machine": "x86_64",
"platform_python_implementation": "CPython",
"platform_release": "21.6.0",
"platform_system": "Darwin",
"platform_version": "Darwin Kernel Version 21.6.0: Mon Feb 19 20:24:34 PST 2024; root:xnu-8020.240.18.707.4~1/RELEASE_X86_64",
"python_full_version": "3.12.1",
"python_version": "3.12",
"sys_platform": "darwin"
},
"base_prefix": "/nix/store/g7gr0av2rkj57fqaklimdp769alxcfg1-python3-3.12.1",
"base_exec_prefix": "/nix/store/g7gr0av2rkj57fqaklimdp769alxcfg1-python3-3.12.1",
"prefix": "/Users/dimitris/code/python-packaging/build/venv",
"base_executable": "/nix/store/g7gr0av2rkj57fqaklimdp769alxcfg1-python3-3.12.1/bin/python3.12",
"sys_executable": "/Users/dimitris/code/python-packaging/build/venv/bin/python",
"stdlib": "/nix/store/g7gr0av2rkj57fqaklimdp769alxcfg1-python3-3.12.1/lib/python3.12",
"scheme": {
"platlib": "/Users/dimitris/code/python-packaging/build/venv/lib/python3.12/site-packages",
"purelib": "/Users/dimitris/code/python-packaging/build/venv/lib/python3.12/site-packages",
"include": "/Users/dimitris/code/python-packaging/build/venv/include/site/python3.12",
"scripts": "/Users/dimitris/code/python-packaging/build/venv/bin",
"data": "/Users/dimitris/code/python-packaging/build/venv"
},
"virtualenv": {
"purelib": "lib/python3.12/site-packages",
"platlib": "lib/python3.12/site-packages",
"include": "include/site/python3.12",
"scripts": "bin",
"data": ""
}
} |
Oh the x86 vs. universal might be a Nix thing. This has been reported before on Nix. |
I'm not sure if #1952 is related - I haven't installed uv with nix. |
I don't think it would matter how you install uv. The issue is what we query from the running environment and the Python interpreter. |
I have absolutely no clue how an absolute path is ending up in there though. If both |
Is there anything I can do to help, keeping in mind that I know next to nothing about Rust? 😛 |
If I put up a branch, is there any chance you'd be willing to check it out, |
Sure! |
Ok let me make sure I cover everything that might be useful 😂 |
FWIW I'm able to repro this with scripts from other packages. For non-script data files, the path is kept relative. Unsure if this is of any help, but if I'm reading the code in uv/crates/install-wheel-rs/src/wheel.rs Line 398 in cd484d5
sysconfig paths are - the bin directory path is hardcoded per plat.
|
Oh sorry, I think I was only looking at entrypoints, and not files in (BTW, I think the version you linked is stale. That line doesn't exist on |
Okay I think I can reproduce. |
Now just trying to figure out why I couldn't reproduce this earlier. Maybe I made a mistake earlier. Anyway I can fix this now! Thanks. |
Fixed in the next release, thank you and sorry for the confusion, I think my earlier debugging led me astray but pointing to that codepath was helpful. |
## Summary In #2000, I shipped a regression whereby we stopped writing relative paths for scripts within `data` directories. The net effect here is that we aren't _uninstalling_ binaries in all cases. (This does _not_ apply to entrypoints, only scripts in `data` directories.) Closes #2330. ## Test Plan Most Python packages ship entrypoints, not binaries, so I don't know how to test this cheaply. But I did test it locally by verifying that `uv` is now removed from the `bin` directory after an uninstall.
The text was updated successfully, but these errors were encountered: