uv icon indicating copy to clipboard operation
uv copied to clipboard

`uv pip install` does not install any new dependencies

Open skshetry opened this issue 1 year ago • 7 comments

Let's say I have a project with the following dependencies, and installed the package using:

cat pyproject.toml
uv pip install -e "."
# pyproject.toml

[project]
name = "test-project"
version = "0.0.1"
dependencies = ["fsspec"]

And, later if I add any new dependencies, doing uv pip install -e "." does not pick new dependencies and/or install them, unless I pass --upgrade.

[project]
name = "test-project"
version = "0.0.1"
dependencies = ["fsspec", "s3fs"]
$ uv pip install -e "."
Audited 1 package in 3ms
$ uv pip install -e "." --upgrade
   Built file:///private/var/folders/xh/trg29z296h70n109kwfk6g800000gn/T/tmp.tP1hZ9RVUH                                                Built 1 editable in 1.00s
Resolved 18 packages in 685ms
Downloaded 5 packages in 142ms
Installed 17 packages in 79ms
 + aiobotocore==2.11.2
 + aiohttp==3.9.3
 + aioitertools==0.11.0
 + aiosignal==1.3.1
 + attrs==23.2.0
 + botocore==1.34.34
 + frozenlist==1.4.1
 + idna==3.6
 + jmespath==1.0.1
 + multidict==6.0.5
 + python-dateutil==2.8.2
 + s3fs==2024.2.0
 + six==1.16.0
 - test-project==0.0.1 (from file:///private/var/folders/xh/trg29z296h70n109kwfk6g800000gn/T/tmp.tP1hZ9RVUH)
 + test-project==0.0.1 (from file:///private/var/folders/xh/trg29z296h70n109kwfk6g800000gn/T/tmp.tP1hZ9RVUH)
 + urllib3==2.0.7
 + wrapt==1.16.0
 + yarl==1.9.4

This differs from pip install behaviour.

uv version

uv --version
uv 0.1.4

skshetry avatar Feb 18 '24 15:02 skshetry

Agree that this should behave as you describe. I can't remember off-hand if this is due to a caching thing or something else.

charliermarsh avatar Feb 18 '24 15:02 charliermarsh

I am currently facing the same issue, but in other ways. It seems as if uv is auditing the installation of a package based on the metadata stored in the <mypackage>.dist-info directory – which is why if I delete the <mypackage> directory from a virtual environment, it successfully audits based on the metadata directory's contents and believes that <mypackage> is still installed. Of course, this isn't recommended behaviour (deleting a package's installation from the virtual environment, that is) and this problem is in-line with what pip itself does (I should probably open an issue there as well).

A potential solution to mitigate this problem could be to store the checksums of the pyproject.toml/setup.py/setup.cfg files in the uv cache and validate them at the time of the audit.

agriyakhetarpal avatar Feb 18 '24 18:02 agriyakhetarpal

I think this is fixed in version 0.1.11

danielhollas avatar Feb 26 '24 16:02 danielhollas

I'll check when it gets released. Thanks. 🙂

skshetry avatar Feb 26 '24 16:02 skshetry

The editable issue seems to be fixed, but it does not work for non-editable installs yet. :(

skshetry avatar Feb 26 '24 16:02 skshetry

@skshetry - Can you provide the exact repro for non-editable installs, just so I can track what isn't working?

charliermarsh avatar Feb 26 '24 16:02 charliermarsh

cat pyproject.toml
uv pip install "test-project @ ."
[project]
name = "test-project"
version = "0.0.1"
dependencies = ["fsspec"]

After I add a dependency, say, s3fs, and run the above script again, it does not install new dependencies unless I add --upgrade.

cat pyproject.toml
uv pip install "test-project @ ."
[project]
name = "test-project"
version = "0.0.1"
dependencies = ["fsspec", "s3fs"]
$ uv pip install "test-project @ ."
Audited 1 package in 3ms

$ uv pip install "test-project @ ." --upgrade                                                                                    
Resolved 18 packages in 1.80s
   Built test-project @ file:///private/var/folders/xh/trg29z296h70n109kwfk6g800000gn/T/tmp.MLCVX8rwMP                                 Downloaded 1 package in 1.15s
Installed 17 packages in 66ms
 + aiobotocore==2.11.2
 + aiohttp==3.9.3
 + aioitertools==0.11.0
 + aiosignal==1.3.1
 + attrs==23.2.0
 + botocore==1.34.34
 + frozenlist==1.4.1
 + idna==3.6
 + jmespath==1.0.1
 + multidict==6.0.5
 + python-dateutil==2.8.2
 + s3fs==2024.2.0
 + six==1.16.0
 - test-project==0.0.1 (from file:///private/var/folders/xh/trg29z296h70n109kwfk6g800000gn/T/tmp.MLCVX8rwMP)
 + test-project==0.0.1 (from file:///private/var/folders/xh/trg29z296h70n109kwfk6g800000gn/T/tmp.MLCVX8rwMP)
 + urllib3==2.0.7
 + wrapt==1.16.0
 + yarl==1.9.4

skshetry avatar Feb 26 '24 16:02 skshetry