简体   繁体   中英

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 在此处输入图像描述

Using pipdeptree i can see that no package requires a version of protobuf higher than 4.0 but toto.lightstep requires 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 .

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM