question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

VSC dependencies wont upgrade when version is changed in dependent repo

See original GitHub issue

Environment

  • pip version: 20.1.1
  • Python version: 2.7.12
  • OS: Ubuntu 16.04.6 LTS (xenial) 4.4.0-1060-aws

Description Installing a package from VSC doesn’t work when you bump up the package version in the VSC repo

Expected behavior I expect pip to redownload my-pkg since the version was bumped but instead it claims Requirement already satisfied

How to Reproduce Assuming this is my setup.py in my root project which declares a dependency on my-pkg

# setup.py

from setuptools import setup

setup(
  name='root_pkg'
  ...
  install_requires=[
    'beautifulsoup4 == 4.9.1',
    'my-pkg @ git+git://github.com/somewhere/my-pkg'
  ]
)
  • Running pip install . installs my-pkg correctly
  • Then make some changes in my-pkg and bump up the version
  • Run pip install . again
  • It will claim ‘Requirement already satisfied’

Possible bug location This is the gating function which decides if a package is to be skipped or installed pip._internal.resolution.legacy.resolver.Resolver. _check_skip_installed https://github.com/pypa/pip/blob/20.1.1/src/pip/_internal/resolution/legacy/resolver.py#L210

It clearly states in the doc string

Note that for vcs urls and the like we can’t assess skipping in this routine - we simply identify that we need to pull the thing down, then later on it is pulled down and introspected to assess upgrade/ reinstalls etc

It short circuits at line 240 when deciding to skip or not for my-pkg

if not self._is_upgrade_allowed(req_to_install):
if self.upgrade_strategy == "only-if-needed":
     return 'already satisfied, skipping upgrade'
return 'already satisfied'

Theres nowhere in that function, between line 210-240, which checks to see if the requirement is a link so return None

Perhaps there should be a check something along the lines of

if req_to_install.link:
   # This is a url so we need to pull down the repo first to introspect it
   return None

I could be grossly mistaken about this behaviour so feel free to correct me

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
c00kiemon5tercommented, Nov 30, 2020

hello, we bumped into the same problem. Passing --upgrade is not enough. What @vidhu is describing is correct. I tried this using pip 20.2.3 and pip 20.2.4.

I did resolve this, however, by using the new resolver. The following works as expected:

$ pip --use-feature=2020-resolver install -U package-with-updated-vcs-dependency
0reactions
Mr-Pepecommented, Sep 28, 2022

I can not reproduce this anymore with pip 22.2.2.

I created a repo on Github with the following setup.py

from setuptools import setup

setup(
  name='test_package',
  version='1.0.0',
  install_requires=[
    'wrapt',
  ]
)

I then created a local project with the following setup.py

from setuptools import setup

setup(
    name='root_pkg',
    install_requires=[
        'test_package @ git+https://github.com/Mr-Pepe/test-abc.git'
    ]
)

Running pip install . installs test_package from Github:

Looking in indexes: https://localhost:3414/root/voraus/+simple/
Processing /tmp
Preparing metadata (setup.py) ... done
Collecting test_package@ git+https://github.com/Mr-Pepe/test-abc.git
Cloning https://github.com/Mr-Pepe/test-abc.git to ./pip-install-uptgf405/test-package_8352ae0abb3f4513abdae59cdf6944e8
Running command git clone --filter=blob:none --quiet https://github.com/Mr-Pepe/test-abc.git /tmp/pip-install-uptgf405/test-package_8352ae0abb3f4513abdae59cdf6944e8
Resolved https://github.com/Mr-Pepe/test-abc.git to commit 1e5c733e680cd8a72eac63b3fde85555a1e35161
Preparing metadata (setup.py) ... done
Collecting wrapt
Using cached https://localhost:3414/root/voraus/%2Bf/40e/7bc81c9e2b273/wrapt-1.14.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (77 kB)
Using legacy 'setup.py install' for root-pkg, since package 'wheel' is not installed.
Using legacy 'setup.py install' for test_package, since package 'wheel' is not installed.
Installing collected packages: wrapt, test_package, root-pkg
Running setup.py install for test_package ... done
Running setup.py install for root-pkg ... done
Successfully installed root-pkg-0.0.0 test_package-1.0.0 wrapt-1.14.1

Adding click as a dependency to the setup.py of the Github repo, bumping the version, and running pip install . again updates test_package and installs click:

Looking in indexes: https://localhost:3414/root/voraus/+simple/
Processing /tmp
Preparing metadata (setup.py) ... done
Collecting test_package@ git+https://github.com/Mr-Pepe/test-abc.git
Cloning https://github.com/Mr-Pepe/test-abc.git to ./pip-install-jlqttg_q/test-package_b730804009cf447a96809202e2e0cc02
Running command git clone --filter=blob:none --quiet https://github.com/Mr-Pepe/test-abc.git /tmp/pip-install-jlqttg_q/test-package_b730804009cf447a96809202e2e0cc02
Resolved https://github.com/Mr-Pepe/test-abc.git to commit beec35899c025489cee5f14450cd62e918c2f4b5
Preparing metadata (setup.py) ... done
Requirement already satisfied: wrapt in ./venv/lib/python3.9/site-packages (from test_package@ git+https://github.com/Mr-Pepe/test-abc.git->root-pkg==0.0.0) (1.14.1)
Collecting click
Using cached https://localhost:3414/root/voraus/%2Bf/bb4/d8133cb15a609/click-8.1.3-py3-none-any.whl (96 kB)
Using legacy 'setup.py install' for root-pkg, since package 'wheel' is not installed.
Using legacy 'setup.py install' for test_package, since package 'wheel' is not installed.
Installing collected packages: click, test_package, root-pkg
Attempting uninstall: test_package
Found existing installation: test-package 1.0.0
Uninstalling test-package-1.0.0:
Successfully uninstalled test-package-1.0.0
Running setup.py install for test_package ... done
Attempting uninstall: root-pkg
Found existing installation: root-pkg 0.0.0
Uninstalling root-pkg-0.0.0:
Successfully uninstalled root-pkg-0.0.0
Running setup.py install for root-pkg ... done
Successfully installed click-8.1.3 root-pkg-0.0.0 test_package-1.1.0

Passing --upgrade is not required.

Read more comments on GitHub >

github_iconTop Results From Across the Web

x/tools/gopls: change behavior of dependency upgrade ...
The "Upgrade all dependencies" code lens still appears at the top of the go.mod file. We will be improving the UX of the...
Read more >
Managing Extensions in Visual Studio Code
Discover, add, update, disable and uninstall Visual Studio Code extensions ... Dependencies - Lists if the extension depends on any other extensions.
Read more >
VS Code - The git repository has too many active changes ...
Open the drop down "SOURCE CONTROL REPOSITORIES" next to the top of the source control panel and right click on the repo which...
Read more >
Problem: Unable to resolve dependencies of NuGet packages
Home Upgrade Troubleshooting upgrades Problem: Unable to resolve dependencies of ... Unable to resolve dependency 'Telerik. ... All to the desired version.
Read more >
Package dependencies - Dart
This YAML code creates a dependency on the transmogrify package using the default package repository (pub.dev) and allowing any version from 1.0.0 to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found