ankane / vega-ruby

Interactive charts for Ruby, powered by Vega and Vega-Lite
BSD 3-Clause "New" or "Revised" License
257 stars 9 forks source link

Error trying to create the example Vega.lite bar chart in IRuby Jupyter notebook #6

Closed kac53211 closed 2 years ago

kac53211 commented 2 years ago

Notebook command:

Vega.lite
  .data([{city: "A", sales: 28}, {city: "B", sales: 55}, {city: "C", sales: 43}])
  .mark(type: "bar", tooltip: true)
  .encoding(
    x: {field: "city", type: "nominal"},
    y: {field: "sales", type: "quantitative"}
  )

Error in notebook:

RuntimeError: Command failed: npm ERR! canceled

npm ERR! A complete log of this run can be found in:
npm ERR!     ~/.npm/_logs/2021-12-21T01_46_21_620Z-debug.log

~/.rvm/gems/ruby-2.6.6/gems/vega-0.2.3/lib/vega/base_chart.rb:65:in `export'
~/.rvm/gems/ruby-2.6.6/gems/vega-0.2.3/lib/vega/lite_chart.rb:38:in `to_svg'
~/.rvm/gems/ruby-2.6.6/gems/iruby-0.4.0/lib/iruby/display.rb:279:in `block in <module:Registry>'
~/.rvm/gems/ruby-2.6.6/gems/iruby-0.4.0/lib/iruby/display.rb:105:in `render'
~/.rvm/gems/ruby-2.6.6/gems/iruby-0.4.0/lib/iruby/display.rb:61:in `block in render'
~/.rvm/gems/ruby-2.6.6/gems/iruby-0.4.0/lib/iruby/display.rb:60:in `each'
~/.rvm/gems/ruby-2.6.6/gems/iruby-0.4.0/lib/iruby/display.rb:60:in `render'
~/.rvm/gems/ruby-2.6.6/gems/iruby-0.4.0/lib/iruby/display.rb:23:in `display'
~/.rvm/gems/ruby-2.6.6/gems/iruby-0.4.0/lib/iruby/kernel.rb:100:in `execute_request'
~/.rvm/gems/ruby-2.6.6/gems/iruby-0.4.0/lib/iruby/kernel.rb:49:in `dispatch'
~/.rvm/gems/ruby-2.6.6/gems/iruby-0.4.0/lib/iruby/kernel.rb:38:in `run'
~/.rvm/gems/ruby-2.6.6/gems/iruby-0.4.0/lib/iruby/command.rb:110:in `run_kernel'
~/.rvm/gems/ruby-2.6.6/gems/iruby-0.4.0/lib/iruby/command.rb:40:in `run'
~/.rvm/gems/ruby-2.6.6/gems/iruby-0.4.0/bin/iruby:5:in `<top (required)>'
~/.rvm/gems/ruby-2.6.6/bin/iruby:23:in `load'
~/.rvm/gems/ruby-2.6.6/bin/iruby:23:in `<main>'
~/.rvm/gems/ruby-2.6.6/bin/ruby_executable_hooks:24:in `eval'
~/.rvm/gems/ruby-2.6.6/bin/ruby_executable_hooks:24:in `<main>'

Contents of '2021-12-21T01_46_21_620Z-debug.log':

0 verbose cli [
0 verbose cli   '/usr/local/Cellar/node/17.2.0/bin/node',
0 verbose cli   '/usr/local/bin/npm',
0 verbose cli   'exec',
0 verbose cli   '--no',
0 verbose cli   '--package=vega-lite',
0 verbose cli   '--',
0 verbose cli   'vl2svg'
0 verbose cli ]
1 info using npm@8.1.4
2 info using node@v17.2.0
3 timing npm:load:whichnode Completed in 0ms
4 timing config:load:defaults Completed in 1ms
5 timing config:load:file:/usr/local/lib/node_modules/npm/npmrc Completed in 1ms
6 timing config:load:builtin Completed in 1ms
7 timing config:load:cli Completed in 2ms
8 timing config:load:env Completed in 0ms
9 timing config:load:file:~/repos/app/.npmrc Completed in 1ms
10 timing config:load:project Completed in 2ms
11 timing config:load:file:~/.npmrc Completed in 0ms
12 timing config:load:user Completed in 0ms
13 timing config:load:file:/usr/local/etc/npmrc Completed in 0ms
14 timing config:load:global Completed in 0ms
15 timing config:load:validate Completed in 0ms
16 timing config:load:credentials Completed in 1ms
17 timing config:load:setEnvs Completed in 1ms
18 timing config:load Completed in 8ms
19 timing npm:load:configload Completed in 8ms
20 timing npm:load:setTitle Completed in 2ms
21 timing npm:load:setupLog Completed in 1ms
22 timing config:load:flatten Completed in 2ms
23 timing npm:load:cleanupLog Completed in 2ms
24 timing npm:load:configScope Completed in 0ms
25 timing npm:load:projectScope Completed in 0ms
26 timing npm:load Completed in 16ms
27 http fetch GET 200 https://registry.npmjs.org/vega-lite 126ms (cache revalidated)
28 timing arborist:ctor Completed in 1ms
29 timing arborist:ctor Completed in 0ms
30 timing command:exec Completed in 884ms
31 verbose stack Error: canceled
31 verbose stack     at exec (/usr/local/lib/node_modules/npm/node_modules/libnpmexec/lib/index.js:154:17)
31 verbose stack     at async module.exports (/usr/local/lib/node_modules/npm/lib/cli.js:65:5)
32 verbose cwd ~/repos/app/console
33 verbose Darwin 20.6.0
34 verbose argv "/usr/local/Cellar/node/17.2.0/bin/node" "/usr/local/bin/npm" "exec" "--no" "--package=vega-lite" "--" "vl2svg"
35 verbose node v17.2.0
36 verbose npm  v8.1.4
37 error canceled
38 verbose exit 1
ankane commented 2 years ago

Hey @kac53211, try upgrading iRuby to the latest version (or at least >= 0.7.1). It's due to this issue: https://github.com/SciRuby/iruby/issues/314

kac53211 commented 2 years ago

Thank you, I will try that now and report back

kac53211 commented 2 years ago

Brilliant, that did it. I updated to iruby-0.7.4 and now the bar chart is displaying as expected. Thank you so much for the quick response!

ankane commented 2 years ago

Great!