Skip to content

fix altair rendering issue #3098

Merged
quaquel merged 6 commits intomesa:mainfrom
champ-byte:fix-solara-altair-mimebundle-issue
Jan 17, 2026
Merged

fix altair rendering issue #3098
quaquel merged 6 commits intomesa:mainfrom
champ-byte:fix-solara-altair-mimebundle-issue

Conversation

@champ-byte
Copy link
Copy Markdown
Contributor

Summary

Rendering issue for mesa examples with altair backend due to the latest version altair==6

Bug / Issue

Error:
image

python version used: 3.13.5
altair version ==6

The error occurs because the software is looking for specific older versions of the Vega-Lite format (v4 or v5) within the data's MIME bundle, but only a newer version (v6) is present

Implementation

Since the issue is due to widgetti/solara (mentioned here: [widgetti/solara/issues/1127]) and due to mesa , I think the simplest temporary fix is to downgrade the altair version <6 .

Another approach would be the whitelist or blacklist version and render an html iframe as a fallback , but again this won't be future proof and unnecessary hassle.
We cannot directly add a fallback by using try and catch(making it future-proof) since , Solara catches the error internally and displays it in the UI, so Python's try-catch can't intercept it. The error happens during the frontend rendering phase, not during Python execution.

Additional Notes

If I am missing on any point or you would want me to follow a certain approach I would be happy to do that !

@champ-byte
Copy link
Copy Markdown
Contributor Author

champ-byte commented Jan 10, 2026

I found out that widgetti/solara currently required altair<6 but python 3.14 supports altair==6 only , hence I have made the neccessary changes in pyproject.toml

I have also made changes so that the code now detects the altair version and renders accordingly. If older altair is used then original older rendering is used else it uses the new VegaLite rendering method, this probably makes it future proof if solara doesn't fix the issue.

@champ-byte
Copy link
Copy Markdown
Contributor Author

Fixes #3046

@champ-byte
Copy link
Copy Markdown
Contributor Author

champ-byte commented Jan 14, 2026

Hi , @quaquel is there anything I can help with in this regard ?

@EwoutH EwoutH requested a review from Sahil-Chhoker January 16, 2026 12:04
@Sahil-Chhoker
Copy link
Copy Markdown
Collaborator

Thanks @champ-byte for this PR, can you include a image of how the newer VegaLite graphs look if they are any different from the legacy ones?

@champ-byte
Copy link
Copy Markdown
Contributor Author

Thanks @champ-byte for this PR, can you include a image of how the newer VegaLite graphs look if they are any different from the legacy ones?

Hi, Thank you looking into the PR. The graphs look exactly the same but still attaching both the graphs for confirmation.

Legacy version:
image

Newer version:
image

Copy link
Copy Markdown
Collaborator

@Sahil-Chhoker Sahil-Chhoker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@quaquel quaquel merged commit 9725285 into mesa:main Jan 17, 2026
14 checks passed
quaquel pushed a commit to quaquel/mesa that referenced this pull request Jan 18, 2026
@EwoutH
Copy link
Copy Markdown
Member

EwoutH commented Jan 21, 2026

As of Solara 1.57.1 Altair 6 is supported (see widgetti/solara#1127), does that have implications for this PR? Should we revert (part of) it?

@Sahil-Chhoker
Copy link
Copy Markdown
Collaborator

The edits by this PR works but now are unnecessary due to the solara update, I think this PR can entirely be reverted as we don't need to pin the versions and there is no need to use the VegaLite spec for newer altair version.

EwoutH added a commit that referenced this pull request Jan 22, 2026
EwoutH added a commit that referenced this pull request Jan 22, 2026
@EwoutH EwoutH added the ignore-for-release PRs that aren't included in the release notes label Feb 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ignore-for-release PRs that aren't included in the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants