Reputation: 13116
I am trying to save altair figures in html any graphic format (png, svg).
HTML. The figures in html are not displayed. A blank page
PNG. The documentations says I need canvas
package and provides a command how to install it for conda. I don't have conda. I am installing it system-wide with npm install canvas
. This gives is a bunch of errors relating to altair per se. Fixing them, I still get:
FileNotFoundError: [Errno 2] No such file or directory: 'vl2svg'
FileNotFoundError: [Errno 2] No such file or directory: 'vl2png'
Any idea how to debug this?
Upvotes: 3
Views: 1460
Reputation: 86330
Edit, June 2018: Altair entirely updated its figure saving mechanism in version 2.0, and it no longer uses npm/nodejs. See https://altair-viz.github.io/user_guide/saving_charts.html for details
The issue is that Altair needs to access npm command-line tools in order to save png/svg output. You need to make sure that the vega-lite tools installed by npm are available in the environment that your Python process is running. Altair itself has no control over this, but attempts to find them in the most likely places (the PATH, followed by the binary install location specified by npm, if available).
The errors above indicate that these executables are not available in the environment from which you launched your Python process. You should update your PATH so that the command-line tools are accessible, then launch Python and run your Altair code.
Finally, there's another complication, which is not related to this error, but which you'll likely run into if you fix it: Vega-Lite is in the midst of a backward incompatible 2.0 release, and Altair currently only works with 1.0. You'll need to make sure to install the npm tools associated with Vega-Lite 1.0 in order for this to work with the current Altair release. Hopefully by this summer we'll be able to update Altair to work with Vega-Lite 2.0.
Upvotes: 2
Reputation: 13116
There has been a number of steps in attempt to fix it. Some of them:
vega-lite
repository :
npm install vega-lite
the vl2png
and alike come with vega-lite
, not canvas as I understood.The issue has been raised here.
Upvotes: 0