benedekrozemberczki / karateclub

Karate Club: An API Oriented Open-source Python Framework for Unsupervised Learning on Graphs (CIKM 2020)
https://karateclub.readthedocs.io
GNU General Public License v3.0
2.17k stars 247 forks source link

Dependency update #133

Closed GiulioRossetti closed 9 months ago

GiulioRossetti commented 1 year ago

Hi @benedekrozemberczki ,

will it be possible to make the version requirements for numpy, networkx and pandas a little less stringent?

We are trying to update the dependency list of cdlib but it seems that the latest versions of such packages break all our krarateclub integrations.

Best, Giulio

benedekrozemberczki commented 1 year ago

Hi @GiulioRossetti , I will look into this.

WhatTheFuzz commented 1 year ago

I can confirm that networkx 3.0 < makes breaking changes, as shown in the test cases.

FAILED test/community_detection_overlapping_test.py::test_danmf - ValueError: inconsistent shapes
====================== 1 failed, 46 passed, 851 warnings in 195.31s (0:03:15) =======================

This may be related to the change networkx 3.0 < made to return sparse arrays instead of matrices when calling certain methods. See one deprecation warning below.

test/community_detection_overlapping_test.py::test_danmf
test/community_detection_overlapping_test.py::test_danmf
  /home/siuser/Developer/karateclub/karateclub/community_detection/overlapping/danmf.py:48: FutureWarning: adjacency_matrix will return a scipy.sparse array instead of a matrix in Networkx 3.0.
    self._A = nx.adjacency_matrix( 

To recreate this issue, just bump networkx dependency in setup.py to "networkx==3.0",

rjurney commented 1 year ago

I need pandas 2.0. I can't use this :( Ed: Ok, this is an exaggeration :)

rjurney commented 1 year ago

@WhatTheFuzz can you let me know what other issues involving networkx 3.0 are? I really want to include karateclub in my Graph ML class and am willing to do the work if it isn't too extensive.

rjurney commented 1 year ago

Ok, FWIW I am poking around here :)

install_requires = [
    "numpy>=1.22.0",
    "networkx>=3.0",
    "decorator==5.1.*",
    ...
rjurney commented 1 year ago

I got a little experience in this PR: https://github.com/benedekrozemberczki/littleballoffur/pull/23

I am going to make karateclub go with networkx>=3.1 now :)

WhatTheFuzz commented 1 year ago

Sorry, I didn't mean to leave you hanging! I was just going off of the unit tests before. I'm not exactly the best ML dev out there. I would definitely love to bump the dependencies so I can update my environments. Happy to bounce ideas off though.

rjurney commented 1 year ago

Oh, no problem! I just kind of jumped on it :)

benedekrozemberczki commented 1 year ago

Hi there @rjurney do you want to go ahead?

gkirgizov commented 1 year ago

As I see, in https://github.com/benedekrozemberczki/karateclub/blob/master/setup.py you have already relaxed requirements. But PyPi release still has quite strict requirements that get in the way with almost any other recent package. We got into install problem because of that in our project https://github.com/aimclub/GOLEM.

Could you consider making a minor release soon with updated dependencies?

rjurney commented 1 year ago

@gkirgizov I am going to get back to this soon!

rjurney commented 1 year ago

I am now to the point where my class starts Monday. I am looking at this.

rjurney commented 1 year ago

Oh shit, this is that scikit-learn bug I ran into :( Woe is me, I've got just half an hour to try!

rjurney commented 1 year ago

Gentlemen [ @benedekrozemberczki and @GiulioRossetti @WhatTheFuzz @gkirgizov ] please check out #150 🥳

Everything works in networkx 3.3 now! All unit tests pass. Please examine and merge 😁

LucaCappelletti94 commented 9 months ago

Closing issue as PR was merged.

rjurney commented 9 months ago

@LucaCappelletti94 much gracias!