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

Error: cannot uninstall package occurs on installing a package a second time #6872

Closed
mweislley opened this issue Aug 30, 2024 · 5 comments · Fixed by #6881
Closed

Error: cannot uninstall package occurs on installing a package a second time #6872

mweislley opened this issue Aug 30, 2024 · 5 comments · Fixed by #6881
Assignees
Labels
compatibility Compatibility with a specification or another tool

Comments

@mweislley
Copy link

I'm working on upgrading my project to use uv and ran into this error when I installed the requirements.txt file a second time. I've narrowed it down to exactly a particular dependency that gives the error.

Reproduction steps

vscode ➜ /workspaces $ uv venv -p 3.12.3 test-venv
Using Python 3.12.3
Creating virtualenv at: test-venv
Activate with: source test-venv/bin/activate
vscode ➜ /workspaces $ source test-venv/bin/activate
(test-venv) vscode ➜ /workspaces $ uv pip install suds-community==0.8.5
Resolved 1 package in 99ms
Prepared 1 package in 65ms
Installed 1 package in 2ms
 + suds-community==0.8.5
(test-venv) vscode ➜ /workspaces $ uv pip install suds-community==0.8.5
Resolved 1 package in 1ms
error: Cannot uninstall package; `top_level.txt` file not found at: test-venv/lib/python3.12/site-packages/suds_community.egg-info/top_level.txt

Expected
Don't throw an error when installing a package that was already installed properly

I've included a more detailed output with RUST_LOG=TRACE and -v
reinstall.log

@charliermarsh
Copy link
Member

I'll take a look, thanks.

@charliermarsh
Copy link
Member

The structure of the wheel is slightly problematic... It seems to include a directory at the top-level that shouldn't be there. I'd recommend upgrading the version honestly, but we can also make uv robust to this.

@charliermarsh
Copy link
Member

Another way to explain it is that because there are two separate suds_community directories here, it appears to uv as if the package were installed twice:

❯ ls -l .venv/lib/python3.12/site-packages/
total 24
drwxr-xr-x@  3 crmarsh  staff    96 Aug 30 10:30 __pycache__
-rw-r--r--   1 crmarsh  staff    18 Aug 30 10:30 _virtualenv.pth
-rw-r--r--   1 crmarsh  staff  4378 Aug 30 10:30 _virtualenv.py
drwxr-xr-x   9 crmarsh  staff   288 Aug 30 10:31 pip
drwxr-xr-x  11 crmarsh  staff   352 Aug 30 10:30 pip-24.2.dist-info
drwxr-xr-x  28 crmarsh  staff   896 Aug 30 10:31 suds
drwxr-xr-x   9 crmarsh  staff   288 Aug 30 10:31 suds_community-0.8.5.dist-info
drwxr-xr-x   6 crmarsh  staff   192 Aug 30 10:31 suds_community.egg-info

@charliermarsh charliermarsh added the compatibility Compatibility with a specification or another tool label Aug 30, 2024
@mweislley
Copy link
Author

Thank you!
Yes, I did notice the latest version of that package doesn't have this issues (1.2.0) and I'm attempting to upgrade it but the dependency that uses it ALSO has a patch it applies to suds-community so it's becoming complicated. If uv would handle this, that would make my life easier.

@charliermarsh
Copy link
Member

Yeah totally understand -- I generally don't like "upgrade it" as a solution for users (sometimes there's no choice). I think we can be more graceful here but you might be shown a warning or something when we reinstall (rather than failing).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compatibility Compatibility with a specification or another tool
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants