1

I recently had to bump a google cloud library due to a conflict that was generating a bug. Long story short, I had

google-cloud-pubsub==1.4.2

which I had to bump to 1.4.3. This in turn reverted google-api-core module to 1.16.0, which generated a conflict with another module google-cloud-secret-manager which required a higher version of google-api-core.

Now, I have removed google-cloud-secret-manager. But, If I try to install the module again to the last version however, it will bump me google-api-core to a version not compatible with google-cloud-pubsub. What I want to do instead is to pip install google-cloud-secret-manager to the highest possible version that is compatible with google-api-core==1.16.0 without manually trying to install all the versions until i find the right match. Is it something possible? Is there a pip install fix dependency version command that could allow me to easily install google-cloud-secret-manager that will not change the version of the dependency module google-api-core to a different version? Thank you

DarioB
  • 1,349
  • 2
  • 21
  • 44
  • Does this answer your question? [How to pip install a package with min and max version range?](https://stackoverflow.com/questions/8795617/how-to-pip-install-a-package-with-min-and-max-version-range) – omuthu Sep 28 '21 at 16:05
  • no sorry, that's not the question. `a_guest` answered though. – DarioB Sep 28 '21 at 17:23

1 Answers1

1

You can achieve this with a constraints file. Just put all your constraints into that file:

google-api-core==1.16.0

Then you can install via:

python -m pip install -c constraints.txt google-cloud-secret-manager

This will try every version of google-cloud-secret-manager, starting from the most recent version, until it finds a version that is compatible with the given constraints.

a_guest
  • 34,165
  • 12
  • 64
  • 118