ImportError: cannot import name Graph

I’ve installed c-igraph a few days ago, and now I’m installing python-igraph using

pip3 install python-igraph

Then run one small program to check igraph is working or not.But its showing-

from igraph import Graph
ImportError: cannot import name ‘Graph’ from partially initialized module ‘igraph’ (most likely due to a circular import)

After that, I checked the python version using

python

import igraph

Traceback (most recent call last):
File “”, line 1, in
File “igraph.py”, line 1, in
from igraph import Graph
ImportError: cannot import name Graph

You are using a file named igraph.py. In this case, import igraph or from igraph import * refers to the file itself, not to the globally installed igraph module. Rename your file to something else.

1 Like

ok… Now it’s showing-

from igraph import *
File “/usr/local/lib/python3.8/dist-packages/igraph/init.py”, line 8, in
raise DeprecationWarning("To avoid name collision with the igraph project, "
DeprecationWarning: To avoid name collision with the igraph project, this visualization library has been renamed to ‘jgraph’. Please upgrade when convenient.

Most likely you installed this library and not this one – or you installed both and the two conflict with each other.

Thank You.
It’s working now.