`AssertionError` while installing `deepface` via pip

225 Views Asked by At

I'm trying to install deepface library via pip but it fails with AssertionError.

My system specs are:

  • OS : POP-OS 22.04
  • Python: Python-3.10.12
  • Pip: pip-22.0.2

update 01

I did the following with pip:

pip install deepface

Here's the full error message that I got:

ERROR: Exception:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pip/_internal/cli/base_command.py", line 165, in exc_logging_wrapper
    status = run_func(*args)
  File "/usr/lib/python3/dist-packages/pip/_internal/cli/req_command.py", line 205, in wrapper
    return func(self, options, args)
  File "/usr/lib/python3/dist-packages/pip/_internal/commands/install.py", line 389, in run
    to_install = resolver.get_installation_order(requirement_set)
  File "/usr/lib/python3/dist-packages/pip/_internal/resolution/resolvelib/resolver.py", line 188, in get_installation_order
    weights = get_topological_weights(
  File "/usr/lib/python3/dist-packages/pip/_internal/resolution/resolvelib/resolver.py", line 276, in get_topological_weights
    assert len(weights) == expected_node_count
AssertionError

update 02

I also tried to build from the source by following these, and it also resulted in the same error! :

git clone https://github.com/serengil/deepface.git
cd deepface
pip install -e .

Links to the deepface library for your reference:

Any help would be greatly appreciated!

4

There are 4 best solutions below

0
Musabbir Arrafi On BEST ANSWER

I solved this by installing an older version of deepface with no dependencies. also installed an older version of dlib beforehand. It seems the new release of deepface has some dependency issues with other libraries. Here's my solution that worked on my system:

pip uninstall deepface -y
pip install dlib==19.24.0
pip install --no-deps deepface==0.0.79

My system specs are:

  • OS Pop!_OS 22.04 LTS x86_64
  • python 3.10.12
  • pip 22.0.2
  • NVIDIA-SMI Driver 545.29.06
  • CUDA Version: 12.3
  • GPU 1050
  • Torch version 2.1.1+cu121
1
sefiks On

As explained in its github issue, you should upgrade pip as

python -m pip install --upgrade pip
0
A. Cloete On

I had the same issue. I figured out that deepface does not yet work with tensorflow version 2.15.0. So to solve:

pip uninstall tensorflow    
pip install tensorflow==2.14.0

Then:

pip install deepface
0
Ricardo Martins On

I solved it using the solution A. Cloete suggested, just a little different.

pip uninstall tensorflow

pip install dlib    
pip install tensorflow==2.14.0
pip install deepface

Good Look!