Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

curious 'AnchorText' issue with Holoviews-0.18.3 / Matplotlib-2.1.0rc1 / bokeh-0.12.7 #1840

Closed
stonebig opened this issue Sep 3, 2017 · 6 comments · Fixed by #1842
Closed
Labels
tag: backend: mpl type: bug Something isn't correct or isn't working

Comments

@stonebig
Copy link
Contributor

stonebig commented Sep 3, 2017

Bug report

Bug summary

A long time Holoviews example doesn't work anymore, with a message "ImportError: cannot import name 'AnchoredText'" from Matplotlib.

as it's new Notebook / Bokeh / Matplotlib, I'm not sure of the true problem origin.

Any guess ?

Code for reproduction

# under Ipython-2.1.0rc1
import holoviews as hv
%load_ext holoviews.ipython
fractal = hv.Image(image)

((fractal * hv.HLine(y=0.16)).hist() + fractal.sample(y=0.16))

Actual outcome

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
C:\WinPython\basedir35\buildQt5\winpython-64bit-3.5.x.1\python-3.5.4.amd64\lib\site-packages\IPython\core\formatters.py in __call__(self, obj)
    330                 pass
    331             else:
--> 332                 return printer(obj)
    333             # Finally look for special method names
    334             method = get_real_method(obj, self.print_method)

C:\WinPython\basedir35\buildQt5\winpython-64bit-3.5.x.1\python-3.5.4.amd64\lib\site-packages\holoviews\ipython\display_hooks.py in pprint_display(obj)
    257     if not ip.display_formatter.formatters['text/plain'].pprint:
    258         return None
--> 259     return display(obj, raw=True)
    260 
    261 

C:\WinPython\basedir35\buildQt5\winpython-64bit-3.5.x.1\python-3.5.4.amd64\lib\site-packages\holoviews\ipython\display_hooks.py in display(obj, raw, **kwargs)
    240     elif isinstance(obj, (Layout, NdLayout, AdjointLayout)):
    241         with option_state(obj):
--> 242             html = layout_display(obj)
    243     elif isinstance(obj, (HoloMap, DynamicMap)):
    244         with option_state(obj):

C:\WinPython\basedir35\buildQt5\winpython-64bit-3.5.x.1\python-3.5.4.amd64\lib\site-packages\holoviews\ipython\display_hooks.py in wrapped(element)
    129         try:
    130             html = fn(element,
--> 131                       max_frames=OutputSettings.options['max_frames'])
    132 
    133             # Only want to add to the archive for one display hook...

C:\WinPython\basedir35\buildQt5\winpython-64bit-3.5.x.1\python-3.5.4.amd64\lib\site-packages\holoviews\ipython\display_hooks.py in layout_display(layout, max_frames)
    211         return None
    212 
--> 213     return render(layout)
    214 
    215 

C:\WinPython\basedir35\buildQt5\winpython-64bit-3.5.x.1\python-3.5.4.amd64\lib\site-packages\holoviews\ipython\display_hooks.py in render(obj, **kwargs)
     59     if renderer.fig == 'pdf':
     60         renderer = renderer.instance(fig='png')
---> 61     return renderer.html(obj, **kwargs)
     62 
     63 

C:\WinPython\basedir35\buildQt5\winpython-64bit-3.5.x.1\python-3.5.4.amd64\lib\site-packages\holoviews\plotting\renderer.py in html(self, obj, fmt, css, comm, **kwargs)
    253         code to initialize a Comm, if the plot supplies one.
    254         """
--> 255         plot, fmt =  self._validate(obj, fmt)
    256         figdata, _ = self(plot, fmt, **kwargs)
    257         if css is None: css = self.css

C:\WinPython\basedir35\buildQt5\winpython-64bit-3.5.x.1\python-3.5.4.amd64\lib\site-packages\holoviews\plotting\renderer.py in _validate(self, obj, fmt)
    189         if isinstance(obj, tuple(self.widgets.values())):
    190             return obj, 'html'
--> 191         plot = self.get_plot(obj, renderer=self)
    192 
    193         fig_formats = self.mode_formats['fig'][self.mode]

C:\WinPython\basedir35\buildQt5\winpython-64bit-3.5.x.1\python-3.5.4.amd64\lib\site-packages\holoviews\plotting\renderer.py in get_plot(self_or_cls, obj, renderer)
    176             plot = self_or_cls.plotting_class(obj)(obj, renderer=renderer,
    177                                                    **plot_opts)
--> 178             plot.update(0)
    179         else:
    180             plot = obj

C:\WinPython\basedir35\buildQt5\winpython-64bit-3.5.x.1\python-3.5.4.amd64\lib\site-packages\holoviews\plotting\mpl\plot.py in update(self, key)
    242     def update(self, key):
    243         if len(self) == 1 and key == 0 and not self.drawn:
--> 244             return self.initialize_plot()
    245         return self.__getitem__(key)
    246 

C:\WinPython\basedir35\buildQt5\winpython-64bit-3.5.x.1\python-3.5.4.amd64\lib\site-packages\holoviews\plotting\mpl\plot.py in wrapper(self, *args, **kwargs)
     41     def wrapper(self, *args, **kwargs):
     42         with _rc_context(self.fig_rcparams):
---> 43             return f(self, *args, **kwargs)
     44     return wrapper
     45 

C:\WinPython\basedir35\buildQt5\winpython-64bit-3.5.x.1\python-3.5.4.amd64\lib\site-packages\holoviews\plotting\mpl\plot.py in initialize_plot(self)
   1069         ranges = self.compute_ranges(self.layout, key, None)
   1070         for subplot in self.subplots.values():
-> 1071             subplot.initialize_plot(ranges=ranges)
   1072 
   1073         # Create title handle

C:\WinPython\basedir35\buildQt5\winpython-64bit-3.5.x.1\python-3.5.4.amd64\lib\site-packages\holoviews\plotting\mpl\plot.py in wrapper(self, *args, **kwargs)
     41     def wrapper(self, *args, **kwargs):
     42         with _rc_context(self.fig_rcparams):
---> 43             return f(self, *args, **kwargs)
     44     return wrapper
     45 

C:\WinPython\basedir35\buildQt5\winpython-64bit-3.5.x.1\python-3.5.4.amd64\lib\site-packages\holoviews\plotting\mpl\plot.py in initialize_plot(self, ranges)
    639                 ax.set_axis_off()
    640                 continue
--> 641             subplot.initialize_plot(ranges=ranges)
    642 
    643         self.adjust_positions()

C:\WinPython\basedir35\buildQt5\winpython-64bit-3.5.x.1\python-3.5.4.amd64\lib\site-packages\holoviews\plotting\mpl\plot.py in wrapper(self, *args, **kwargs)
     41     def wrapper(self, *args, **kwargs):
     42         with _rc_context(self.fig_rcparams):
---> 43             return f(self, *args, **kwargs)
     44     return wrapper
     45 

C:\WinPython\basedir35\buildQt5\winpython-64bit-3.5.x.1\python-3.5.4.amd64\lib\site-packages\holoviews\plotting\mpl\element.py in initialize_plot(self, ranges)
    490 
    491         return self._finalize_axis(self.keys[-1], element=element, ranges=ranges,
--> 492                                    **axis_kwargs)
    493 
    494 

C:\WinPython\basedir35\buildQt5\winpython-64bit-3.5.x.1\python-3.5.4.amd64\lib\site-packages\holoviews\plotting\mpl\element.py in _finalize_axis(self, key, element, title, dimensions, ranges, xticks, yticks, zticks, xlabel, ylabel, zlabel)
    168 
    169             # Apply subplot label
--> 170             self._subplot_label(axis)
    171 
    172             # Apply axis options if axes are enabled

C:\WinPython\basedir35\buildQt5\winpython-64bit-3.5.x.1\python-3.5.4.amd64\lib\site-packages\holoviews\plotting\mpl\plot.py in _subplot_label(self, axis)
    181         layout_num = self.layout_num if self.subplot else 1
    182         if self.sublabel_format and not self.adjoined and layout_num > 0:
--> 183             from mpl_toolkits.axes_grid1.anchored_artists import AnchoredText
    184             labels = {}
    185             if '{Alpha}' in self.sublabel_format:

ImportError: cannot import name 'AnchoredText'

Expected outcome

a normal graphic

Matplotlib version

  • Operating System: Windows-10 64 bit current
  • Matplotlib Version: Matplotlib-2.1.0rc1
  • Python Version: Python-3.5.4 64 bit
  • Jupyter Version (if applicable): Notebook-5.1.0rc2
  • Other Libraries:
pip list:
adodbapi (2.6.0.7)
alabaster (0.7.10)
algopy (0.5.5)
altair (1.2.0)
altair-widgets (0.1.2)
astroid (1.5.3)
astroML (0.3)
Babel (2.5.0)
backports-abc (0.5)
baresql (0.7.4)
bcolz (1.1.2)
beautifulsoup4 (4.6.0)
bkcharts (0.2)
blaze (0.10.1)
bleach (2.0.0)
blosc (1.5.1)
bloscpack (0.11.0)
bokeh (0.12.7)
boto3 (1.4.1)
botocore (1.4.36)
Bottleneck (1.2.1)
bqplot (0.10.0a5)
brewer2mpl (1.4.1)
Brotli (0.6.0)
certifi (2017.7.27.1)
cffi (1.10.0)
chardet (3.0.4)
click (6.7)
cloudpickle (0.4.0)
clrmagic (0.0.1a2)
colorama (0.3.9)
colorcet (0.9.1)
coloredlogs (7.3)
comtypes (1.1.3)
CVXcanon (0.1.1)
cvxopt (1.1.9)
cvxpy (0.4.11)
cx-Freeze (5.0.2)
cycler (0.10.0)
cyordereddict (1.0.0)
Cython (0.26.1)
cytoolz (0.8.2)
dask (0.15.2)
datashader (0.5.0)
datashape (0.5.2)
db.py (0.5.3)
decorator (4.1.2)
dill (0.2.7.1)
distributed (1.18.3)
docopt (0.6.2)
docrepr (0.1.0)
docutils (0.14)
ecos (2.0.4)
edward (1.3.3)
emcee (2.2.1)
entrypoints (0.2.3)
fast-histogram (0.2.1)
fastcache (1.0.2)
fasteners (0.14.1)
fastparquet (0.1.2)
feather-format (0.3.1)
Flask (0.12.2)
Flask-Cors (3.0.3)
formlayout (1.1.0)
fuzzywuzzy (0.15.0)
geopy (1.11.0)
gitdb2 (2.0.0)
GitPython (2.1.3)
gmpy2 (2.0.8)
greenlet (0.4.12)
guidata (1.7.6)
guiqwt (3.0.3)
h5py (2.7.1)
HeapDict (1.0.0)
holoviews (1.8.3)
html5lib (1.0b10)
humanfriendly (4.4.1)
husl (4.0.3)
idlex (1.13)
idna (2.6)
imageio (2.2.0)
imagesize (0.7.1)
ipykernel (4.6.1)
ipyleaflet (0.3.0)
ipympl (0.0.5)
ipyparallel (6.0.2)
ipython (6.1.0)
ipython-genutils (0.2.0)
ipython-sql (0.3.8)
ipywidgets (7.0.0)
isort (4.2.15)
itsdangerous (0.24)
jedi (0.10.2)
Jinja2 (2.9.6)
jmespath (0.9.3)
joblib (0.11)
jsonschema (2.6.0)
julia (0.1.2)
jupyter (1.0.0)
jupyter-client (5.1.0)
jupyter-console (5.2.0)
jupyter-core (4.3.0)
jupyter-sphinx (0.1.1)
jupyterlab (0.27.0)
jupyterlab-launcher (0.4.2)
Keras (2.0.8)
keras-vis (0.4.1)
Lasagne (0.2.dev1)
lazy-object-proxy (1.3.1)
llvmlite (0.19.0)
lmfit (0.9.7)
locket (0.2.0)
lxml (3.8.0)
Markdown (2.6.9)
MarkupSafe (1.0)
matplotlib (2.1.0rc1)
mccabe (0.6.1)
metakernel (0.20.4)
mistune (0.7.4)
mizani (0.3.3)
mkl-service (1.1.2)
monotonic (1.3)
moviepy (0.2.3.2)
mpl-scatter-density (0.2)
mpld3 (0.3)
mpldatacursor (0.6.2)
mpmath (0.19)
msgpack-python (0.4.8)
multipledispatch (0.4.9)
multiprocess (0.70.5)
mypy (0.521)
mysql-connector-python (2.0.4)
nbconvert (5.3.0)
nbconvert-reportlab (0.1)
nbdime (0.3.0)
nbformat (4.4.0)
netCDF4 (1.2.9)
networkx (1.11)
nltk (3.2.4)
notebook (5.1.0rc2)
numba (0.34.0)
numdifftools (0.9.20)
numexpr (2.6.2)
numpy (1.13.1+mkl)
numpydoc (0.7.0)
oct2py (4.0.6)
octave-kernel (0.26.2)
odo (0.5.0)
olefile (0.44)
palettable (3.1.0)
pandas (0.20.3)
pandas-datareader (0.5.0)
pandocfilters (1.4.2)
param (1.5.1)
partd (0.3.8)
patsy (0.4.1)
pdfrw (0.3)
pep8 (1.7.0)
pexpect (4.2.1)
pg8000 (1.10.5)
pickleshare (0.7.4)
Pillow (4.2.1)
pip (9.0.1)
pkginfo (1.4.1)
plotnine (0.2.1)
prettytable (0.7.2)
prompt-toolkit (1.0.15)
protobuf (3.4.0)
psutil (5.2.2)
ptpython (0.41)
ptyprocess (0.5.2)
PuLP (1.6.8)
Pweave (0.30.0a1)
py (1.4.34)
pyarrow (0.6.0)
PyAudio (0.2.11)
pybars3 (0.9.3)
pybind11 (2.2.0)
pycodestyle (2.3.1)
pycparser (2.17)
pyflakes (1.6.0)
pyflux (0.4.15)
pygame (1.9.3)
Pygments (2.2.0)
pylint (1.7.2)
pymc (2.3.6)
pymc3 (3.1)
PyMeta3 (0.5.1)
pymongo (3.5.1)
pyodbc (4.0.17)
PyOpenGL (3.1.1)
pypandoc (1.3.2)
pyparsing (2.2.0)
PyQt5 (5.9)
pyqtgraph (0.10.0)
pyreadline (2.0)
pyserial (3.4)
pystache (0.5.4)
pytest (3.2.1)
python-dateutil (2.6.1)
python-hdf4 (0.9)
python-Levenshtein (0.12.0)
python-snappy (0.5.1)
pythonnet (2.4.0.dev0)
PythonQwt (0.5.5)
pytz (2017.2)
PyWavelets (0.5.2)
pywin32 (221)
pywinpty (0.2.0)
pywinusb (0.4.2)
PyYAML (3.12)
pyzmq (16.0.2)
QtAwesome (0.4.4)
qtconsole (4.3.1)
QtPy (1.3.1)
redis (2.10.6)
reportlab (3.4.0)
requests (2.18.4)
requests-file (1.4.2)
requests-ftp (0.3.1)
requests-toolbelt (0.8.0)
rope (0.10.5)
rpy2 (2.8.6)
Rx (1.5.9)
s3fs (0.1.2)
s3transfer (0.1.10)
scikit-fuzzy (0.3.dev0)
scikit-garden (0.1.3)
scikit-image (0.13.0)
scikit-learn (0.19.0)
scikit-neuralnetwork (0.7)
scikit-optimize (0.4)
scilab2py (0.6)
scipy (0.19.1)
scs (1.2.6)
seaborn (0.8.0)
setuptools (36.2.7)
simplegeneric (0.8.1)
simplejson (3.11.1)
sip (4.19.3)
six (1.10.0)
smmap2 (2.0.3)
snakeviz (0.4.2)
snowballstemmer (1.2.1)
sortedcontainers (1.5.7)
sounddevice (0.3.8)
Sphinx (1.6.3)
sphinx-rtd-theme (0.2.4)
sphinxcontrib-websupport (1.0.1)
spyder (3.2.2.dev0)
spyder-notebook (0.2.0.dev0)
spyder-reports (0.1.1)
spyder-terminal (0.2.0)
SQLAlchemy (1.1.13)
sqlite-bro (0.8.11)
sqlparse (0.2.3)
statsmodels (0.8.0)
supersmoother (0.4)
sympy (1.1.1)
tables (3.4.2)
tblib (1.3.2)
tensorflow (1.3.0)
tensorflow-tensorboard (0.1.5)
testpath (0.3.1)
Theano (0.9.0)
thrift (0.10.0)
toolz (0.8.2)
tornado (4.5.2)
tqdm (4.15.0)
traitlets (4.3.2)
traittypes (0.0.6)
twine (1.9.1)
twitter (1.17.1)
typed-ast (1.0.4)
urllib3 (1.21.1)
vega (0.5.0)
ViTables (3.0.0)
wcwidth (0.1.7)
webencodings (0.5.1)
Werkzeug (0.12.2)
wheel (0.29.0)
widgetsnbextension (3.0.2)
win-unicode-console (0.5)
winpython (1.9.20170812)
wordcloud (1.3.2)
wrapt (1.10.11)
xarray (0.9.6)
xlrd (1.1.0)
XlsxWriter (0.9.8)
xlwings (0.11.4)
zarr (2.1.4)
zict (0.1.2)
@stonebig
Copy link
Contributor Author

stonebig commented Sep 3, 2017

ok, it works with matplotlib-2.0.2, so I suppose it's a matplotlib-2.1.0rc1 issue

@stonebig stonebig closed this as completed Sep 3, 2017
@philippjfr philippjfr added type: bug Something isn't correct or isn't working tag: backend: mpl labels Sep 3, 2017
@philippjfr
Copy link
Member

I'm going to reopen because if it's a compatibility issue with matplotlib 2.1 I'll have to fix it.

@philippjfr
Copy link
Member

philippjfr commented Sep 3, 2017

Thanks for opening the matplotlib issue. Didn't look at the actual traceback at first, this definitely looks like something matplotlib should fix. Edit: Nevermind didn't look correctly, definitely on us to fix.

@stonebig
Copy link
Contributor Author

stonebig commented Sep 3, 2017

it's curious: I can't find how very long time ago this was removed from matplotlib. ah, there : matplotlib/matplotlib@efb3f5a

@stonebig
Copy link
Contributor Author

stonebig commented Sep 3, 2017

reason was "Remove unused imports", so change may have to be on Holoviews side

@philippjfr
Copy link
Member

philippjfr commented Sep 3, 2017

Yes, looks like we have to import it from the mpltoolkit instead. Thanks for tracking that down.

stonebig added a commit to stonebig/holoviews that referenced this issue Sep 3, 2017
AnchoredText unused import was remove from mpl_toolkit. fix holoviz#1840
philippjfr pushed a commit that referenced this issue Sep 3, 2017
AnchoredText unused import was remove from mpl_toolkit. fix #1840
philippjfr pushed a commit that referenced this issue Sep 12, 2017
AnchoredText unused import was remove from mpl_toolkit. fix #1840
philippjfr pushed a commit that referenced this issue Sep 13, 2017
AnchoredText unused import was remove from mpl_toolkit. fix #1840
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tag: backend: mpl type: bug Something isn't correct or isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants