vtraag / leidenalg

Implementation of the Leiden algorithm for various quality functions to be used with igraph in Python.
GNU General Public License v3.0
575 stars 77 forks source link

Install issuses in MAC(Version:12.5.1, python version 3.6.5) #118

Closed zhuyewen closed 1 year ago

zhuyewen commented 1 year ago

Dear vtraag,

I also have this @problem(#19) in installation.

(mands4) yons@yonss-iMac ~ % pip install leidenalg
Collecting leidenalg
  Using cached leidenalg-0.8.10.tar.gz (3.8 MB)
Requirement already satisfied: igraph<0.10,>=0.9.0 in ./anaconda3/envs/mands4/lib/python3.6/site-packages (from leidenalg) (0.9.11)
...
...
...
  building 'leidenalg._c_leiden' extension
  creating build/temp.macosx-10.7-x86_64-3.6
  creating build/temp.macosx-10.7-x86_64-3.6/src
  creating build/temp.macosx-10.7-x86_64-3.6/src/leidenalg
  gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/yons/anaconda3/envs/mands4/include -arch x86_64 -I/Users/yons/anaconda3/envs/mands4/include -arch x86_64 -Iinclude -Ivendor/install/igraph/include/igraph -I/Users/yons/anaconda3/envs/mands4/include/python3.6m -c src/leidenalg/SignificanceVertexPartition.cpp -o build/temp.macosx-10.7-x86_64-3.6/src/leidenalg/SignificanceVertexPartition.o
  clang: warning: include path for libstdc++ 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/leidenalg/SignificanceVertexPartition.cpp:1:
  In file included from include/SignificanceVertexPartition.h:4:
  include/MutableVertexPartition.h:4:10: fatal error: 'string' file not found
  #include <string>
           ^~~~~~~~
  1 error generated.
  error: command 'gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for leidenalg
  Running setup.py clean for leidenalg
Failed to build leidenalg
Installing collected packages: leidenalg
    Running setup.py install for leidenalg ... error
    ERROR: Command errored out with exit status 1:
     command: /Users/yons/anaconda3/envs/mands4/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/wp/twc9753x10bgcqzdpjfxr9880000gn/T/pip-install-8fcjyrnm/leidenalg_2b8a3b83441744d3a99ac7dbbe4cf56c/setup.py'"'"'; __file__='"'"'/private/var/folders/wp/twc9753x10bgcqzdpjfxr9880000gn/T/pip-install-8fcjyrnm/leidenalg_2b8a3b83441744d3a99ac7dbbe4cf56c/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/wp/twc9753x10bgcqzdpjfxr9880000gn/T/pip-record-82059m7c/install-record.txt --single-version-externally-managed --compile --install-headers /Users/yons/anaconda3/envs/mands4/include/python3.6m/leidenalg
         cwd: /private/var/folders/wp/twc9753x10bgcqzdpjfxr9880000gn/T/pip-install-8fcjyrnm/leidenalg_2b8a3b83441744d3a99ac7dbbe4cf56c/
    Complete output (37 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.7-x86_64-3.6
    creating build/lib.macosx-10.7-x86_64-3.6/leidenalg
    copying src/leidenalg/functions.py -> build/lib.macosx-10.7-x86_64-3.6/leidenalg
    copying src/leidenalg/Optimiser.py -> build/lib.macosx-10.7-x86_64-3.6/leidenalg
    copying src/leidenalg/VertexPartition.py -> build/lib.macosx-10.7-x86_64-3.6/leidenalg
    copying src/leidenalg/version.py -> build/lib.macosx-10.7-x86_64-3.6/leidenalg
    copying src/leidenalg/__init__.py -> build/lib.macosx-10.7-x86_64-3.6/leidenalg
    running build_ext
    running build_c_core
    Libraries: ['igraph', 'c++', 'xml2', 'z']
    Exclusions: []
    Found igraph as static library in vendor/install/igraph/lib/libigraph.a.
    Build type: dynamic extension with vendored igraph source
    Include path: vendor/install/igraph/include/igraph
    Library path: vendor/install/igraph/lib /usr/local/lib /usr/lib
    Runtime library path:
    Linked dynamic libraries: xml2 z
    Linked static libraries: vendor/install/igraph/lib/libigraph.a
    Extra compiler options:
    Extra linker options:
    building 'leidenalg._c_leiden' extension
    creating build/temp.macosx-10.7-x86_64-3.6
    creating build/temp.macosx-10.7-x86_64-3.6/src
    creating build/temp.macosx-10.7-x86_64-3.6/src/leidenalg
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/yons/anaconda3/envs/mands4/include -arch x86_64 -I/Users/yons/anaconda3/envs/mands4/include -arch x86_64 -Iinclude -Ivendor/install/igraph/include/igraph -I/Users/yons/anaconda3/envs/mands4/include/python3.6m -c src/leidenalg/SignificanceVertexPartition.cpp -o build/temp.macosx-10.7-x86_64-3.6/src/leidenalg/SignificanceVertexPartition.o
    clang: warning: include path for libstdc++ 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/leidenalg/SignificanceVertexPartition.cpp:1:
    In file included from include/SignificanceVertexPartition.h:4:
    include/MutableVertexPartition.h:4:10: fatal error: 'string' file not found
    #include <string>
             ^~~~~~~~
    1 error generated.
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /Users/yons/anaconda3/envs/mands4/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/wp/twc9753x10bgcqzdpjfxr9880000gn/T/pip-install-8fcjyrnm/leidenalg_2b8a3b83441744d3a99ac7dbbe4cf56c/setup.py'"'"'; __file__='"'"'/private/var/folders/wp/twc9753x10bgcqzdpjfxr9880000gn/T/pip-install-8fcjyrnm/leidenalg_2b8a3b83441744d3a99ac7dbbe4cf56c/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/wp/twc9753x10bgcqzdpjfxr9880000gn/T/pip-record-82059m7c/install-record.txt --single-version-externally-managed --compile --install-headers /Users/yons/anaconda3/envs/mands4/include/python3.6m/leidenalg Check the logs for full command output.

Then, I runconda install -c conda-forge leidenalg, and it comes out this

(mands4) yons@yonss-iMac ~ % conda install -c conda-forge leidenalg 
Solving environment: failed

InvalidVersionSpecError: Invalid version spec: =2.7

I also trie it in python2.7, failed also. I have no idea what is going on.

zhuyewen commented 1 year ago

The problem solved when I change the python version to 3.8.

vtraag commented 1 year ago

Hmm, strange, I do not know exactly what is going on. For some reason, it seems that the standard C++ library is not completely found correctly.

It seems you are using Anaconda, so it would be advisable anyway to install using conda. The error that you received

Solving environment: failed

InvalidVersionSpecError: Invalid version spec: =2.7

seems to indicate that your current environment is in an inconsistent state.

You can create a new environment that contains leidenalg (and all its necessary dependencies) using conda create -n leidenalg -c conda-forge leidenalg.