from networkx import *
import matplotlib.pyplot as plt
I've imported the networkx library which previously (yesterday) allowed me to create a random graph. Running the same code again today I'm getting import errors. I am using this on Jupyter notebook/Anaconda Python.
AttributeError Traceback (most recent call last)
<ipython-input-13-d245e6f3c125> in <module>()
----> 1 from networkx import *
2 import matplotlib.pyplot as plt
C:\Anaconda3\lib\site-packages\networkx\__init__.py in <module>()
96 from networkx.tests.test import run as test
97
---> 98 import networkx.drawing
99 from networkx.drawing import *
C:\Anaconda3\lib\site-packages\networkx\drawing\__init__.py in <module>()
3 from .layout import *
4 from .nx_pylab import *
----> 5 from . import nx_agraph
6 from . import nx_pydot
C:\Anaconda3\lib\site-packages\networkx\drawing\nx_agraph.py in <module>()
272 return node_pos
273
--> 274 @nx.utils.open_file(5, 'w')
275 def view_pygraphviz(G, edgelabel=None, prog='dot', args='',
276 suffix='', path=None):
AttributeError: module 'networkx' has no attribute 'utils'
I have the same quesion just now. It seems like it's because I use Ctrl+c while the py file is import the networkx. So I close the environment and restart again. Everything is normal then.
I had to restart the kernel in my jupyter notebook and now it works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With