Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug in networkx1.11 + graphviz on OS X #1

Merged
merged 1 commit into from
Mar 28, 2016

Conversation

wadkar
Copy link
Contributor

@wadkar wadkar commented Mar 22, 2016

When run with a simple AMR input, I get:
Traceback (most recent call last):
File "./disagree.py", line 317, in
monolingual_main(args)
File "./disagree.py", line 199, in monolingual_main
ag = nx.to_agraph(g)
AttributeError: 'module' object has no attribute 'to_agraph'

This seems to be caused by a bug "in the draw_graphviz function in
networkx-1.11 triggered by the change that the graphviz drawing tools
are no longer imported into the top level namespace of networkx"

See: https://stackoverflow.com/a/35280794/800207

This commit fixese the issue by replacing direct nx.to_agraph() call
with appropriate full path calls.

I tried reproducing the error on Ubuntu but did not succeed.
I am creating this PR in case somebody else faces similar issue.

When run with a simple AMR input, I get:
Traceback (most recent call last):
  File "./disagree.py", line 317, in <module>
    monolingual_main(args)
  File "./disagree.py", line 199, in monolingual_main
    ag = nx.to_agraph(g)
AttributeError: 'module' object has no attribute 'to_agraph'

This seems to be caused by a bug "in the `draw_graphviz` function in
networkx-1.11 triggered by the change that the graphviz drawing tools
are no longer imported into the top level namespace of networkx"

See: https://stackoverflow.com/a/35280794/800207

This commit fixese the issue by replacing direct `nx.to_agraph()` call
with appropriate full path calls.
@nsaphra
Copy link
Owner

nsaphra commented Mar 25, 2016

Will this break AMRICA for older versions of networkx? I'm inclined to approve either way, but if so it'd be great if you could also commit the same change for bilingual modes if necessary. Either way, thanks for this!

@nsaphra nsaphra merged commit a4f80d8 into nsaphra:master Mar 28, 2016
@wadkar
Copy link
Contributor Author

wadkar commented Apr 16, 2016

Sorry, I didn't check with older versions of networkx. Also, this was an issue in OS X and I was unable to reproduce it on Ubuntu. I have access to an Ubuntu machine now. So if I find more details on this issue and perhaps a proper fix, I will reply on this thread with more information.

Thanks for accepting the PR!

@wadkar
Copy link
Contributor Author

wadkar commented May 4, 2016

Found the culprit: networkx dependency should be networkx==1.8

It appears that networkx doesn't follow semantic versioning. So going from 1.8 to 1.9 causes some API breaking changes such as this call to json_graph.dumps(g) is invalid.

When I did a pip uninstall networkx && pip install networkx==1.8 everything worked fine. Let me know if you're interested in PRs that work with current version of networkx. In the meantime, could you please update the README.md to show dependency on networkx version 1.8? I rather not create a separate issue/PR for this.

@nsaphra
Copy link
Owner

nsaphra commented May 12, 2016

I'd love to get a PR that works with the current version, thanks! (Sorry
for late response.)
On Wed, May 4, 2016 at 07:22 Sudarshan Wadkar [email protected]
wrote:

Found the culprit: networkx dependency should be networkx==1.8

It appears that networkx doesn't follow semantic versioning. So going
from 1.8 to 1.9 causes some API breaking changes
https://networkx.readthedocs.io/en/networkx-1.11/reference/api_1.9.html#miscellaneous-changes
such as this call
https://github.com/nsaphra/AMRICA/blob/master/disagree.py#L190 to
json_graph.dumps(g) is invalid.

When I did a pip uninstall networkx && pip install networkx==1.8
everything worked fine. Let me know if you're interested in PRs that work
with current version of networkx. In the meantime, could you please update
the README.md to show dependency on networkx version 1.8? I rather not
create a separate issue/PR for this.


You are receiving this because you modified the open/close state.
Reply to this email directly or view it on GitHub
#1 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants