Ask Your Question

Revision history [back]

Re: igraph import error. I installed sage (sagemath) on Arch Linux,

[victoria@victoria ~]$ pacman -Ss sagemath | grep -i installed
    community/sage-data-elliptic_curves 0.8.1-1 [installed]
    community/sagemath 8.7-4 [installed]

[victoria@victoria ~]$ which sage
    /usr/bin/sage

In my Python 3.7 venv:

(/home/victoria/venv/py37) [victoria@victoria ~]$ sage
┌────────────────────────────────────────────────┐
│ SageMath version 8.7, Release Date: 2019-03-23 │
│ Using Python 2.7.16. Type "help()" for help.   │
└────────────────────────────────────────────────┘
  ## NOTE: even in py37 venv, using sage's py27

sage: import igraph
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-73ffca960e68> in <module>()
----> 1 import igraph

ImportError: No module named igraph
sage:                                                                                                                                       
Exiting Sage (CPU time 0m0.11s, Wall time 1m13.47s).

# ----------------------------------------
## Need system (Arch Linux) install of: python2-igraph

[victoria@victoria ~]$ pacman -Ss igraph | grepic python
    A program for computing automorphism groups of graphs and digraphs
community/python-igraph 0.7.1.post6-5 [installed]
    Python bindings for the igraph library
community/python2-igraph 0.7.1.post6-5
    Python 2 bindings for the igraph library

[victoria@victoria ~]$ sudo pacman -S python2-igraph
  ...
  (1/1) installing python2-igraph  [#################################] 100%

# ----------------------------------------

[victoria@victoria ~]$ sage

┌────────────────────────────────────────────────┐
│ SageMath version 8.7, Release Date: 2019-03-23 │
│ Using Python 2.7.16. Type "help()" for help.   │
└────────────────────────────────────────────────┘
sage: from sage import *
sage: import igraph
sage: