Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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
like image 366
JPG Avatar asked Dec 01 '20 05:12

JPG


1 Answers

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
like image 77
JPG Avatar answered Oct 04 '22 13:10

JPG