在 ubuntu 中安装 igraph 时出现 Anaconda 错误,未知类型名称 ‘igraph_layout_grid_t, gcc failed
Posted
技术标签:
【中文标题】在 ubuntu 中安装 igraph 时出现 Anaconda 错误,未知类型名称 ‘igraph_layout_grid_t, gcc failed【英文标题】:Install igraph in ubuntu with Anaconda error, unknown type name ‘igraph_layout_grid_t, gcc failed 【发布时间】:2016-10-13 14:44:22 【问题描述】:我刚刚用它安装了 anaconda 和 jupyter notebook。我用 pip 安装了 igraph,但是在尝试导入时,我遇到了类似于这里提到的错误 ImportError igraph: undefined symbol 。然后我从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 是: 来自 /home/user/anaconda2/lib/python2.7/site-packages 的 pip 8.1.2 (python 2.7)
【问题讨论】:
【参考方案1】:这是您已安装或 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/__init__.py in以上是关于在 ubuntu 中安装 igraph 时出现 Anaconda 错误,未知类型名称 ‘igraph_layout_grid_t, gcc failed的主要内容,如果未能解决你的问题,请参考以下文章
在 Ubuntu 中安装 Torch 时出现 CMake 错误
在 Ubuntu 11.10 的 virtualenv 中安装“numpy”