jupyter_on_rails icon indicating copy to clipboard operation
jupyter_on_rails copied to clipboard

`'<path to proj>/.ipython/kernels/ruby': No such file or directory` task error

Open schperplata opened this issue 6 months ago • 0 comments

Hey, looks like :install_kernels task (lib/jupyter_on_rails/railtie/jupyter.rake) has some default that is not the same on my installation.

$ rails jupyter:notebook
/home/domen/.rbenv/versions/3.2.4/lib/ruby/gems/3.2.0/gems/io-event-1.4.0/lib/io/event/support.rb:27: warning: IO::Buffer is experimental and both the Ruby and C interface may change in the future!
JUPYTER_DATA_DIR=<path to proj>/.ipython bundle exec iruby register --force
EXECUTE: jupyter kernelspec install --name=ruby3 --user /tmp/iruby_kernel20240821-126386-gxplqt/ruby3
[InstallKernelSpec] Removing existing kernelspec in <path to proj>/.ipython/kernels/ruby3
[InstallKernelSpec] Installed kernelspec ruby3 in <path to proj>/.ipython/kernels/ruby3
rm -rf <path to proj>/.ipython/kernels/rails
cp -r <path to proj>/.ipython/kernels/ruby <path to proj>/.ipython/kernels/rails
cp: cannot stat '<path to proj>/.ipython/kernels/ruby': No such file or directory
bin/rails aborted!
Command failed with status (1): [cp -r <path to proj>/.ipython/kernels/ruby <path to proj>/.ipython/kernels/rails]

Tasks: TOP => jupyter:notebook => jupyter:install_kernels
(See full trace by running task with --trace)

To make this gem work with my installation and Rails, I needed to change line 54 to use ruby3, not ruby: sh "cp -r #{Shellwords.shellescape(ipython_dir.to_s)}/kernels/ruby #{Shellwords.shellescape(ipython_dir.to_s)}/kernels/#{cfg.kernel_name}" to: sh "cp -r #{Shellwords.shellescape(ipython_dir.to_s)}/kernels/ruby3 #{Shellwords.shellescape(ipython_dir.to_s)}/kernels/#{cfg.kernel_name}"

Info:

  • Rails 7.1.3.2
  • ruby 3.2.4 (2024-04-23 revision af471c0e01) [x86_64-linux]

Let me know if there is anything missing. Thanks!

schperplata avatar Aug 21 '24 11:08 schperplata