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

legacy-install-failure in pip install louvain #64

Closed Emiri-W closed 1 year ago

Emiri-W commented 1 year ago

When I try to do pip install louvain, it says legacy-install-failure.

I am using docker image: "mcr.microsoft.com/devcontainers/python:1-3.8-bookworm" (The version of Python is 3.8.17 and the OS is Debian GNU/Linux 12 (bookworm))

Below is the message that I get when I try pip install louvain.

Defaulting to user installation because normal site-packages is not writeable
Collecting louvain
  Using cached louvain-0.8.0.tar.gz (4.0 MB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: igraph<0.11,>=0.10.0 in /home/vscode/.local/lib/python3.8/site-packages (from louvain) (0.10.5)
Requirement already satisfied: texttable>=1.6.2 in /home/vscode/.local/lib/python3.8/site-packages (from igraph<0.11,>=0.10.0->louvain) (1.6.7)
Building wheels for collected packages: louvain
  Building wheel for louvain (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [31 lines of output]
      /usr/local/lib/python3.8/site-packages/setuptools/__init__.py:84: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated.
      !!

              ********************************************************************************
              Requirements should be satisfied by a PEP 517 installer.
              If you are using pip, you can try `pip install --use-pep517`.
              ********************************************************************************

      !!
        dist.fetch_build_eggs(dist.setup_requires)
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-aarch64-cpython-38
      creating build/lib.linux-aarch64-cpython-38/louvain
      copying src/louvain/VertexPartition.py -> build/lib.linux-aarch64-cpython-38/louvain
      copying src/louvain/__init__.py -> build/lib.linux-aarch64-cpython-38/louvain
      copying src/louvain/version.py -> build/lib.linux-aarch64-cpython-38/louvain
      copying src/louvain/functions.py -> build/lib.linux-aarch64-cpython-38/louvain
      copying src/louvain/Optimiser.py -> build/lib.linux-aarch64-cpython-38/louvain
      running build_ext
      running build_c_core
      We are going to build the C core of igraph.
        Source folder: vendor/source/igraph
        Build folder: vendor/build/igraph
        Install folder: vendor/install/igraph

      igraph uses CMake as the build system. You need to install CMake before compiling igraph.
      Build failed for the C core of igraph.

      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for louvain
  Running setup.py clean for louvain
Failed to build louvain
Installing collected packages: louvain
  Running setup.py install for louvain ... error
  error: subprocess-exited-with-error

  × Running setup.py install for louvain did not run successfully.
  │ exit code: 1
  ╰─> [44 lines of output]
      /usr/local/lib/python3.8/site-packages/setuptools/__init__.py:84: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated.
      !!

              ********************************************************************************
              Requirements should be satisfied by a PEP 517 installer.
              If you are using pip, you can try `pip install --use-pep517`.
              ********************************************************************************

      !!
        dist.fetch_build_eggs(dist.setup_requires)
      running install
      /usr/local/lib/python3.8/site-packages/setuptools/_distutils/cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
      !!

              ********************************************************************************
              Please avoid running ``setup.py`` directly.
              Instead, use pypa/build, pypa/installer or other
              standards-based tools.

              See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
              ********************************************************************************

      !!
        self.initialize_options()
      running build
      running build_py
      creating build
      creating build/lib.linux-aarch64-cpython-38
      creating build/lib.linux-aarch64-cpython-38/louvain
      copying src/louvain/VertexPartition.py -> build/lib.linux-aarch64-cpython-38/louvain
      copying src/louvain/__init__.py -> build/lib.linux-aarch64-cpython-38/louvain
      copying src/louvain/version.py -> build/lib.linux-aarch64-cpython-38/louvain
      copying src/louvain/functions.py -> build/lib.linux-aarch64-cpython-38/louvain
      copying src/louvain/Optimiser.py -> build/lib.linux-aarch64-cpython-38/louvain
      running build_ext
      running build_c_core
      We are going to build the C core of igraph.
        Source folder: vendor/source/igraph
        Build folder: vendor/build/igraph
        Install folder: vendor/install/igraph

      igraph uses CMake as the build system. You need to install CMake before compiling igraph.
      Build failed for the C core of igraph.

      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> louvain

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

I understand that this package is no longer maintained, so you don't have to fix it or help me, but I appreciate it if you can help me. Thank you in advance.

vtraag commented 1 year ago

You need to have all prerequisite dependencies of igraph in place before you can build the package from source. They are listed here: https://igraph.org/c/html/latest/igraph-Installation.html#igraph-Installation-prerequisites. Note that you also need the bison, flex and git dependencies in this case.

Installing the dependencies in Debian should be something like the following:

apt install cmake libgmp-dev libglpk-dev libarpack2-dev libopenblas-dev git ninja bison flex 
Emiri-W commented 1 year ago

I install the prerequisite as follows.

apt install cmake libgmp-dev libglpk-dev libarpack2-dev libopenblas-dev git bison flex glpk-doc glpk-utils libgmp3-dev ninja-build

Then the error message for `pip install louvain changed like this.

Collecting louvain
  Using cached louvain-0.8.0.tar.gz (4.0 MB)
  Preparing metadata (setup.py) ... done
Requirement already satisfied: igraph<0.11,>=0.10.0 in /root/.local/lib/python3.8/site-packages (from louvain) (0.10.6)
Requirement already satisfied: texttable>=1.6.2 in /root/.local/lib/python3.8/site-packages (from igraph<0.11,>=0.10.0->louvain) (1.6.7)
Building wheels for collected packages: louvain
  Building wheel for louvain (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [143 lines of output]
      /usr/local/lib/python3.8/site-packages/setuptools/__init__.py:84: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated.
      !!

              ********************************************************************************
              Requirements should be satisfied by a PEP 517 installer.
              If you are using pip, you can try `pip install --use-pep517`.
              ********************************************************************************

      !!
        dist.fetch_build_eggs(dist.setup_requires)
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-aarch64-cpython-38
      creating build/lib.linux-aarch64-cpython-38/louvain
      copying src/louvain/VertexPartition.py -> build/lib.linux-aarch64-cpython-38/louvain
      copying src/louvain/__init__.py -> build/lib.linux-aarch64-cpython-38/louvain
      copying src/louvain/version.py -> build/lib.linux-aarch64-cpython-38/louvain
      copying src/louvain/functions.py -> build/lib.linux-aarch64-cpython-38/louvain
      copying src/louvain/Optimiser.py -> build/lib.linux-aarch64-cpython-38/louvain
      running build_ext
      running build_c_core
      We are going to build the C core of igraph.
        Source folder: vendor/source/igraph
        Build folder: vendor/build/igraph
        Install folder: vendor/install/igraph

      Configuring build...
      -- Setting build type to 'Release' as none was specified.
      -- Version number: 0.10.2
      -- The C compiler identification is GNU 12.2.0
      -- The CXX compiler identification is GNU 12.2.0
      -- Detecting C compiler ABI info
      -- Detecting C compiler ABI info - done
      -- Check for working C compiler: /usr/bin/cc - skipped
      -- Detecting C compile features
      -- Detecting C compile features - done
      -- Detecting CXX compiler ABI info
      -- Detecting CXX compiler ABI info - done
      -- Check for working CXX compiler: /usr/bin/c++ - skipped
      -- Detecting CXX compile features
      -- Detecting CXX compile features - done
      -- Performing Test COMPILER_SUPPORTS_UNKNOWN_WARNING_OPTION_FLAG
      -- Performing Test COMPILER_SUPPORTS_UNKNOWN_WARNING_OPTION_FLAG - Failed
      -- Performing Test COMPILER_HAS_DEPRECATED_ENUMVAL_ATTR
      -- Performing Test COMPILER_HAS_DEPRECATED_ENUMVAL_ATTR - Success
      -- Thread-local storage: supported (__thread)
      -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
      -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
      -- Found Threads: TRUE
      -- Found FLEX: /usr/bin/flex (found version "2.6.4")
      -- Found BISON: /usr/bin/bison (found version "3.8.2")
      -- Looking for strcasecmp
      -- Looking for strcasecmp - found
      -- Looking for strncasecmp
      -- Looking for strncasecmp - found
      -- Looking for _stricmp
      -- Looking for _stricmp - not found
      -- Looking for _strnicmp
      -- Looking for _strnicmp - not found
      -- Looking for strdup
      -- Looking for strdup - found
      -- Looking for strndup
      -- Looking for strndup - found
      -- Looking for include file xlocale.h
      -- Looking for include file xlocale.h - not found
      -- Looking for uselocale
      -- Looking for uselocale - found
      -- Looking for _configthreadlocale
      -- Looking for _configthreadlocale - not found
      -- Performing Test HAVE__UMUL128
      -- Performing Test HAVE__UMUL128 - Failed
      -- Performing Test HAVE___UMULH
      -- Performing Test HAVE___UMULH - Failed
      -- Looking for C++ include sys/types.h
      -- Looking for C++ include sys/types.h - found
      -- Looking for C++ include stdint.h
      -- Looking for C++ include stdint.h - found
      -- Looking for C++ include stddef.h
      -- Looking for C++ include stddef.h - found
      -- Check size of __uint128_t
      -- Check size of __uint128_t - done
      -- Performing Test HAVE_BUILTIN_OVERFLOW
      -- Performing Test HAVE_BUILTIN_OVERFLOW - Success
      -- Looking for _LIBCPP_VERSION
      -- Looking for _LIBCPP_VERSION - not found
      -- Looking for __GLIBCXX__
      -- Looking for __GLIBCXX__ - found
      -- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY
      -- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY - Success
      -- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY
      -- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY - Success
      -- Performing Test COMPILER_HAS_DEPRECATED_ATTR
      -- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Success
      CMake Error at CMakeLists.txt:159 (add_subdirectory):
        add_subdirectory given source "interfaces" which is not an existing
        directory.

      -- Found Python3: /usr/local/bin/python3 (found version "3.8.17") found components: Interpreter
      --
      -- -----[ Build configuration ]----
      -- Version:                  0.10.2
      -- CMake build type:        Release
      -- Library type:             static
      -- igraph_integer_t size:   64 bits
      --
      -- ----------[ Features ]----------
      -- GLPK for optimization:       yes
      -- Reading GraphML files:       yes
      -- Thread-local storage:        yes
      -- Link-time optimization:       no
      --
      -- --------[ Dependencies ]--------
      -- ARPACK:                 vendored
      -- BISON:                       yes
      -- BLAS:                   vendored
      -- FLEX:                        yes
      -- GLPK:                   vendored
      -- GMP:                    vendored
      -- LAPACK:                 vendored
      -- LibXml2:                     yes
      -- OpenMP:                      yes
      -- PLFIT:                  vendored
      --
      -- -----------[ Testing ]----------
      -- Diff tool:             not found
      -- Sanitizers:                 none
      -- Code coverage:                no
      -- Verify 'finally' stack:       no
      --
      -- --------[ Documentation ]-------
      -- HTML:                         no
      -- PDF:                          no
      --
      -- igraph configured successfully.
      --
      -- Configuring incomplete, errors occurred!
      See also "/tmp/pip-install-b4jnw03w/louvain_90b6219036314c39ad16f022b49f3e89/vendor/build/igraph/CMakeFiles/CMakeOutput.log".
      See also "/tmp/pip-install-b4jnw03w/louvain_90b6219036314c39ad16f022b49f3e89/vendor/build/igraph/CMakeFiles/CMakeError.log".
      Build failed for the C core of igraph.

      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for louvain
  Running setup.py clean for louvain
Failed to build louvain
Installing collected packages: louvain
  Running setup.py install for louvain ... error
  error: subprocess-exited-with-error

  × Running setup.py install for louvain did not run successfully.
  │ exit code: 1
  ╰─> [90 lines of output]
      /usr/local/lib/python3.8/site-packages/setuptools/__init__.py:84: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated.
      !!

              ********************************************************************************
              Requirements should be satisfied by a PEP 517 installer.
              If you are using pip, you can try `pip install --use-pep517`.
              ********************************************************************************

      !!
        dist.fetch_build_eggs(dist.setup_requires)
      running install
      /usr/local/lib/python3.8/site-packages/setuptools/_distutils/cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
      !!

              ********************************************************************************
              Please avoid running ``setup.py`` directly.
              Instead, use pypa/build, pypa/installer or other
              standards-based tools.

              See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
              ********************************************************************************

      !!
        self.initialize_options()
      running build
      running build_py
      creating build
      creating build/lib.linux-aarch64-cpython-38
      creating build/lib.linux-aarch64-cpython-38/louvain
      copying src/louvain/VertexPartition.py -> build/lib.linux-aarch64-cpython-38/louvain
      copying src/louvain/__init__.py -> build/lib.linux-aarch64-cpython-38/louvain
      copying src/louvain/version.py -> build/lib.linux-aarch64-cpython-38/louvain
      copying src/louvain/functions.py -> build/lib.linux-aarch64-cpython-38/louvain
      copying src/louvain/Optimiser.py -> build/lib.linux-aarch64-cpython-38/louvain
      running build_ext
      running build_c_core
      We are going to build the C core of igraph.
        Source folder: vendor/source/igraph
        Build folder: vendor/build/igraph
        Install folder: vendor/install/igraph

      Configuring build...
      -- Version number: 0.10.2
      CMake Error at CMakeLists.txt:159 (add_subdirectory):
        add_subdirectory given source "interfaces" which is not an existing
        directory.

      --
      -- -----[ Build configuration ]----
      -- Version:                  0.10.2
      -- CMake build type:        Release
      -- Library type:             static
      -- igraph_integer_t size:   64 bits
      --
      -- ----------[ Features ]----------
      -- GLPK for optimization:       yes
      -- Reading GraphML files:       yes
      -- Thread-local storage:        yes
      -- Link-time optimization:       no
      --
      -- --------[ Dependencies ]--------
      -- ARPACK:                 vendored
      -- BISON:                       yes
      -- BLAS:                   vendored
      -- FLEX:                        yes
      -- GLPK:                   vendored
      -- GMP:                    vendored
      -- LAPACK:                 vendored
      -- LibXml2:                     yes
      -- OpenMP:                      yes
      -- PLFIT:                  vendored
      --
      -- -----------[ Testing ]----------
      -- Diff tool:             not found
      -- Sanitizers:                 none
      -- Code coverage:                no
      -- Verify 'finally' stack:       no
      --
      -- --------[ Documentation ]-------
      -- HTML:                         no
      -- PDF:                          no
      --
      -- igraph configured successfully.
      --
      -- Configuring incomplete, errors occurred!
      See also "/tmp/pip-install-b4jnw03w/louvain_90b6219036314c39ad16f022b49f3e89/vendor/build/igraph/CMakeFiles/CMakeOutput.log".
      See also "/tmp/pip-install-b4jnw03w/louvain_90b6219036314c39ad16f022b49f3e89/vendor/build/igraph/CMakeFiles/CMakeError.log".
      Build failed for the C core of igraph.

      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> louvain

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
vtraag commented 1 year ago

It appeared there was a problem when installing from source indeed. The interface directory was incorrectly excluded from the source package, this is corrected in 3b4cb991b0ccac693bd2bae6c3e7864fdab41c39. In addition, I now also fixed the problem of missing aarch64 in a8157b636d3660b901da31736de5dcf1ef61b4b8, similar to https://github.com/vtraag/leidenalg/issues/141#issuecomment-1636329233. I have now made a new release 0.8.1 which should be pushed to PyPI when CI passes (aarch64 builds take forever though).