Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ghost opened this issue Mar 16, 2022 · 7 comments
Open

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

ghost opened this issue Mar 16, 2022 · 7 comments

Comments

@ghost
Copy link

ghost commented Mar 16, 2022

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
@ghost ghost changed the title iruby issue while using asdf-vm? Issue withiruby while using asdf-vm as the version manager? Mar 16, 2022
@ghost ghost changed the title Issue withiruby while using asdf-vm as the version manager? Issue with iruby while using asdf-vm as the version manager? Mar 16, 2022
@tomonacci
Copy link

tomonacci commented Mar 19, 2022

@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.")

Process.exec('ipython', *@args)

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

@ghost
Copy link
Author

ghost commented Mar 19, 2022

@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
Copy link
Member

kojix2 commented Mar 21, 2022

@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.

iruby/lib/iruby/command.rb

Lines 123 to 130 in e7403dc

@args = %w(console) + @args if @args.first.to_s !~ /\A\w/
@args += %w(--kernel ruby) if %w(console qtconsole).include? @args.first
check_version
check_registered_kernel
check_bundler {|e| STDERR.puts "Could not load bundler: #{e.message}" }
Process.exec('ipython', *@args)

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
Copy link
Author

ghost commented Mar 21, 2022

@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
Copy link
Member

kojix2 commented Mar 21, 2022

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
Copy link
Author

ghost commented Mar 27, 2022

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
Copy link
Member

kojix2 commented Mar 27, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants