在mac上安装python igraph anaconda

时间:2015-05-15 14:54:14

标签: python macos install igraph anaconda

我决定在我的mac上卸载并重新安装anigraph的igraph包。我开始遇到一些问题 - 我查看了所有链接,并尝试了以下内容......

brew install pkg-config --> already installed
brew install igraph --> installed and linked

但由于我使用的是anaconda,我不能使用brew安装版本的igraph(如果不是这样,请纠正我)

当我跑...

pip install python-igraph

我得到以下输出

Collecting python-igraph
  Using cached python-igraph-0.7.1-4.tar.gz
Installing collected packages: python-igraph
  Running setup.py install for python-igraph
    Complete output from command /Users/anaconda/bin/python -c "import setuptools, tokenize;__file__='/private/var/folders/hf/dgm4r02n3kx64ghsykphgg1m0000gn/T/pip-build-95UXS3/python-igraph/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/hf/dgm4r02n3kx64ghsykphgg1m0000gn/T/pip-xOYTT7-record/install-record.txt --single-version-externally-managed --compile:
    /Users/anaconda/lib/python2.7/site-packages/setuptools-15.1-py2.7.egg/setuptools/dist.py:282: UserWarning: Normalizing '0.7.1-4' to '0.7.1.post4'
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.5-x86_64-2.7
    creating build/lib.macosx-10.5-x86_64-2.7/igraph
    copying igraph/__init__.py -> build/lib.macosx-10.5-x86_64-2.7/igraph
    copying igraph/clustering.py -> build/lib.macosx-10.5-x86_64-2.7/igraph
    copying igraph/compat.py -> build/lib.macosx-10.5-x86_64-2.7/igraph
    copying igraph/configuration.py -> build/lib.macosx-10.5-x86_64-2.7/igraph
    copying igraph/cut.py -> build/lib.macosx-10.5-x86_64-2.7/igraph
    copying igraph/datatypes.py -> build/lib.macosx-10.5-x86_64-2.7/igraph
    copying igraph/formula.py -> build/lib.macosx-10.5-x86_64-2.7/igraph
    copying igraph/layout.py -> build/lib.macosx-10.5-x86_64-2.7/igraph
    copying igraph/matching.py -> build/lib.macosx-10.5-x86_64-2.7/igraph
    copying igraph/statistics.py -> build/lib.macosx-10.5-x86_64-2.7/igraph
    copying igraph/summary.py -> build/lib.macosx-10.5-x86_64-2.7/igraph
    copying igraph/utils.py -> build/lib.macosx-10.5-x86_64-2.7/igraph
    creating build/lib.macosx-10.5-x86_64-2.7/igraph/test
    copying igraph/test/__init__.py -> build/lib.macosx-10.5-x86_64-2.7/igraph/test
    copying igraph/test/atlas.py -> build/lib.macosx-10.5-x86_64-2.7/igraph/test
    copying igraph/test/attributes.py -> build/lib.macosx-10.5-x86_64-2.7/igraph/test
    copying igraph/test/basic.py -> build/lib.macosx-10.5-x86_64-2.7/igraph/test
    copying igraph/test/bipartite.py -> build/lib.macosx-10.5-x86_64-2.7/igraph/test
    copying igraph/test/cliques.py -> build/lib.macosx-10.5-x86_64-2.7/igraph/test
    copying igraph/test/colortests.py -> build/lib.macosx-10.5-x86_64-2.7/igraph/test
    copying igraph/test/conversion.py -> build/lib.macosx-10.5-x86_64-2.7/igraph/test
    copying igraph/test/decomposition.py -> build/lib.macosx-10.5-x86_64-2.7/igraph/test
    copying igraph/test/edgeseq.py -> build/lib.macosx-10.5-x86_64-2.7/igraph/test
    copying igraph/test/flow.py -> build/lib.macosx-10.5-x86_64-2.7/igraph/test
    copying igraph/test/foreign.py -> build/lib.macosx-10.5-x86_64-2.7/igraph/test
    copying igraph/test/games.py -> build/lib.macosx-10.5-x86_64-2.7/igraph/test
    copying igraph/test/generators.py -> build/lib.macosx-10.5-x86_64-2.7/igraph/test
    copying igraph/test/homepage.py -> build/lib.macosx-10.5-x86_64-2.7/igraph/test
    copying igraph/test/indexing.py -> build/lib.macosx-10.5-x86_64-2.7/igraph/test
    copying igraph/test/isomorphism.py -> build/lib.macosx-10.5-x86_64-2.7/igraph/test
    copying igraph/test/iterators.py -> build/lib.macosx-10.5-x86_64-2.7/igraph/test
    copying igraph/test/layouts.py -> build/lib.macosx-10.5-x86_64-2.7/igraph/test
    copying igraph/test/matching.py -> build/lib.macosx-10.5-x86_64-2.7/igraph/test
    copying igraph/test/operators.py -> build/lib.macosx-10.5-x86_64-2.7/igraph/test
    copying igraph/test/rng.py -> build/lib.macosx-10.5-x86_64-2.7/igraph/test
    copying igraph/test/separators.py -> build/lib.macosx-10.5-x86_64-2.7/igraph/test
    copying igraph/test/spectral.py -> build/lib.macosx-10.5-x86_64-2.7/igraph/test
    copying igraph/test/structural.py -> build/lib.macosx-10.5-x86_64-2.7/igraph/test
    copying igraph/test/utils.py -> build/lib.macosx-10.5-x86_64-2.7/igraph/test
    copying igraph/test/vertexseq.py -> build/lib.macosx-10.5-x86_64-2.7/igraph/test
    creating build/lib.macosx-10.5-x86_64-2.7/igraph/app
    copying igraph/app/__init__.py -> build/lib.macosx-10.5-x86_64-2.7/igraph/app
    copying igraph/app/shell.py -> build/lib.macosx-10.5-x86_64-2.7/igraph/app
    creating build/lib.macosx-10.5-x86_64-2.7/igraph/drawing
    copying igraph/drawing/__init__.py -> build/lib.macosx-10.5-x86_64-2.7/igraph/drawing
    copying igraph/drawing/baseclasses.py -> build/lib.macosx-10.5-x86_64-2.7/igraph/drawing
    copying igraph/drawing/colors.py -> build/lib.macosx-10.5-x86_64-2.7/igraph/drawing
    copying igraph/drawing/coord.py -> build/lib.macosx-10.5-x86_64-2.7/igraph/drawing
    copying igraph/drawing/edge.py -> build/lib.macosx-10.5-x86_64-2.7/igraph/drawing
    copying igraph/drawing/graph.py -> build/lib.macosx-10.5-x86_64-2.7/igraph/drawing
    copying igraph/drawing/metamagic.py -> build/lib.macosx-10.5-x86_64-2.7/igraph/drawing
    copying igraph/drawing/shapes.py -> build/lib.macosx-10.5-x86_64-2.7/igraph/drawing
    copying igraph/drawing/text.py -> build/lib.macosx-10.5-x86_64-2.7/igraph/drawing
    copying igraph/drawing/utils.py -> build/lib.macosx-10.5-x86_64-2.7/igraph/drawing
    copying igraph/drawing/vertex.py -> build/lib.macosx-10.5-x86_64-2.7/igraph/drawing
    creating build/lib.macosx-10.5-x86_64-2.7/igraph/remote
    copying igraph/remote/__init__.py -> build/lib.macosx-10.5-x86_64-2.7/igraph/remote
    copying igraph/remote/gephi.py -> build/lib.macosx-10.5-x86_64-2.7/igraph/remote
    copying igraph/remote/nexus.py -> build/lib.macosx-10.5-x86_64-2.7/igraph/remote
    creating build/lib.macosx-10.5-x86_64-2.7/igraph/vendor
    copying igraph/vendor/__init__.py -> build/lib.macosx-10.5-x86_64-2.7/igraph/vendor
    copying igraph/vendor/texttable.py -> build/lib.macosx-10.5-x86_64-2.7/igraph/vendor
    running build_ext
    Build type: dynamic extension
    Include path: /usr/local/Cellar/igraph/0.6.5/include/igraph
    Library path: /usr/local/Cellar/igraph/0.6.5/lib
    Linked dynamic libraries: igraph
    Linked static libraries: 
    Extra compiler options: 
    Extra linker options: 
    building 'igraph._igraph' extension
    creating build/temp.macosx-10.5-x86_64-2.7
    creating build/temp.macosx-10.5-x86_64-2.7/src
    gcc -fno-strict-aliasing -I/Users/anaconda/include -arch x86_64 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/local/Cellar/igraph/0.6.5/include/igraph -I../../build/include -I../../include -I/usr/local/include/igraph -I/usr/include/igraph -I/Users/anaconda/include/python2.7 -c src/arpackobject.c -o build/temp.macosx-10.5-x86_64-2.7/src/arpackobject.o
    gcc -fno-strict-aliasing -I/Users/anaconda/include -arch x86_64 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/local/Cellar/igraph/0.6.5/include/igraph -I../../build/include -I../../include -I/usr/local/include/igraph -I/usr/include/igraph -I/Users/anaconda/include/python2.7 -c src/attributes.c -o build/temp.macosx-10.5-x86_64-2.7/src/attributes.o
    In file included from src/attributes.c:26:
    src/convert.h:65:59: error: unknown type name 'igraph_pagerank_algo_t'
    int igraphmodule_PyObject_to_pagerank_algo_t(PyObject *o, igraph_pagerank_algo_t *result);
                                                              ^
    src/attributes.c:307:12: error: use of undeclared identifier 'IGRAPH_ATTRIBUTE_BOOLEAN'
          case IGRAPH_ATTRIBUTE_BOOLEAN:
               ^
    src/attributes.c:455:14: error: use of undeclared identifier 'IGRAPH_ATTRIBUTE_BOOLEAN'
            case IGRAPH_ATTRIBUTE_BOOLEAN:
                 ^
    src/attributes.c:514:14: error: use of undeclared identifier 'IGRAPH_ATTRIBUTE_BOOLEAN'
            case IGRAPH_ATTRIBUTE_BOOLEAN:
                 ^
    src/attributes.c:638:14: error: use of undeclared identifier 'IGRAPH_ATTRIBUTE_BOOLEAN'
            case IGRAPH_ATTRIBUTE_BOOLEAN:
                 ^
    src/attributes.c:699:14: error: use of undeclared identifier 'IGRAPH_ATTRIBUTE_BOOLEAN'
            case IGRAPH_ATTRIBUTE_BOOLEAN:
                 ^
    src/attributes.c:1367:27: error: use of undeclared identifier 'IGRAPH_ATTRIBUTE_BOOLEAN'
              VECTOR(*t)[j] = IGRAPH_ATTRIBUTE_BOOLEAN;
                              ^
    src/attributes.c:1457:13: error: use of undeclared identifier 'IGRAPH_ATTRIBUTE_BOOLEAN'
        *type = IGRAPH_ATTRIBUTE_BOOLEAN;
                ^
    src/attributes.c:1832:3: warning: incompatible pointer types initializing 'int (*)(const igraph_t *, const char *, igraph_vs_t, igraph_vector_t *)' with an expression of type 'int (const igraph_t *, const char *, igraph_vector_bool_t *)' [-Wincompatible-pointer-types]
      igraphmodule_i_get_boolean_graph_attr,
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    src/attributes.c:1833:3: warning: incompatible pointer types initializing 'int (*)(const igraph_t *, const char *, igraph_vs_t, igraph_strvector_t *)' with an expression of type 'int (const igraph_t *, const char *, igraph_vs_t, igraph_vector_t *)' [-Wincompatible-pointer-types]
      igraphmodule_i_get_numeric_vertex_attr,
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    src/attributes.c:1834:3: warning: incompatible pointer types initializing 'int (*)(const igraph_t *, const char *, igraph_es_t, igraph_vector_t *)' with an expression of type 'int (const igraph_t *, const char *, igraph_vs_t, igraph_strvector_t *)' [-Wincompatible-pointer-types]
      igraphmodule_i_get_string_vertex_attr,
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    src/attributes.c:1835:3: warning: incompatible pointer types initializing 'int (*)(const igraph_t *, const char *, igraph_es_t, igraph_strvector_t *)' with an expression of type 'int (const igraph_t *, const char *, igraph_vs_t, igraph_vector_bool_t *)' [-Wincompatible-pointer-types]
      igraphmodule_i_get_boolean_vertex_attr,
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    src/attributes.c:1836:3: warning: excess elements in struct initializer
      igraphmodule_i_get_numeric_edge_attr,
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    5 warnings and 8 errors generated.
    error: command 'gcc' failed with exit status 1

    ----------------------------------------
    Command "/Users/anaconda/bin/python -c "import setuptools, tokenize;__file__='/private/var/folders/hf/dgm4r02n3kx64ghsykphgg1m0000gn/T/pip-build-95UXS3/python-igraph/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/hf/dgm4r02n3kx64ghsykphgg1m0000gn/T/pip-xOYTT7-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/hf/dgm4r02n3kx64ghsykphgg1m0000gn/T/pip-build-95UXS3/python-igraph

1 个答案:

答案 0 :(得分:1)

这是您在计算机上的igraph的C核心版本(0.6.5)与您尝试编译的Python接口版本(0.7.1-4)之间的版本不匹配。你需要:

brew uninstall igraph
brew update
brew install igraph

这将安装igraph 0.7.1(编译后用brew info igraph验证),然后你就可以使用pip install python-igraph了。