Trouble installing graph-tool package on google colab

Viewed 500

I followed graph-tool installation instructions in the the following link(https://colab.research.google.com/github/count0/colab-gt/blob/master/colab-gt.ipynb#scrollTo=d_j7nNbKRmhx). However, it throws the following error


<ipython-input-3-3f634eeb007c> in <module>()
----> 1 state.draw()

/usr/lib/python3/dist-packages/graph_tool/inference/nested_blockmodel.py in draw(self, **kwargs)
    986         draws the hierarchical state."""
    987         import graph_tool.draw
--> 988         return graph_tool.draw.draw_hierarchy(self, **kwargs)
    989 
    990 

AttributeError: module 'graph_tool.draw' has no attribute 'draw_hierarchy' ```
1 Answers

The commands below worked for me. The problem was because of some dependencies with cairo lib.

!apt-get install libcairo2-dev 
!pip install pycairo

Looking for the logs, I also noted that import gi had a link fault. It was introduced too.

!sudo echo "deb http://downloads.skewed.de/apt bionic main" >> /etc/apt/sources.list
!sudo apt-key adv --keyserver keys.openpgp.org --recv-key 612DEFB798507F25
!sudo apt-get update
!sudo apt-get install python3-graph-tool python3-matplotlib
!sudo ln -s /usr/lib/python3/dist-packages/gi/_gi.cpython-{36m,37m}-x86_64-linux-gnu.so
Related