SciRuby / iruby

Official gem repository: Ruby kernel for Jupyter/IPython Notebook
https://github.com/SciRuby/iruby
MIT License
901 stars 29 forks source link

google colab not working #309

Closed dauuricus closed 3 years ago

dauuricus commented 3 years ago

Until about a week ago, I was able to use it on google colab without any problems, but now it fails. Probably due to the changes within the last week. I just noticed something wrong, so I still don't know the cause.

colab bash

!apt-get update
!apt install libtool libffi-dev ruby-full make
!apt install libzmq3-dev libczmq-dev
!gem install ffi-rzmq
!gem install specific_install
!gem specific_install https://github.com/SciRuby/iruby
!iruby register

results

=========
http installing from https://github.com/SciRuby/iruby
Cloning into '/tmp/d20210723-15772-6lsr6a'...
remote: Enumerating objects: 3439, done.
remote: Counting objects: 100% (481/481), done.
remote: Compressing objects: 100% (185/185), done.
remote: Total 3439 (delta 285), reused 455 (delta 276), pack-reused 2958
Receiving objects: 100% (3439/3439), 1.44 MiB | 16.51 MiB/s, done.
Resolving deltas: 100% (1777/1777), done.
WARNING:  open-ended dependency on ffi-rzmq (>= 0) is not recommended
  if ffi-rzmq is semantically versioned, use:
    add_runtime_dependency 'ffi-rzmq', '~> 0'
WARNING:  open-ended dependency on irb (>= 0) is not recommended
  if irb is semantically versioned, use:
    add_runtime_dependency 'irb', '~> 0'
WARNING:  open-ended dependency on mime-types (>= 3.3.1) is not recommended
  if mime-types is semantically versioned, use:
    add_runtime_dependency 'mime-types', '~> 3.3', '>= 3.3.1'
WARNING:  open-ended dependency on native-package-installer (>= 0) is not recommended
  if native-package-installer is semantically versioned, use:
    add_runtime_dependency 'native-package-installer', '~> 0'
WARNING:  open-ended dependency on pycall (>= 1.2.1, development) is not recommended
  if pycall is semantically versioned, use:
    add_development_dependency 'pycall', '~> 1.2', '>= 1.2.1'
WARNING:  open-ended dependency on rake (>= 0, development) is not recommended
  if rake is semantically versioned, use:
    add_development_dependency 'rake', '~> 0'
WARNING:  open-ended dependency on test-unit (>= 0, development) is not recommended
  if test-unit is semantically versioned, use:
    add_development_dependency 'test-unit', '~> 0'
WARNING:  open-ended dependency on test-unit-rr (>= 0, development) is not recommended
  if test-unit-rr is semantically versioned, use:
    add_development_dependency 'test-unit-rr', '~> 0'
WARNING:  See http://guides.rubygems.org/specification-reference/ for help
  Successfully built RubyGem
  Name: iruby
  Version: 0.7.3
  File: iruby-0.7.3.gem
Fetching: native-package-installer-1.1.1.gem (100%)
Fetching: multi_json-1.15.0.gem (100%)
Fetching: mime-types-data-3.2021.0704.gem (100%)
Fetching: mime-types-3.3.1.gem (100%)
Fetching: io-console-0.5.9.gem (100%)
Building native extensions. This could take a while...
Fetching: reline-0.2.6.gem (100%)
Fetching: irb-1.3.6.gem (100%)
Fetching: data_uri-0.1.0.gem (100%)
Building native extensions. This could take a while...
ERROR:  While executing gem ... (Gem::Ext::BuildError)
    ERROR: Failed to build gem native extension.

    current directory: /var/lib/gems/2.5.0/gems/iruby-0.7.3/ext
/usr/bin/ruby2.5 -rrubygems /usr/share/rubygems-integration/all/gems/rake-12.3.1/exe/rake RUBYARCHDIR=/var/lib/gems/2.5.0/extensions/x86_64-linux/2.5.0/iruby-0.7.3 RUBYLIBDIR=/var/lib/gems/2.5.0/extensions/x86_64-linux/2.5.0/iruby-0.7.3
/usr/bin/ruby2.5: No such file or directory -- /usr/share/rubygems-integration/all/gems/rake-12.3.1/exe/rake (LoadError)

rake failed, exit code 1

Gem files will remain installed in /var/lib/gems/2.5.0/gems/iruby-0.7.3 for inspection.
Results logged to /var/lib/gems/2.5.0/extensions/x86_64-linux/2.5.0/iruby-0.7.3/gem_make.out
/bin/bash: iruby: command not found
dauuricus commented 3 years ago

Thank you. Please continue development. The solution is below.

!apt-get update
!apt install libtool libffi-dev ruby-full make
!apt install libzmq3-dev libczmq-dev

!gem install ffi-rzmq
!gem install specific_install
#!gem specific_install https://github.com/SciRuby/iruby
!gem install iruby --pre
!iruby register --force
kojix2 commented 3 years ago

@dauuricus Thank you for your report. We don't regularly check the behavior of iruby in Google Colab, so we may not be aware of it unless you report it. If you find any other problems, please report them. Thank you.

dauuricus commented 3 years ago

Doesn't it mean that the recipe for installing the newly added gem native extension is not compatible with ubuntu?

kojix2 commented 3 years ago

@dauuricus The native-package-installer looks for Debian packages when no Ubuntu packages are specified. See here for more information. So there should be no lack of support for Ubuntu.

See: https://github.com/ruby-gnome/native-package-installer/blob/f0bb6e461c2f841fc0fa4f4285ff97eeaa977b56/lib/native-package-installer/platform/ubuntu.rb#L33

native-package-installer is a gem that uses a package manager to install C libraries when installing a gem. It is part of the ruby-gnome project. For example, if you type gem install gtk3, you will be asked for root privileges, enter your password, and the required libraries will be installed automatically.

iruby depends on ffi-rzmq. ffi-rzmq depends on libzmq. native-package-installer will automatically install libzmq when iruby gem is installed. This makes installation easier.

kojix2 commented 3 years ago

It seems that the solution is easier than I thought. Just install rake.

!apt-get update
!apt install libtool libffi-dev ruby-full make
!apt install libzmq3-dev
!gem install rake
!gem install specific_install
!gem specific_install https://github.com/SciRuby/iruby
!iruby register

Good luck!

dauuricus commented 3 years ago

@kojix2 とても参考になります。