vtraag / leidenalg

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

python Segmentation fault: 11 when running the partition function of leidenalg #154

Closed Shuang-Plum closed 6 months ago

Shuang-Plum commented 11 months ago

I just installed the latest version of leidenalg and python-igraph. When I try to run this code: partition = leidenalg.find_partition(ig_graph,leidenalg.RBERVertexPartition,weights='weight'), my python quit (Segmentation fault: 11) with the following error message. But when I downgrade both packages: python-igraph 0.10.4 and leidenalg 0.9.1, it worked. I was wondering what is causing the error in leidenalg 0.10.1? Thanks!

Process: Python [60748] Path: /Library/Frameworks/Python.framework/Versions/3.9/Resources/Python.app/Contents/MacOS/Python Identifier: Python Version: 3.9.12 (3.9.12) Code Type: X86-64 (Native) Parent Process: bash [54087] Responsible: Terminal [5970] User ID: 501

Date/Time: 2023-10-24 10:16:45.205 -0400 OS Version: Mac OS X 10.15.7 (19H2026) Report Version: 12

Time Awake Since Boot: 670000 seconds

System Integrity Protection: enabled

Crashed Thread: 0 Dispatch queue: com.apple.main-thread

Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000013 Exception Note: EXC_CORPSE_NOTIFY

Termination Signal: Segmentation fault: 11 Termination Reason: Namespace SIGNAL, Code 0xb Terminating Process: exc handler [60748]

VM Regions Near 0x13: --> __TEXT 000000010406b000-000000010406f000 [ 16K] r-x/r-x SM=COW /Library/Frameworks/Python.framework/Versions/3.9/Resources/Python.app/Contents/MacOS/Python

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 _c_louvain.cpython-39-darwin.so 0x0000000116922d23 MutableVertexPartition::cache_neigh_communities(unsigned long, igraph_neimode_t) + 147 1 _c_louvain.cpython-39-darwin.so 0x0000000116922c69 MutableVertexPartition::weight_to_comm(unsigned long, unsigned long) + 41 2 liblibleidenalg.0.11.0.dylib 0x0000000116bdd3a9 RBERVertexPartition::diff_move(unsigned long, unsigned long) + 89 3 liblibleidenalg.0.11.0.dylib 0x0000000116bb9fc3 Optimiser::move_nodes(std::1::vector<MutableVertexPartition*, std::1::allocator<MutableVertexPartition> >, std::1::vector<double, std::1::allocator >, std::1::vector<bool, std::1::allocator > const&, int, int, bool, unsigned long) + 4195 4 liblibleidenalg.0.11.0.dylib 0x0000000116bb794f Optimiser::optimise_partition(std::__1::vector<MutableVertexPartition, std::1::allocator<MutableVertexPartition*> >, std::1::vector<double, std::1::allocator >, std::1::vector<bool, std::1::allocator > const&, unsigned long) + 1311 5 liblibleidenalg.0.11.0.dylib 0x0000000116bb7324 Optimiser::optimise_partition(MutableVertexPartition, std::1::vector<bool, std::1::allocator > const&, unsigned long) + 212 6 liblibleidenalg.0.11.0.dylib 0x0000000116bb7249 Optimiser::optimise_partition(MutableVertexPartition, std::1::vector<bool, std::__1::allocator > const&) + 41 7 _c_leiden.abi3.so 0x0000000116b8ee71 _Optimiser_optimise_partition + 465 8 org.python.python 0x000000010410cad5 cfunction_call + 69 9 org.python.python 0x00000001040c8d78 _PyObject_MakeTpCall + 376 10 org.python.python 0x00000001041b6812 call_function + 626 11 org.python.python 0x00000001041b3b82 _PyEval_EvalFrameDefault + 29074 12 org.python.python 0x00000001041b7676 _PyEval_EvalCode + 2950 ....... leiden_error_10_24_23.txt

vtraag commented 9 months ago

It is unclear to me what might be the problem. Perhaps you had installed conflicting versions of igraph somehow? What combination of versions of python-igraph and leidenalg gave this problem? Apparently you didn't experience a problem for the combination python-igraph==0.10.4 + leidenalg==0.9.1. But what is the python-igraph version that gives a problem for leidenalg==0.10.1? Also, how did you install the libraries?

GLking123 commented 6 months ago

The same issue occurs with igraph=0.9.9 and leidenalg=0.10.2.
Is my igraph version too low?

szhorvat commented 6 months ago

Yes.

vtraag commented 6 months ago

Indeed, as specified in pyproject.toml the dependency requirements are igraph >= 0.10.0,< 0.12 for leidenalg=0.10.2. Normally, you should then not be able to install igraph=0.9.9 while also installing leidenalg=0.10.2. I'm not sure how this happened, but if you upgrade igraph, it should all be fine.