Closed dataframing closed 5 years ago
Thanks for sharing! It's disappointing that networkx broke (or seems likely to break) backwards compatibility in a minor version update. I whipped up a PR (#1492) upper-bounding networkx version that should solve the issue.
Issue description
As a result of a recent update to
networkx
, Graph objects no longer expose thenode
attribute. This causes code within theLabelModel
to break, namely the call tofit
, which callsself._create_tree
, which calls (and ultimately fails at)snorkel/labeling/model/graph_utils.py::get_clique_tree
.Code example/repro steps
To test this, I created a new environment and only installed
networkx==2.3.0
viapipenv
:Then, I tried the same code with
networkx==2.4.0rc1
, which is whatpipenv
installed (since I had allowed pipenv to also install packages tagged as prereleases):Obviously, you're biting the bullet when you allow for pre-release builds. However, given that
2.4.0rc1
will soon become2.4.0
, I suspect this would be an issue in the near future, regardless. Link to the NetworkX 2.4 release notes (in-progress) here, you can search forG.node --> use G.nodes
.Expected behavior
Given that snorkel's
requirements.txt
allows fornetworkx>=2.2,<3.0
, I was surprised to see thatnetworkx==2.4.0rc1
was causing the label model to fail.Screenshots
N/A
System info
pip
(viapipenv
)networkx==2.4.0rc1
Additional context
I think a quick fix is to either update the dependency bounds within
requirements.txt
(e.g.,networkx>=2.3,<2.4
or to update the calls that accessnetworkx.Graph.node
tonetworkx.Graph.nodes
.