uv icon indicating copy to clipboard operation
uv copied to clipboard

Uninstalling then reinstalling a package produces METADATA error

Open RafailFridman opened this issue 1 year ago • 7 comments

Steps to reproduce:

  • Installing some package, let's say pandas
uv venv env1 -p 3.10
source env1/bin/activate
uv pip install pandas
  • Uninstalling it and installing it again:
uv pip uninstall pandas
uv pip install pandas
  • Produces the following error:
error: Failed to read metadata for: pandas==2.2.0
  Caused by: failed to open file `~/env1/lib/python3.10/site-packages/pandas-2.2.0.dist-info/METADATA`
  Caused by: No such file or directory (os error 2)

Am I doing something wrong?

RafailFridman avatar Feb 16 '24 18:02 RafailFridman

Hm interesting, I can't reproduce this:

❯ source .venv/bin/activate
❯ uv pip install pandas
Resolved 6 packages in 96ms
Downloaded 2 packages in 499ms
Installed 2 packages in 26ms
 + numpy==1.26.4
 + pandas==2.2.0
 
❯ uv pip uninstall pandas
Uninstalled 1 package in 87ms
 - pandas==2.2.0
 
❯ uv pip install pandas
Resolved 6 packages in 3ms
Installed 1 package in 16ms
 + pandas==2.2.0

zanieb avatar Feb 16 '24 18:02 zanieb

Hm, I tried it with different python versions, and still get this. I tried it on centos 7.9 and RHEL 9.1. What information could be useful for reproducing this? I tried running with -v flag, but it does not show anything useful for this issue

RafailFridman avatar Feb 16 '24 19:02 RafailFridman

It might be useful to see the contents of ~/env1/lib/python3.10/site-packages/pandas-2.2.0.dist-info or similar after the uninstall, and then after the second install.

charliermarsh avatar Feb 16 '24 19:02 charliermarsh

After the uninstall the folder ~/env1/lib/python3.10/site-packages/pandas-2.2.0.dist-info is empty, but it still exists After the second install attempt it remains empty.

I tried to manually remove the pandas-2.2.0.dist-info before the second installation attempt, and then the installation succeeded! So it seems that this folder was not removed during the uninstall, which causes this issue.

RafailFridman avatar Feb 16 '24 19:02 RafailFridman

Great, that's really helpful! Just confirming: it's totally empty, no dotfiles or anything, right? Will review.

charliermarsh avatar Feb 16 '24 19:02 charliermarsh

Yes, it is totally empty - nothing shows up with ls -a

Thanks!

RafailFridman avatar Feb 16 '24 20:02 RafailFridman

Thanks! I have at least one idea here.

charliermarsh avatar Feb 16 '24 20:02 charliermarsh

I checked it in version 0.1.13, and I don't get this issue anymore. Closing, I guess :)

RafailFridman avatar Mar 04 '24 15:03 RafailFridman