vtraag / louvain-igraph

Implementation of the Louvain algorithm for community detection with various methods for use with igraph in python.
GNU General Public License v3.0
246 stars 46 forks source link

failed installation on Mac OS 10.11.6 #24

Closed sunlightwang closed 6 years ago

sunlightwang commented 6 years ago

I have already installed igraph (0.7.1_6) and python_igraph (0.7.1.post6), but still failed to install louvain. See messages below:

$ pip3 install louvain Collecting louvain Using cached louvain-0.6.1.tar.gz Requirement already satisfied: python-igraph>=0.7.1.0 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/python_igraph-0.7.1.post6-py3.6-macosx-10.6-intel.egg (from louvain) Installing collected packages: louvain Running setup.py install for louvain ... error Complete output from command /Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 -u -c "import setuptools, tokenize;file='/private/var/folders/dz/lxnvmt213gv6350z7gr0lc000114/T/pip-build-hor2axqc/louvain/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /var/folders/dz/lxnvmt213gv6350z7gr0lc000114/T/pip-gf_hj07y-record/install-record.txt --single-version-externally-managed --compile: running install running build running build_py creating build creating build/lib.macosx-10.6-intel-3.6 creating build/lib.macosx-10.6-intel-3.6/louvain copying src/init.py -> build/lib.macosx-10.6-intel-3.6/louvain copying src/_version.py -> build/lib.macosx-10.6-intel-3.6/louvain copying src/functions.py -> build/lib.macosx-10.6-intel-3.6/louvain copying src/Optimiser.py -> build/lib.macosx-10.6-intel-3.6/louvain copying src/VertexPartition.py -> build/lib.macosx-10.6-intel-3.6/louvain Fixing build/lib.macosx-10.6-intel-3.6/louvain/init.py build/lib.macosx-10.6-intel-3.6/louvain/_version.py build/lib.macosx-10.6-intel-3.6/louvain/functions.py build/lib.macosx-10.6-intel-3.6/louvain/Optimiser.py build/lib.macosx-10.6-intel-3.6/louvain/VertexPartition.py Skipping optional fixer: buffer Skipping optional fixer: idioms Skipping optional fixer: set_literal Skipping optional fixer: ws_comma Fixing build/lib.macosx-10.6-intel-3.6/louvain/init.py build/lib.macosx-10.6-intel-3.6/louvain/_version.py build/lib.macosx-10.6-intel-3.6/louvain/functions.py build/lib.macosx-10.6-intel-3.6/louvain/Optimiser.py build/lib.macosx-10.6-intel-3.6/louvain/VertexPartition.py Skipping optional fixer: buffer Skipping optional fixer: idioms Skipping optional fixer: set_literal Skipping optional fixer: ws_comma UPDATING build/lib.macosx-10.6-intel-3.6/louvain/_version.py set build/lib.macosx-10.6-intel-3.6/louvain/_version.py to '0.6.1' running build_ext Build type: dynamic extension Include path: /usr/local/Cellar/igraph/0.7.1_6/include/igraph Library path: /usr/local/Cellar/igraph/0.7.1_6/lib Linked dynamic libraries: igraph Linked static libraries: Extra compiler options: Extra linker options: building 'louvain._c_louvain' extension creating build/temp.macosx-10.6-intel-3.6 creating build/temp.macosx-10.6-intel-3.6/src /usr/bin/clang -fno-strict-aliasing -Wsign-compare -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch i386 -arch x86_64 -g -Iinclude -I/usr/local/Cellar/igraph/0.7.1_6/include/igraph -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c src/CPMVertexPartition.cpp -o build/temp.macosx-10.6-intel-3.6/src/CPMVertexPartition.o /usr/bin/clang -fno-strict-aliasing -Wsign-compare -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch i386 -arch x86_64 -g -Iinclude -I/usr/local/Cellar/igraph/0.7.1_6/include/igraph -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c src/GraphHelper.cpp -o build/temp.macosx-10.6-intel-3.6/src/GraphHelper.o /usr/bin/clang -fno-strict-aliasing -Wsign-compare -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch i386 -arch x86_64 -g -Iinclude -I/usr/local/Cellar/igraph/0.7.1_6/include/igraph -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c src/LinearResolutionParameterVertexPartition.cpp -o build/temp.macosx-10.6-intel-3.6/src/LinearResolutionParameterVertexPartition.o /usr/bin/clang -fno-strict-aliasing -Wsign-compare -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch i386 -arch x86_64 -g -Iinclude -I/usr/local/Cellar/igraph/0.7.1_6/include/igraph -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c src/ModularityVertexPartition.cpp -o build/temp.macosx-10.6-intel-3.6/src/ModularityVertexPartition.o /usr/bin/clang -fno-strict-aliasing -Wsign-compare -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch i386 -arch x86_64 -g -Iinclude -I/usr/local/Cellar/igraph/0.7.1_6/include/igraph -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c src/MutableVertexPartition.cpp -o build/temp.macosx-10.6-intel-3.6/src/MutableVertexPartition.o In file included from src/MutableVertexPartition.cpp:1: In file included from include/MutableVertexPartition.h:4: In file included from /usr/include/c++/4.2.1/string:47: In file included from /usr/include/c++/4.2.1/bits/char_traits.h:46: /usr/include/c++/4.2.1/bits/stl_algobase.h:641:15: error: assigning to 'MutableVertexPartition ' from incompatible type 'const int' first = tmp; ^ ~ /usr/include/c++/4.2.1/bits/stl_algobase.h:665:39: note: in instantiation of function template specialization 'std::fill_n::fill_n<MutableVertexPartition **, int, int>' requested here return std::fill_n<__scalar>::fill_n(first, n, value); ^ /usr/include/c++/4.2.1/bits/stl_uninitialized.h:184:12: note: in instantiation of function template specialization 'std::fill_n<MutableVertexPartition **, int, int>' requested here { std::fill_n(first, n, __x); } ^ /usr/include/c++/4.2.1/bits/stl_uninitialized.h:219:12: note: in instantiation of function template specialization 'std::uninitialized_fill_n_aux<MutableVertexPartition , int, int>' requested here std::__uninitialized_fill_n_aux(first, n, __x, _Is_POD()); ^ /usr/include/c++/4.2.1/bits/stl_uninitialized.h:306:12: note: in instantiation of function template specialization 'std::uninitialized_fill_n<MutableVertexPartition , int, int>' requested here { std::uninitialized_fill_n(first, n, x); } ^ /usr/include/c++/4.2.1/bits/stl_vector.h:790:9: note: in instantiation of function template specialization 'std::__uninitialized_fill_n_a<MutableVertexPartition *, int, int, MutableVertexPartition >' requested here std::uninitialized_fill_n_a(this->_M_impl._M_start, n, value, ^ /usr/include/c++/4.2.1/bits/stl_vector.h:261:4: note: in instantiation of function template specialization 'std::vector<MutableVertexPartition , std::allocator<MutableVertexPartition > >::_M_initialize_dispatch' requested here _M_initialize_dispatch(first, last, _Integral()); ^ src/MutableVertexPartition.cpp:219:35: note: in instantiation of function template specialization 'std::vector<MutableVertexPartition , std::allocator<MutableVertexPartition > >::vector' requested here vector<MutableVertexPartition*> partitions(1, NULL); ^ 1 error generated. error: command '/usr/bin/clang' failed with exit status 1

----------------------------------------

Command "/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 -u -c "import setuptools, tokenize;file='/private/var/folders/dz/lxnvmt213gv6350z7gr0lc000114/T/pip-build-hor2axqc/louvain/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /var/folders/dz/lxnvmt213gv6350z7gr0lc000114/T/pip-gf_hj07y-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/dz/lxnvmt213gv63__50z7gr0lc000114/T/pip-build-hor2axqc/louvain/

vtraag commented 6 years ago

It seems that the compiler is a bit strict in your case. I am not sure why it is happening with your compiler, as other compilations on MacOS go well, see for example https://travis-ci.org/conda-forge/louvain-feedstock/jobs/312772685. I've corrected the code in this commit 68587be64cc8c3fcc17a4921052f0bf064470c76 to address this issue, and you shouldn't get such a compiler error anymore. Could you check whether that solves your issue? You can simply download/clone the repository from 68587be64cc8c3fcc17a4921052f0bf064470c76 and run python setup.py install.

If you do need to get a working version before you are able to check whether 68587be64cc8c3fcc17a4921052f0bf064470c76 resolves your issue, you can get a MacOS version from https://anaconda.org/conda-forge/louvain.

sunlightwang commented 6 years ago

Hi Vincent Traag, Thank you very much for your quick efforts and response. The new commit resolved the compiler error (although I got a few warning messages as well). I still don't know why this was happening to my compiler either. Anyway, thank you again!