简体   繁体   中英

installing python igraph anaconda on mac

I decided to uninstall and reinstall igraph package for anaconda on my mac. I started running into some issues - I've looked at all the links and have tried the following...

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

but since I'm using anaconda, I can't use the brew installed version of igraph (please correct me if this is not the case)

when I run...

pip install python-igraph

I get the following output

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

This is a version mismatch between the version of the C core of igraph that you have on your machine (0.6.5) and the version of the Python interface that you are trying to compile (0.7.1-4). You need to:

brew uninstall igraph
brew update
brew install igraph

This will install igraph 0.7.1 (verify it with brew info igraph after compilation) and then you are good to go with pip install python-igraph .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM