Bertrand
Bertrand

Reputation: 1064

Pip ignores specific package requirements from a dependency

I'm using pip to install a package that will require protobuf from multiple dependencies using different versions' requirements.

pip outputs this error enter image description here

Using pipdeptree i can see that no package requires a version of protobuf higher than 4.0 but toto.lightsteprequires a version of protobuf lower than 4.0

toto-wrapper==0.2.0
  - toto-protobuf [required: >=0.0.2, installed: 0.0.2]
    - protobuf [required: Any, installed: 4.21.5]
  - toto.lightstep [required: Any, installed: 1.4.1]
        - protobuf [required: >=3.0.0b2.post2, installed: 4.21.5]
        - protobuf [required: >=3.15.0,<5.0.0dev, installed: 4.21.5]
      - protobuf [required: >=3.6.0,<4.0, installed: 4.21.5]
  - protobuf [required: Any, installed: 4.21.5]

Isn't pip supposed to resolve this kind of requirement to install just the right version?

Edit: This happens on a fresh new environment protobuf isn't installed prior lightstep.

Upvotes: 0

Views: 117

Answers (2)

Bertrand
Bertrand

Reputation: 1064

This is actually due to an old version of pip 20.0.2. Upgrading to 22.2.2 fixed the issue.

Upvotes: 1

rgs258
rgs258

Reputation: 105

It is likely the case that protobuf was installed before toto.lightstep and so pip has a newer version than is allowed. I would suggest either:

  1. Uninstall protobuf before installing toto.lightstep, or
  2. Pin protobuf to <4.0 in your requirements

Upvotes: 1

Related Questions