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

saving png with chart.save() is not enabled with vl-convert-python #3254

Closed
HorvathAP opened this issue Nov 6, 2023 · 4 comments
Closed
Labels

Comments

@HorvathAP
Copy link

I'm trying to save a chart as png on Google Colab.
altair.version==5.0.0
vl-convert-python.version==1.0.1

The documentation would suggest that I can use chart.save('chart.png') so long as vl-convert-python is installed, but I'm still getting this error:

"ValueError: Saving charts in 'png' format requires the altair_saver package"

I've also tried altair_saver, but got a wide variety of errors and I ultimately found this issue which concluded that vl-convert was recommended: altair-viz/altair_saver#121

@HorvathAP HorvathAP added the bug label Nov 6, 2023
@binste
Copy link
Contributor

binste commented Nov 7, 2023

You're right that it should be enough to have vl-convert-python installed and then call chart.save("chart.png"). Can you provide a link to a minimal Colab notebook which shows this issue? Without it, it's difficult to know what's going on.

@jonmmease
Copy link
Contributor

Hi @HorvathAP,

Could you try checking the versions from Python.

import vl_convert as vlc
print(vlc.__version__)

And for Altair

import altair as alt
print(alt.__version__)

I ask because the error message looks like it's coming from Altair 4. Did you have to install Altair 5 manually with !pip install, or does Colab ship with Altair 5?

@HorvathAP
Copy link
Author

HorvathAP commented Nov 7, 2023

Yes, I was installing altair 5 with !pip install altair==5.0.0 But it looks like I wasn't paying close enough attention to restarting my runtime with each pip install. Verifying the version reminded me that a runtime restart is necessary. chart.save() is working with a proper install of altair 5. Thanks, and sorry for the confusion.

@binste
Copy link
Contributor

binste commented Nov 7, 2023

No worries! Glad it works :)

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

No branches or pull requests

3 participants