Igraph for python3 plotting using pycairo on mac OScatalina (10.15.4)

would appreciate if someone can help regarding whak cairo to install and how to run with python3. I have successfully installed python-igraph and everything works fine. However, as suggested, I installed cairo (from Apple App), that didn’t work, so I installed pycairo as suggested in https://stackoverflow.com/questions/36225410/installing-cairo-and-pycairo-mac-osx
However, I am still getting error-

import igraph
from igraph import *
g = Graph([(0,1), (0,2), (2,3), (3,4), (4,2), (2,5), (5,0), (6,3), (5,6)])
layout = g.layout("kk")
plot(g, layout = layout)

I get the following error:

TypeError                                 Traceback (most recent call last)
<ipython-input-6-7287e5fd2e0f> in <module>()
      7 print(g.degree())
      8 layout = g.layout("kk")
----> 9 plot(g, layout = layout)

~/anaconda3/lib/python3.6/site-packages/igraph/drawing/__init__.py in plot(obj, target, bbox, *args, **kwds)
    453         bbox = BoundingBox(bbox)
--> 455     result = Plot(target, bbox, background=kwds.get("background", "white"))
    457     if "margin" in kwds:

~/anaconda3/lib/python3.6/site-packages/igraph/drawing/__init__.py in __init__(self, target, bbox, palette, background)
    118         """
    119         self._filename = None
--> 120         self._surface_was_created = not isinstance(target, cairo.Surface)
    121         self._need_tmpfile = False

~/anaconda3/lib/python3.6/site-packages/igraph/drawing/utils.py in __getattr__(self, _)
    395     def __getattr__(self, _):
--> 396         raise TypeError("plotting not available")
    397     def __call__(self, _):
    398         raise TypeError("plotting not available")

TypeError: plotting not available

Thank you. Sid

You seem to be missing the pycairo library still, which is the Python interface for the cairo library. I am not immediately familiar with installing cairo from the Apple App. Perhaps you can install cairo and pycairo using brew or MacPorts.

The easiest solution however, I think, is simply installing python-igraph using Anaconda. This automatically installs all dependencies, including pycairo and cairo.

Thank you so much. It works. Command is

conda install -c conda-forge python-igraph

Then restart anaconda.