Cannot get TopologicalSorter from graphlib

Viewed 247

I did

pip3 install graphlib

I can now import graphlib, but

from graphlib import TopologicalSorter

fails. If I import graphlib, it tells me that there is no attibute TopologicalSorter.

What am I doing wrong?

1 Answers

Confusingly, graphlib on PyPI is not the real graphlib, so you don’t have the right package installed.

You need to replace graphlib’s evil twin with the real thing:

pip3 uninstall graphlib
pip3 install graphlib-backport
Related