SciRuby / iruby

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

Issue with iruby while using asdf-vm as the version manager? #318

Open ghost opened 2 years ago

ghost commented 2 years ago

I get this error while installing iruby in asdf:

Fetching iruby-0.7.4.gem
WARNING:  You don't have {$HOME}/.local/share/gem/ruby/3.0.0/bin in your PATH,
      gem executables will not run.
Building native extensions. This could take a while...
Successfully installed iruby-0.7.4
Parsing documentation for iruby-0.7.4
Installing ri documentation for iruby-0.7.4
Done installing documentation for iruby after 0 seconds
1 gem installed

Tried installing without the --user-install flag, but then it does not work properly:

Could not load bundler: Could not locate Gemfile or .bundle/ directory
[TerminalIPythonApp] WARNING | Unrecognized alias: 'kernel', it will have no effect.
[TerminalIPythonApp] WARNING | File 'console' doesn't exist
tomonacci commented 2 years ago

@Ashvith I'm not using asdf but I encountered essentially the same error:

% bundle exec iruby
[TerminalIPythonApp] WARNING | Unrecognized alias: 'kernel', it will have no effect.
[TerminalIPythonApp] WARNING | File 'console' doesn't exist

A quick workaround for this that worked for me was changing ipython to jupyter in L130 of command.rb (this change was based on this iPython changelog entry saying "Add warning when running ipython when subcommand is deprecated. jupyter should now be used.") https://github.com/SciRuby/iruby/blob/e7403dcf1198f82e2bc4cc97b4cd24d3333c3e4c/lib/iruby/command.rb#L130

But then in the latest master this file is nonexistent (deleted in https://github.com/SciRuby/iruby/pull/317 by @mrkn) so maybe this issue is nonexistent/fixed there? In which case I guess we are yearning for a new release 😄

ghost commented 2 years ago

@tomonacci this makes sense because I remember that iruby was working quite fine before I reinstalled Fedora OS . So I think that maybe I'll try installing the old version for now.

Also, iruby works when I launch jupyter-notebook and switch kernel to Ruby. So definitely, a commit probably broke this.

kojix2 commented 2 years ago

@Ashvith Thank you for your report. I don't know exactly what the problem is, but probably the command ipython console is not running in your environment.

iruby 7.4 appears to call the ipython console command here. https://github.com/SciRuby/iruby/blob/e7403dcf1198f82e2bc4cc97b4cd24d3333c3e4c/lib/iruby/command.rb#L123-L130

I guess @tomonacci was able to call jupyter console even though he could not call ipython console.

Recently, @mrkn rewrote the iruby command. The new command is implemented in application.rb, not command.rb. The new command calls jupyter console, so this may not be a problem.

However, in my opinion, it is not recommended to use iruby commands except when installing iruby, i.e. iruby register. When starting data analysis, it is always better to use the jupyter command and then choose the Ruby language.

@Ashvith Instead of using the old version, try the latest iruby. specific_install makes it easy.

gem install specific_install
gem specific_install https://github.com/SciRuby/iruby
ghost commented 2 years ago

@kojix2 specific_install fails to install iruby:

ERROR:  While executing gem ... (Gem::Ext::BuildError)
    ERROR: Failed to build gem native extension.

    current directory: /home/ashvith/.asdf/installs/ruby/3.1.1/lib/ruby/gems/3.1.0/gems/iruby-0.7.4/ext
/home/ashvith/.asdf/installs/ruby/3.1.1/bin/ruby -I/home/ashvith/.asdf/installs/ruby/3.1.1/lib/ruby/3.1.0 -rrubygems /home/ashvith/.asdf/installs/ruby/3.1.1/lib/ruby/gems/3.1.0/gems/rake-13.0.6/exe/rake RUBYARCHDIR\=/home/ashvith/.asdf/installs/ruby/3.1.1/lib/ruby/gems/3.1.0/extensions/x86_64-linux/3.1.0/iruby-0.7.4 RUBYLIBDIR\=/home/ashvith/.asdf/installs/ruby/3.1.1/lib/ruby/gems/3.1.0/extensions/x86_64-linux/3.1.0/iruby-0.7.4
rake failedNo such file or directory - /home/ashvith/.asdf/installs/ruby/3.1.1/lib/ruby/gems/3.1.0/gems/iruby-0.7.4/ext

Gem files will remain installed in /home/ashvith/.asdf/installs/ruby/3.1.1/lib/ruby/gems/3.1.0/gems/iruby-0.7.4 for inspection.
Results logged to /home/ashvith/.asdf/installs/ruby/3.1.1/lib/ruby/gems/3.1.0/extensions/x86_64-linux/3.1.0/iruby-0.7.4/gem_make.out

Currently, I am satisfied with using the Jupyter/VSCode frontend.

kojix2 commented 2 years ago

The error says that the Native extension failed to build. However, iruby does not actually use the C extension. Instead, a Rakefile is in ext directory. https://github.com/SciRuby/iruby/blob/master/ext/Rakefile

This is native-package-installer. This automatically installs zeroMQ, a package required by iruby.

IRuby is working even though the automatic installation of ZeroMQ had failed. So ZeroMQ must have been installed successfully before.

Finally, can you tell us about your environment? Are you using it on a server? Are you using it on a local computer, what is your operating system, what is the version of your operating system?

ghost commented 2 years ago

The error says that the Native extension failed to build. However, iruby does not actually use the C extension. Instead, a Rakefile is in ext directory. https://github.com/SciRuby/iruby/blob/master/ext/Rakefile

This is native-package-installer. This automatically installs zeroMQ, a package required by iruby.

IRuby is working even though the automatic installation of ZeroMQ had failed. So ZeroMQ must have been installed successfully before.

Finally, can you tell us about your environment? Are you using it on a server? Are you using it on a local computer, what is your operating system, what is the version of your operating system?

Sorry for the late reply. I'm using Fedora Workstation on my laptop. I'm on the latest version, which is version 35. I have not done any changes to the shell environment, except for setting up asdf.

kojix2 commented 2 years ago

I tried Fedora35 with docker and couldn't figure out why. rake install worked normally.

git clone https://github.com/SciRuby/iruby
cd iruby
rake install

The specific_install command didn't work. But the error was not output, the command itself did not work.

[root@df081ce63b72 /]# gem specific_install
ERROR:  While executing gem ... (Gem::CommandLineError)
    Unknown command specific_install

The reason I asked about OS and environment was because I suspected it might be an environment where native-package-installer wouldn't work, but that doesn't seem to be the case.

If there are no other issues, please close it.