Error in Google Colaboratory
cap-jmk opened this issue · comments
Hey!
First, thank you for the wonderful project. I was trying out your notebook on segregation in Colab.
The example notebook https://agentpy.readthedocs.io/en/latest/agentpy_segregation.html gives for line
animation = ap.animate(model, fig, ax, animation_plot)
The error
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
/var/folders/hy/zyr6jvld6rscmbnqml0fvq1c0000gn/T/ipykernel_45243/1434696550.py in <module>
7 fig, ax = plt.subplots()
8 model = SegregationModel(parameters)
----> 9 animation = ap.animate(model, fig, ax, animation_plot)
10 IPython.display.HTML(animation.to_jshtml())
~/opt/anaconda3/envs/ABM/lib/python3.10/site-packages/agentpy/visualization.py in animate(model, fig, axs, plot, steps, seed, skip, fargs, **kwargs)
83 save_count = 10000 if model._steps is np.nan else model._steps
84
---> 85 ani = matplotlib.animation.FuncAnimation(
86 fig, update,
87 frames=frames,
~/opt/anaconda3/envs/ABM/lib/python3.10/site-packages/matplotlib/_api/__init__.py in __getattr__(name)
220 if name in props:
221 return props[name].__get__(instance)
--> 222 raise AttributeError(
223 f"module {cls.__module__!r} has no attribute {name!r}")
224
AttributeError: module 'matplotlib' has no attribute 'animation'
The package was installed with
!pip install agentpy
Thanks for the report! I need to change the import statement