Incompatibility to `matplotlib<3.5.2`

Abierto
#54 1 comentario 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
jupyter-notebook, matplotlib, python

Línea de trabajo

Comienza con matplotlib_inline/backend_inline.py, especialmente _enable_matplotlib_integration(), y reproduce la importación informada usando matplotlib==3.5.1, numpy==1.24.1 y jupyter. Se considera terminado cuando importar matplotlib.pyplot en un notebook funciona con versiones de matplotlib anteriores a la 3.5.2 sin el AttributeError informado.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

When trying to import matplotlib in a jupyter notebook with matplotlib version smaller than 3.5.2 I get an error with the new release version 0.2.1. I understand the insentive of not having the direct dependency but I guess something should be done to prevent this. It works with both, the older matplotlib-inline version as well as newer matplotlib versions (>=3.5.2)

To reproduce

Install dependencies

pip install matplotlib==3.5.1 numpy==1.24.1 jupyter

Then open a jupyter notebook and try

import matplotlib.pyplot as plt

which will yield the following error

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[1], line 1
----> 1 import matplotlib.pyplot as plt

File ~\temp\venv\lib\site-packages\matplotlib\pyplot.py:2230
   2228     dict.__setitem__(rcParams, "backend", rcsetup._auto_backend_sentinel)
   2229 # Set up the backend.
-> 2230 switch_backend(rcParams["backend"])
   2232 # Just to be safe.  Interactive mode can be turned on without
   2233 # calling `plt.ion()` so register it again here.
   2234 # This is safe because multiple calls to `install_repl_displayhook`
   2235 # are no-ops and the registered function respect `mpl.is_interactive()`
   2236 # to determine if they should trigger a draw.
   2237 install_repl_displayhook()

File ~\temp\venv\lib\site-packages\matplotlib\pyplot.py:267, in switch_backend(newbackend)
    260 # Backends are implemented as modules, but "inherit" default method
    261 # implementations from backend_bases._Backend.  This is achieved by
    262 # creating a "class" that inherits from backend_bases._Backend and whose
    263 # body is filled with the module's globals.
    265 backend_name = cbook._backend_module_name(newbackend)
--> 267 class backend_mod(matplotlib.backend_bases._Backend):
    268     locals().update(vars(importlib.import_module(backend_name)))
    270 required_framework = _get_required_interactive_framework(backend_mod)

File ~\temp\venv\lib\site-packages\matplotlib\pyplot.py:268, in switch_backend.<locals>.backend_mod()
    267 class backend_mod(matplotlib.backend_bases._Backend):
--> 268     locals().update(vars(importlib.import_module(backend_name)))

File ~\AppData\Local\Programs\Python\Python39\lib\importlib\__init__.py:127, in import_module(name, package)
    125             break
    126         level += 1
--> 127 return _bootstrap._gcd_import(name[level:], package, level)

File ~\temp\venv\lib\site-packages\matplotlib_inline\__init__.py:1
----> 1 from . import backend_inline, config  # noqa
      3 __version__ = "0.2.1"
      5 # we can't ''.join(...) otherwise finding the version number at build time requires
      6 # import which introduces IPython and matplotlib at build time, and thus circular
      7 # dependencies.

File ~\temp\venv\lib\site-packages\matplotlib_inline\backend_inline.py:236
    231                 ip.events.unregister("post_run_cell", configure_once)
    233             ip.events.register("post_run_cell", configure_once)
--> 236 _enable_matplotlib_integration()
    239 def _fetch_figure_metadata(fig):
    240     """Get some metadata to help with displaying a figure."""

File ~\temp\venv\lib\site-packages\matplotlib_inline\backend_inline.py:218, in _enable_matplotlib_integration()
    216     backend = matplotlib.get_backend(auto_select=False)
    217 else:
--> 218     backend = matplotlib.rcParams._get("backend")
    220 if ip and backend in ("inline", "module://matplotlib_inline.backend_inline"):
    221     from IPython.core.pylabtools import activate_matplotlib

AttributeError: 'RcParams' object has no attribute '_get'
Lenguaje dominante
Jupyter Notebook
Estrellas
31
Forks
39
Métricas de merge de PR
Sin PR fusionados en 30 d

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de ipython/matplotlib-inline

Todos los issues de ipython/matplotlib-inline

Issues similares

Más issues de Backend & API Design

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.