Bug 252297 - math/py-networkx: AttributeError: module 'matplotlib.cbook' has no attribute 'iterable'
Summary: math/py-networkx: AttributeError: module 'matplotlib.cbook' has no attribute ...
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: amd64 Any
: --- Affects Many People
Assignee: Thierry Thomas
URL:
Keywords: needs-patch, needs-qa
Depends on:
Blocks:
 
Reported: 2020-12-31 03:31 UTC by jeremy@coyotetrackz.com
Modified: 2021-02-19 15:18 UTC (History)
3 users (show)

See Also:
dikshie: maintainer-feedback+
dikshie: maintainer-feedback+
koobs: merge-quarterly?


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jeremy@coyotetrackz.com 2020-12-31 03:31:54 UTC
I've been have an issue with python3 scripts using the networkx and matplotlib libraries. An example python3 script is as follows:

#! /usr/bin/env python3

import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import networkx as nx

if __name__ == '__main__':

	vertices = range(1, 10)
	edges = [(7,2), (2,3), (7,4), (4,5), (7,3), (1,6), (1,7), (2,8), (2,9)]

	G = nx.Graph()
	G.add_nodes_from(vertices)
	G.add_edges_from(edges)

	nx.draw(G)
	plt.savefig("node.png")


When the script get's to: nx.draw(G), the following error message is displayed:

Traceback (most recent call last):
  File "./05_imaging.py", line 17, in <module>
    nx.draw(G)
  File "/usr/local/lib/python3.7/site-packages/networkx/drawing/nx_pylab.py", line 126, in draw
    draw_networkx(G, pos=pos, ax=ax, **kwds)
  File "/usr/local/lib/python3.7/site-packages/networkx/drawing/nx_pylab.py", line 278, in draw_networkx
    edge_collection = draw_networkx_edges(G, pos, arrows=arrows, **kwds)
  File "/usr/local/lib/python3.7/site-packages/networkx/drawing/nx_pylab.py", line 563, in draw_networkx_edges
    if not cb.iterable(width):
AttributeError: module 'matplotlib.cbook' has no attribute 'iterable'


From looking into the issue, it seems that this is an issue of 'matplotli.cbook' being deprecated since version 3.0 of matplotlib ... but it is still being referenced in the current version of py37-networkx.
Comment 1 jeremy@coyotetrackz.com 2020-12-31 22:10:52 UTC
After doing a little more research it looks like my initial comment about matplotlib.cbook being deprecated was incorrect. It looks like the current version of networkx is trying to use a part of matplotlib.cbook that has changed. I read that version 2.4 of networkx has fixed the issue but haven't had the chance to test it.
Comment 2 Thierry Thomas freebsd_committer 2021-02-15 16:54:19 UTC
To make the upgrade of math/py-mathics to 2.0, an upgrade of math/py-networkx is also necessary.

I have just submitted a patch for this upgrade: see PR 253540.
Please check if solves also your problem.
Comment 3 jeremy@coyotetrackz.com 2021-02-15 17:07:52 UTC
(In reply to Thierry Thomas from comment #2)
Thanks for the update. I'm very new to this side of FreeBSD ... if I've been using the pkg system to install software and I'm currently on 12.2-RELEASE-p3 is there a way for me to run a test on the patch?
Comment 4 Thierry Thomas freebsd_committer 2021-02-15 18:34:19 UTC
(In reply to Thierry Thomas from comment #2)

Unfortunately it is not possible ATM through a package: you'll have to wait for the patch to be committed and a new package to be built.

To test the patch, you need a ports tree, and to install as a port.
Comment 5 dikshie 2021-02-19 12:56:21 UTC
already approved https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=253540