ImportError: cannot import cbook name
>>> import matplotlib
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/matplotlib/__init__.py", line 123, in <module>
from . import cbook
ImportError: cannot import name cbook
I have not found a solution, can anyone help?
I ran into this problem today due to bad addiction.
If you have backports.shutil_get_terminal_sizeand
backports.functools_lru_cacheinstalled, you may encounter this.
Matplotlib has a fragile workaround for looping imports:
# cbook must import matplotlib only within function
# definitions, so it is safe to import from it here.
from . import cbook
Prior to PR # 10483 , matplotlib depended on backports.functools_lru_cache.
, ipython backports.shutil_get_terminal_size,
.
, :
>>> import backports
<module 'backports.shutil_get_terminal_size' from '/Users/whughes/miniconda2/envs/scratch/lib/python2.7/site-packages/backports/shutil_get_terminal_size/__init__.pyc'>
>>> >import backports.functools_lru_cache
ImportError: No module named functools_lru_cache
backports.shutil_get_terminal_size , ,
backports.foo .
matplotlib ,
sys.path, backports.functools_lru_cache ,
.
, backports.shutil_get_terminal_size.