graspologic-org / graspologic

Python package for graph statistics
https://graspologic-org.github.io/graspologic/
MIT License
650 stars 134 forks source link

[BUG] graspologic v.2.0.1 and networkx 3.0 incompatibility leads to a crash #1015

Closed alyakin314 closed 1 year ago

alyakin314 commented 1 year ago

Expected Behavior

Importing ASE shoudln't crash w/ graspologic v.2.0.1, networkx 3.0.

Actual Behavior

Crashes.

Example Code

only relevant line seems to be

from graspologic.simulations import er_np

Full Traceback

2023-01-08T22:16:04.842241+00:00 app[worker.1]: Traceback (most recent call last):
2023-01-08T22:16:04.842259+00:00 app[worker.1]:   File "/app/scripts/fig_04_graphs_er_size.py", line 13, in <module>
2023-01-08T22:16:04.842306+00:00 app[worker.1]:     from graspologic.simulations import er_np
2023-01-08T22:16:04.842315+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/graspologic/__init__.py", line 13, in <module>
2023-01-08T22:16:04.842383+00:00 app[worker.1]:     import graspologic.pipeline
2023-01-08T22:16:04.842384+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/graspologic/pipeline/__init__.py", line 21, in <module>
2023-01-08T22:16:04.842457+00:00 app[worker.1]:     from . import embed
2023-01-08T22:16:04.842459+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/graspologic/pipeline/embed/__init__.py", line 13, in <module>
2023-01-08T22:16:04.842521+00:00 app[worker.1]:     from .adjacency_spectral_embedding import adjacency_spectral_embedding
2023-01-08T22:16:04.842523+00:00 app[worker.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/graspologic/pipeline/embed/adjacency_spectral_embedding.py", line 28, in <module>
2023-01-08T22:16:04.842588+00:00 app[worker.1]:     graph: Union[nx.Graph, nx.DiGraph, nx.OrderedGraph, nx.OrderedDiGraph],
2023-01-08T22:16:04.842606+00:00 app[worker.1]: AttributeError: module 'networkx' has no attribute 'OrderedGraph'

Your Environment

Additional Details

Can't imagine it mattering but I was running it on heroku. my requrements.txt had only graspologic w/o a specified version. Python was specified to 3.9.16. As clean of an env as it gets.

alyakin314 commented 1 year ago

@bdpedigo probably does need a more proper long-term fix though