AttributeError: 'NoneType' object has no attribute 'excluded_of'

房东的猫 提交于 2021-02-04 15:42:25

问题


I am getting attribute error while installing the dependencies via pip

Traceback (most recent call last):
  File "/home/jpg/.virtual_env/cloud/lib/python3.6/site-packages/pip/_internal/cli/base_command.py", line 210, in _main
    status = self.run(options, args)
  File "/home/jpg/.virtual_env/cloud/lib/python3.6/site-packages/pip/_internal/cli/req_command.py", line 180, in wrapper
    return func(self, options, args)
  File "/home/jpg/.virtual_env/cloud/lib/python3.6/site-packages/pip/_internal/commands/install.py", line 319, in run
    reqs, check_supported_wheels=not options.target_dir
  File "/home/jpg/.virtual_env/cloud/lib/python3.6/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 122, in resolve
    requirements, max_rounds=try_to_avoid_resolution_too_deep,
  File "/home/jpg/.virtual_env/cloud/lib/python3.6/site-packages/pip/_vendor/resolvelib/resolvers.py", line 445, in resolve
    state = resolution.resolve(requirements, max_rounds=max_rounds)
  File "/home/jpg/.virtual_env/cloud/lib/python3.6/site-packages/pip/_vendor/resolvelib/resolvers.py", line 344, in resolve
    success = self._backtrack()
  File "/home/jpg/.virtual_env/cloud/lib/python3.6/site-packages/pip/_vendor/resolvelib/resolvers.py", line 287, in _backtrack
    criterion = self.state.criteria[name].excluded_of([candidate])
AttributeError: 'NoneType' object has no attribute 'excluded_of'

My requirements.txt looks like as

celery==5.0.2
billiard<4.0,>=3.6.0
redis==3.5.3
redis-log-handler==0.0.1.dev32

回答1:


Update - 1 (on 2020-12-27)

The issue has been fixed in pip==20.3.3 and thus you will not receive this exception.

But, (here) the redis-log-handler==0.0.1.dev32 depends on redis==3.0.1 but, you have redis==3.5.3 on the requirements.txt and hence the dependencies will not resolve. So, you will further receive and an error (I would say, a validation error) as,

ERROR: Cannot install -r requirements.txt (line 4) and redis==3.5.3 because these package versions have conflicting dependencies.

The conflict is caused by: The user requested redis==3.5.3 redis-log-handler 0.0.1.dev32 depends on redis==3.0.1

To fix this you could try to:

  1. loosen the range of package versions you've specified
  2. remove package versions to allow pip attempt to solve the dependency conflict

This error report is pretty much helpful and it is time to adjust your package dependencies.

Note: If you are not interested in adjusting the dependencies and want to resolve it as before, go though the below section


Original Post

This is an issue with pip version 20.3 and not yet fixed fixed in pip==20.3.3.

Method 1

Install the previous stable version of the pip (20.2.X) by,

pip install --upgrade pip~=20.2.0

Method 2

Use --use-deprecated flag while installing the requirements

pip install -r requirements.txt --use-deprecated=legacy-resolver


来源:https://stackoverflow.com/questions/65085051/attributeerror-nonetype-object-has-no-attribute-excluded-of

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!