jazzband / pip-tools

A set of tools to keep your pinned Python dependencies fresh.
https://pip-tools.rtfd.io
BSD 3-Clause "New" or "Revised" License
7.73k stars 612 forks source link

pip-sync reinstalls VCS package even it's installed(ssh proto) #1432

Open HemulenKnocks opened 3 years ago

HemulenKnocks commented 3 years ago

pip-sync reinstalls VCS package even if it's installed(using ssh protocol)

$ cat requirements/cube.txt
...
git+ssh://git@bitbucket.***.***.com:7999/ngc/servitel-simulator.git@de2233307e055f05d191039169fc37a23591ca66
    # via -r requirements/cube.in
...

Environment Versions

  1. OS Type:
    $ cat /proc/version
    Linux version 5.4.83-v7l+ (dom@buildbot) (gcc version 8.4.0 (Ubuntu/Linaro 8.4.0-3ubuntu1))
  2. Python version:
    $ .tox/cube/bin/python -V
    Python 3.7.3
  3. pip version:
    $ .tox/cube/bin/pip -V
    pip 21.1.2 from /home/jenkinsslave/cube-aqa/.tox/cube/lib/python3.7/site-packages/pip (python 3.7)
  4. pip-tools version: pip-tools==6.2.0

Steps to replicate

  1. pip-sync requirements/cube.txt

Actual result

Found existing installation: servitel-simulator 0.1.0
Uninstalling servitel-simulator-0.1.0:
  Successfully uninstalled servitel-simulator-0.1.0
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple, https://www.piwheels.org/simple
Collecting git+ssh://****@bitbucket.***.***.com:7999/ngc/servitel-simulator.git@de2233307e055f05d191039169fc37a23591ca66 (from -r /tmp/tmp7rs5_jz8 (line 1))
  Cloning ssh://****@bitbucket.***.***.com:7999/ngc/servitel-simulator.git (to revision de2233307e055f05d191039169fc37a23591ca66) to /tmp/pip-req-build-055a_idi
  Running command git clone -q 'ssh://****@bitbucket.***.***.com:7999/ngc/servitel-simulator.git' /tmp/pip-req-build-055a_idi
  Running command git rev-parse -q --verify 'sha^de2233307e055f05d191039169fc37a23591ca66'
  Running command git fetch -q 'ssh://****@bitbucket.***.***.com:7999/ngc/servitel-simulator.git' de2233307e055f05d191039169fc37a23591ca66
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Requirement already satisfied: pydantic<2.0.0,>=1.6.1 in ./.tox/cube/lib/python3.7/site-packages (from servitel-simulator==0.1.0->-r /tmp/tmp7rs5_jz8 (line 1)) (1.7.3)
Requirement already satisfied: pyyaml<6.0.0,>=5.3.1 in ./.tox/cube/lib/python3.7/site-packages (from servitel-simulator==0.1.0->-r /tmp/tmp7rs5_jz8 (line 1)) (5.3.1)
Building wheels for collected packages: servitel-simulator
  Building wheel for servitel-simulator (PEP 517) ... done
  Created wheel for servitel-simulator: filename=servitel_simulator-0.1.0-py3-none-any.whl size=11092 sha256=f39e8a23ee70d8a9e3e02fb131f083aae2180e138c91f4dcf1c55e2e92f5d8e6
  Stored in directory: /home/jenkinsslave/.cache/pip/wheels/40/ee/7f/ab881fe8d83de06658dca366c517f4f61d3abfe188373d036b
Successfully built servitel-simulator
Installing collected packages: servitel-simulator
Successfully installed servitel-simulator-0.1.0
joshua-cannon-techlabs commented 2 years ago

I see this too, and perhaps it should be tracked separately, but I'm also seeing pip-sync -n report that it'd uninstall/re-install.

At least the two are consistent :sweat_smile:

joshua-cannon-techlabs commented 2 years ago

This code makes it seem like using #egg=name==version would possibly alleviate the issue. It seems to work for me, so try that out!


However if I specify in my requirements.in git+https://github.com/owner/repo@branchname#egg=name==1.0.0, and pip-compile, the requirements.txt strip off the egg and version specifiers.

Might be worth filing a new issue for...

q0w commented 1 year ago

I have the same issue, but pip fails with the new backtracking resolver (no hash for the vcs dependency) as pip-tools recommends the MESSAGE_UNHASHED_PACKAGE comment. So using links like https://github.com/jazzband/pip-tools/archive/SOMECOMMIT.zip pip-sync re-installs packages.