Home > Blockchain >  Cannot import name 'iterable' from 'matplotlib.cbook'
Cannot import name 'iterable' from 'matplotlib.cbook'

Time:05-12

Recently, I updated to Ubuntu 22. I am using python 3.10.

After installing matplotlib and other required libraries for python, I am trying to plot some graphs.

Everytime I am facing this error while running my code. I followed all the solutions given in stackoverflow or Google but no luck.

This is the error I am getting:

File ~/.local/lib/python3.10/site-packages/prettyplotlib/_eventplot.py:3, in <module>
      1 __author__ = 'jgosmann'
----> 3 from matplotlib.cbook import iterable
      5 from prettyplotlib.utils import remove_chartjunk, maybe_get_ax
      6 from prettyplotlib.colors import set2

ImportError: cannot import name 'iterable' from 'matplotlib.cbook'

When I imported matplotlib, there is no issue.

How can I get rid of this error? Any help or suggestion would be appreciated.

Thank you

CodePudding user response:

From From https://github.com/matplotlib/matplotlib/commit/08dc21b038e43401652fed765288bb669abb8b0c#diff-734998909c4e54bce8138043e769bea5654259de61cc909be9d84b04485cdae9R46, it looks like that this has been removed/deprecated.

Comment suggests using numpy.iterable()

So I guess you'd need to change:

 from matplotlib.cbook import iterable

to

 from numpy import iterable

CodePudding user response:

If anyone serching for the answer to solve this issue,

then follow the following steps:

step 1) uninstall matplotlib completely step 2 ) Then install matplotlib : pip3 install -U scikit-learn scipy matplotlib

  • Related