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

Corrupts altair in VS Code #447

Open
NickCrews opened this issue Jan 6, 2024 · 1 comment
Open

Corrupts altair in VS Code #447

NickCrews opened this issue Jan 6, 2024 · 1 comment

Comments

@NickCrews
Copy link
Contributor

NickCrews commented Jan 6, 2024

Notebook: solara_altair_bug.ipynb.zip

Overview screenshot:
image

I started with an altair chart (in a venv, in a .ipynb file in VSCode's native notebook editor), which worked (displayed as expected)

import altair as alt
import pandas as pd
import solara

source = pd.DataFrame({"a": ["A", "B", "C"], "b": [28, 55, 43]})
chart = alt.Chart(source).mark_bar().encode(y="a", x="b")
chart

Then, if I import solara; solara.FigureAltair(chart), I don't see any output, and then if I try to just look back at the plain altair chart again, I get
Error loading script: Script error for "./_solara/cdn/vega-embed@6/build/vega-embed.min.js" https://requirejs.org/docs/errors.html#scripterror

Even if I restart the kernel, and just use altair (don't import or run anything solara-related), then I still get this error. I have to reload the VSCode window in order for altair to begin working again.

Running in VSCode:
Version: 1.85.1 (Universal)
Commit: 0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2
Date: 2023-12-13T09:48:06.308Z (3 wks ago)
Electron: 25.9.7
ElectronBuildId: 25551756
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Darwin arm64 23.1.0

@NickCrews NickCrews changed the title Solara corrupts altair package Jan 6, 2024
NickCrews added a commit to NickCrews/solara that referenced this issue Jan 6, 2024
@NickCrews
Copy link
Contributor Author

If I monkeypatch

getCdn() {
return (typeof solara_cdn !== "undefined" && solara_cdn) || `${this.getBaseUrl()}_solara/cdn`;
}
and force it to always return "https://cdn.jsdelivr.net/npm", then it works! So something in that logic makes the CDN lookup fail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant