vtraag/louvain-igraph

Installation error

Closed this issue · 4 comments

Hi vtraag,
I tried to installed the louvain package by pip install louvain. But it reported an error, it confused me a lot. Here is my error:
Running setup.py clean for louvain
Failed to build louvain
Installing collected packages: louvain
Running setup.py install for louvain ... error
ERROR: Complete output from command /Users/huangxingnan/anaconda3/bin/python -u -c 'import setuptools, tokenize;file='"'"'/private/var/folders/rx/gl3grkfd4pv0zvvs5h2l0pvr0000gn/T/pip-install-k310zhra/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 /private/var/folders/rx/gl3grkfd4pv0zvvs5h2l0pvr0000gn/T/pip-record-qyr2h3sa/install-record.txt --single-version-externally-managed --compile:
ERROR: running install
running build
running build_py
creating build
creating build/lib.macosx-10.7-x86_64-3.7
creating build/lib.macosx-10.7-x86_64-3.7/louvain
copying src/functions.py -> build/lib.macosx-10.7-x86_64-3.7/louvain
copying src/Optimiser.py -> build/lib.macosx-10.7-x86_64-3.7/louvain
copying src/VertexPartition.py -> build/lib.macosx-10.7-x86_64-3.7/louvain
copying src/_version.py -> build/lib.macosx-10.7-x86_64-3.7/louvain
copying src/init.py -> build/lib.macosx-10.7-x86_64-3.7/louvain
Fixing build/lib.macosx-10.7-x86_64-3.7/louvain/functions.py build/lib.macosx-10.7-x86_64-3.7/louvain/Optimiser.py build/lib.macosx-10.7-x86_64-3.7/louvain/VertexPartition.py build/lib.macosx-10.7-x86_64-3.7/louvain/_version.py build/lib.macosx-10.7-x86_64-3.7/louvain/init.py
Skipping optional fixer: buffer
Skipping optional fixer: idioms
Skipping optional fixer: set_literal
Skipping optional fixer: ws_comma
Fixing build/lib.macosx-10.7-x86_64-3.7/louvain/functions.py build/lib.macosx-10.7-x86_64-3.7/louvain/Optimiser.py build/lib.macosx-10.7-x86_64-3.7/louvain/VertexPartition.py build/lib.macosx-10.7-x86_64-3.7/louvain/_version.py build/lib.macosx-10.7-x86_64-3.7/louvain/init.py
Skipping optional fixer: buffer
Skipping optional fixer: idioms
Skipping optional fixer: set_literal
Skipping optional fixer: ws_comma
UPDATING build/lib.macosx-10.7-x86_64-3.7/louvain/_version.py
set build/lib.macosx-10.7-x86_64-3.7/louvain/_version.py to '0.6.1'
running build_ext
Cannot find the C core of igraph on this system using pkg-config.
Build type: static extension
Include path: igraphcore/include
Library path: igraphcore/lib /usr/local/lib /usr/lib
Linked dynamic libraries: xml2 z m stdc++
Linked static libraries: igraphcore/lib/libigraph.a
Extra compiler options:
Extra linker options:
building 'louvain._c_louvain' extension
creating build/temp.macosx-10.7-x86_64-3.7
creating build/temp.macosx-10.7-x86_64-3.7/src
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/huangxingnan/anaconda3/include -arch x86_64 -I/Users/huangxingnan/anaconda3/include -arch x86_64 -Iinclude -Iigraphcore/include -I/Users/huangxingnan/anaconda3/include/python3.7m -c src/SignificanceVertexPartition.cpp -o build/temp.macosx-10.7-x86_64-3.7/src/SignificanceVertexPartition.o
warning: include path for stdlibc++ headers not found; pass '-stdlib=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
In file included from src/SignificanceVertexPartition.cpp:1:
In file included from include/SignificanceVertexPartition.h:4:
include/MutableVertexPartition.h:4:10: fatal error: 'string' file not found
#include
^~~~~~~~
1 warning and 1 error generated.
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Command "/Users/huangxingnan/anaconda3/bin/python -u -c 'import setuptools, tokenize;file='"'"'/private/var/folders/rx/gl3grkfd4pv0zvvs5h2l0pvr0000gn/T/pip-install-k310zhra/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 /private/var/folders/rx/gl3grkfd4pv0zvvs5h2l0pvr0000gn/T/pip-record-qyr2h3sa/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/rx/gl3grkfd4pv0zvvs5h2l0pvr0000gn/T/pip-install-k310zhra/louvain/

On what platform are you trying to install? The easiest way is to use Anaconda and install using
conda install -c vtraag louvain.

I would recommend to switch to the Leiden package though: leidenalg.

Hi vtraag,
thank you.

In case this helps anyone else running into this problem on a Mac, you can also set the MACOSX_DEPLOYMENT_TARGET env var to 10.9, even if your Mac is ahead of 10.9 (this worked on Mac OS X 10.14):

$ MACOSX_DEPLOYMENT_TARGET=10.9 pip3 install louvain
Collecting louvain
  Using cached https://files.pythonhosted.org/packages/51/bc/8cc9bb51a7fd9d13f37f2d904ee269971bccb1ab0eb06447a539af67f94c/louvain-0.6.1.tar.gz
Requirement already satisfied: python-igraph>=0.7.1.0 in /Users/charles/codes/data-consumer-vignettes/vp/lib/python3.6/site-packages (from louvain) (0.7.1.post6)
Building wheels for collected packages: louvain
  Building wheel for louvain (setup.py): started
  Building wheel for louvain (setup.py): still running...
  Building wheel for louvain (setup.py): still running...
  Building wheel for louvain (setup.py): still running...
  Building wheel for louvain (setup.py): finished with status 'done'
  Created wheel for louvain: filename=louvain-0.6.1-cp36-cp36m-macosx_10_7_x86_64.whl size=91259 sha256=0f1a1cd825e02c05f32a65d5d79a75b84a9cfe07f18a957d1eb71d3640fb5f2a
  Stored in directory: /Users/charles/Library/Caches/pip/wheels/f2/c3/d4/f7abaf064186d6214ef952bbb72fd6c5136d4b17dbeaeff481
Successfully built louvain
Installing collected packages: louvain
Successfully installed louvain-0.6.1