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

matplotlib issue question #80

Closed
anielsen001 opened this issue Jan 9, 2025 · 3 comments
Closed

matplotlib issue question #80

anielsen001 opened this issue Jan 9, 2025 · 3 comments
Labels
bug Something isn't working

Comments

@anielsen001
Copy link

I'm trying a very simple example with matplotlib to make a plot in the pyodide environment. TL;DR, I get this error with matplotlib:

cannot import name 'maxdict' from 'matplotlib.cbook' (/lib/python3.12/site-packages/matplotlib/cbook.py)

Here's more detail about what I did.

I wrote a qmd file with the following content and ran it with quarto preview:

---
title: "test quarto live"
format: live-html
---

The embedded code must run from a server, not an html file, so use `quarto preview`

This is a Quarto website testing the https://github.com/r-wasm/quarto-live extension.

To learn more about Quarto websites visit <https://quarto.org/docs/websites>.


```{pyodide}
import matplotlib.pyplot as plt
import matplotlib
print(matplotlib.__version__)

fig, ax = plt.subplots()
#ax.plot([1,3,2])

```

Here's a screenshot of the output I get:

image

I installed quarto-live with

quarto add r-wasm/quarto-live

The _extension.yml file says version 0.2.1-dev

Here's the output of quarto check

Quarto 1.6.37
[✓] Checking environment information...
      Quarto cache location: /home/apn/.cache/quarto
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.4.0: OK
      Dart Sass version 1.70.0: OK
      Deno version 1.46.3: OK
      Typst version 0.11.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.6.37
      Path: /opt/quarto/bin

[✓] Checking tools....................OK
      TinyTeX: (not installed)
      Chromium: (not installed)

[✓] Checking LaTeX....................OK
      Using: Installation From Path
      Path: /usr/bin
      Version: 2019

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK
      Version: 3.8.3
      Path: /home/apn/sw/bin/python3
      Jupyter: 4.10.0
      Kernels: julia-1.8, python3

(\) Checking Jupyter engine render....[IPKernelApp] ERROR | No such comm target registered: quarto_kernel_setup
[✓] Checking Jupyter engine render....OK

[✓] Checking R installation...........OK
      Version: 4.4.1
      Path: /usr/lib/R
      LibPaths:
        - /usr/local/lib/R/site-library
        - /usr/lib/R/site-library
        - /usr/lib/R/library
      knitr: (None)
      rmarkdown: (None)

      The knitr package is not available in this R installation.
      Install with install.packages("knitr")
      The rmarkdown package is not available in this R installation.
      Install with install.packages("rmarkdown")


the matplotlib version installed with pyodide and quarto-live appears to be 3.8.4. This issue with matplotlib indicates that maxdict was deprecated and removed with Matplotlib v 3.6, so this sounds like a versioning issue, but I'm completely new to quarto-live and pyodide and don't know much about how to debug anything,and I don't know how versioning is managed, so this may be an upsteam issue with pyodide.

@harfel
Copy link

harfel commented Jan 9, 2025

The issue even occurs on https://r-wasm.github.io/quarto-live/getting_started/plotting.html when running the python code snippets.

@georgestagg georgestagg added the bug Something isn't working label Jan 10, 2025
@georgestagg
Copy link
Member

Thank you for reporting this! Recently the version of Pyodide used by Quarto Live was updated, and its internal matplotlib OffscreenCanvas renderer required updating for the latest version of matplotlib bundled with Pyodide.

I've made the required changes, and things should hopefully be working again as of the latest commit of Quarto Live. You will need to reinstall the extension into your Quarto project to get the latest version.

@anielsen001
Copy link
Author

thank you for the quick update! I reinstalled the extension and it's working as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants