在ubuntu中安装igraph时出现Anaconda错误,未知类型名称‘;igraph\u layout\u grid\t,gcc失败

在ubuntu中安装igraph时出现Anaconda错误,未知类型名称‘;igraph\u layout\u grid\t,gcc失败,anaconda,igraph,Anaconda,Igraph,我刚刚用它安装了anaconda和jupyter笔记本。我安装了带有pip的igraph,但在尝试导入时,出现了与此处提到的错误类似的未定义错误。然后我从github下载了C内核并安装了它。在此之后,我用pip卸载了igraph并尝试再次安装,但出现以下错误: pip install python-igraph/ Processing ./python-igraph Building wheels for collected packages: python-igraph Runn

我刚刚用它安装了anaconda和jupyter笔记本。我安装了带有pip的igraph,但在尝试导入时,出现了与此处提到的错误类似的未定义错误。然后我从github下载了C内核并安装了它。在此之后,我用pip卸载了igraph并尝试再次安装,但出现以下错误:

     pip install python-igraph/
Processing ./python-igraph
Building wheels for collected packages: python-igraph
  Running setup.py bdist_wheel for python-igraph ... error
  Complete output from command /home/user/anaconda2/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-c5SEuP-build/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /tmp/tmp5_FYxLpip-wheel- --python-tag cp27:
  running bdist_wheel
  running build
  running build_py
  running build_ext
  Build type: static extension
  Include path: igraphcore/include
  Library path: igraphcore/lib /usr/local/lib /usr/lib /lib64 /lib
  Runtime library path:
  Linked dynamic libraries: xml2 z m stdc++
  Linked static libraries: igraphcore/lib/libigraph.a
  Extra compiler options:
  Extra linker options:
  building 'igraph._igraph' extension
  gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Iigraphcore/include -I/home/user/anaconda2/include/python2.7 -c src/filehandle.c -o build/temp.linux-x86_64-2.7/src/filehandle.o
  gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Iigraphcore/include -I/home/user/anaconda2/include/python2.7 -c src/vertexobject.c -o build/temp.linux-x86_64-2.7/src/vertexobject.o
  In file included from src/vertexobject.c:26:0:
  src/convert.h:63:57: error: unknown type name ‘igraph_layout_grid_t’
   int igraphmodule_PyObject_to_layout_grid_t(PyObject *o, igraph_layout_grid_t *result);
                                                           ^
  src/convert.h:66:63: error: unknown type name ‘igraph_random_walk_stuck_t’
   int igraphmodule_PyObject_to_random_walk_stuck_t(PyObject *o, igraph_random_walk_stuck_t *result);
                                                                 ^
  error: command 'gcc' failed with exit status 1

  ----------------------------------------
  Failed building wheel for python-igraph
  Running setup.py clean for python-igraph
Failed to build python-igraph
Installing collected packages: python-igraph
  Running setup.py install for python-igraph ... error
    Complete output from command /home/user/anaconda2/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-c5SEuP-build/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-PAY3R3-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-2.7
    creating build/lib.linux-x86_64-2.7/igraph
    copying igraph/__init__.py -> build/lib.linux-x86_64-2.7/igraph
    copying igraph/utils.py -> build/lib.linux-x86_64-2.7/igraph
    copying igraph/layout.py -> build/lib.linux-x86_64-2.7/igraph
    copying igraph/formula.py -> build/lib.linux-x86_64-2.7/igraph
    copying igraph/cut.py -> build/lib.linux-x86_64-2.7/igraph
    copying igraph/configuration.py -> build/lib.linux-x86_64-2.7/igraph
    copying igraph/compat.py -> build/lib.linux-x86_64-2.7/igraph
    copying igraph/statistics.py -> build/lib.linux-x86_64-2.7/igraph
    copying igraph/matching.py -> build/lib.linux-x86_64-2.7/igraph
    copying igraph/clustering.py -> build/lib.linux-x86_64-2.7/igraph
    copying igraph/summary.py -> build/lib.linux-x86_64-2.7/igraph
    copying igraph/datatypes.py -> build/lib.linux-x86_64-2.7/igraph
    creating build/lib.linux-x86_64-2.7/igraph/test
    copying igraph/test/iterators.py -> build/lib.linux-x86_64-2.7/igraph/test
    copying igraph/test/__init__.py -> build/lib.linux-x86_64-2.7/igraph/test
    copying igraph/test/games.py -> build/lib.linux-x86_64-2.7/igraph/test
    copying igraph/test/foreign.py -> build/lib.linux-x86_64-2.7/igraph/test
    copying igraph/test/atlas.py -> build/lib.linux-x86_64-2.7/igraph/test
    copying igraph/test/conversion.py -> build/lib.linux-x86_64-2.7/igraph/test
    copying igraph/test/utils.py -> build/lib.linux-x86_64-2.7/igraph/test
    copying igraph/test/generators.py -> build/lib.linux-x86_64-2.7/igraph/test
    copying igraph/test/rng.py -> build/lib.linux-x86_64-2.7/igraph/test
    copying igraph/test/flow.py -> build/lib.linux-x86_64-2.7/igraph/test
    copying igraph/test/colortests.py -> build/lib.linux-x86_64-2.7/igraph/test
    copying igraph/test/structural.py -> build/lib.linux-x86_64-2.7/igraph/test
    copying igraph/test/decomposition.py -> build/lib.linux-x86_64-2.7/igraph/test
    copying igraph/test/spectral.py -> build/lib.linux-x86_64-2.7/igraph/test
    copying igraph/test/homepage.py -> build/lib.linux-x86_64-2.7/igraph/test
    copying igraph/test/cliques.py -> build/lib.linux-x86_64-2.7/igraph/test
    copying igraph/test/vertexseq.py -> build/lib.linux-x86_64-2.7/igraph/test
    copying igraph/test/edgeseq.py -> build/lib.linux-x86_64-2.7/igraph/test
    copying igraph/test/operators.py -> build/lib.linux-x86_64-2.7/igraph/test
    copying igraph/test/indexing.py -> build/lib.linux-x86_64-2.7/igraph/test
    copying igraph/test/matching.py -> build/lib.linux-x86_64-2.7/igraph/test
    copying igraph/test/walks.py -> build/lib.linux-x86_64-2.7/igraph/test
    copying igraph/test/basic.py -> build/lib.linux-x86_64-2.7/igraph/test
    copying igraph/test/bipartite.py -> build/lib.linux-x86_64-2.7/igraph/test
    copying igraph/test/separators.py -> build/lib.linux-x86_64-2.7/igraph/test
    copying igraph/test/layouts.py -> build/lib.linux-x86_64-2.7/igraph/test
    copying igraph/test/isomorphism.py -> build/lib.linux-x86_64-2.7/igraph/test
    copying igraph/test/attributes.py -> build/lib.linux-x86_64-2.7/igraph/test
    creating build/lib.linux-x86_64-2.7/igraph/app
    copying igraph/app/__init__.py -> build/lib.linux-x86_64-2.7/igraph/app
    copying igraph/app/shell.py -> build/lib.linux-x86_64-2.7/igraph/app
    creating build/lib.linux-x86_64-2.7/igraph/drawing
    copying igraph/drawing/__init__.py -> build/lib.linux-x86_64-2.7/igraph/drawing
    copying igraph/drawing/utils.py -> build/lib.linux-x86_64-2.7/igraph/drawing
    copying igraph/drawing/metamagic.py -> build/lib.linux-x86_64-2.7/igraph/drawing
    copying igraph/drawing/colors.py -> build/lib.linux-x86_64-2.7/igraph/drawing
    copying igraph/drawing/graph.py -> build/lib.linux-x86_64-2.7/igraph/drawing
    copying igraph/drawing/shapes.py -> build/lib.linux-x86_64-2.7/igraph/drawing
    copying igraph/drawing/baseclasses.py -> build/lib.linux-x86_64-2.7/igraph/drawing
    copying igraph/drawing/vertex.py -> build/lib.linux-x86_64-2.7/igraph/drawing
    copying igraph/drawing/coord.py -> build/lib.linux-x86_64-2.7/igraph/drawing
    copying igraph/drawing/text.py -> build/lib.linux-x86_64-2.7/igraph/drawing
    copying igraph/drawing/edge.py -> build/lib.linux-x86_64-2.7/igraph/drawing
    creating build/lib.linux-x86_64-2.7/igraph/remote
    copying igraph/remote/__init__.py -> build/lib.linux-x86_64-2.7/igraph/remote
    copying igraph/remote/nexus.py -> build/lib.linux-x86_64-2.7/igraph/remote
    copying igraph/remote/gephi.py -> build/lib.linux-x86_64-2.7/igraph/remote
    creating build/lib.linux-x86_64-2.7/igraph/vendor
    copying igraph/vendor/__init__.py -> build/lib.linux-x86_64-2.7/igraph/vendor
    copying igraph/vendor/texttable.py -> build/lib.linux-x86_64-2.7/igraph/vendor
    running build_ext
    Build type: static extension
    Include path: igraphcore/include
    Library path: igraphcore/lib /usr/local/lib /usr/lib /lib64 /lib
    Runtime library path:
    Linked dynamic libraries: xml2 z m stdc++
    Linked static libraries: igraphcore/lib/libigraph.a
    Extra compiler options:
    Extra linker options:
    building 'igraph._igraph' extension
    creating build/temp.linux-x86_64-2.7
    creating build/temp.linux-x86_64-2.7/src
    gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Iigraphcore/include -I/home/user/anaconda2/include/python2.7 -c src/filehandle.c -o build/temp.linux-x86_64-2.7/src/filehandle.o
    gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Iigraphcore/include -I/home/user/anaconda2/include/python2.7 -c src/vertexobject.c -o build/temp.linux-x86_64-2.7/src/vertexobject.o
    In file included from src/vertexobject.c:26:0:
    src/convert.h:63:57: error: unknown type name ‘igraph_layout_grid_t’
     int igraphmodule_PyObject_to_layout_grid_t(PyObject *o, igraph_layout_grid_t *result);
                                                             ^
    src/convert.h:66:63: error: unknown type name ‘igraph_random_walk_stuck_t’
     int igraphmodule_PyObject_to_random_walk_stuck_t(PyObject *o, igraph_random_walk_stuck_t *result);
                                                                   ^
    error: command 'gcc' failed with exit status 1

    ----------------------------------------
Command "/home/user/anaconda2/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-c5SEuP-build/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-PAY3R3-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-c5SEuP-build/
我正在使用ubuntu、conda版本conda 4.2.9和pip infor:
pip 8.1.2 from/home/user/anaconda2/lib/python2.7/site-packages(python 2.7)

这是您安装的或python安装程序下载的C内核与python接口版本之间的版本不匹配。从您的计算机中删除所有与igraph相关的内容,以确保您从头开始,然后只需运行
/home/user/anaconda2/bin/pip install python igraph
。这将从igraph主页下载匹配的C内核,并将其静态链接到Python界面。

按照建议安装igraph后,当我尝试导入igraph时,会出现错误:/home/user/anaconda2/lib/python2.7/site packages/igraph/\u init\u.py in()32#pylint:disable msg=W0401 33#W0401:wildcard import-->34来自igraph.#igraph import*35来自igraph.#igraph import version,从igraph.clustering导入*导入日期36:/home/user/anaconda2/lib/python2.7/site-packages/igraph//u igraph.so:未定义符号:_ZNSt7_cx1112基本_stringIcSt11char_traitssiceec1ev