Search code examples
pythonpython-3.xpipdeepface

`AssertionError` while installing `deepface` via pip


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!


Solution

  • 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