Thursday, July 11, 2013

Installation of Biopieces on Ubuntu Linux 12.10 - Ruby installation

Installing Biopieces was not as trivial as I had hoped due to some version issues with Ruby; using the Debian package for Ruby did not work for me. Here's a combination of what ultimately what worked for me on two of my systems (32-bit Linux Ubuntu 12.10, and 64-bit Linux Ubuntu 12.10) after considerable troubleshooting.

Install these dependencies to be able to compile Ruby from source; credit goes to this blog for listing them.
$ sudo apt-get install build-essential vim git-core curl  
  
$ sudo apt-get install bison openssl libreadline6 libreadline6-dev zlib1g zlib1g-dev libssl-dev libyaml-dev libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev  
  
$ sudo apt-get install libcurl4-openssl-dev libopenssl-ruby apache2-prefork-dev libapr1-dev libaprutil1-dev  
  
$ sudo apt-get install libx11-dev libffi-dev tcl-dev tk-dev
And also get subversion (Warning! I may be missing some dependencies that were already on my systems, such as Perl and CPAN).

$ sudo apt-get install subversion

After those dependencies were installed, I used the biopieces install script to guide my search for additional dependencies. Running the script searched for the dependencies and output which were missing.

#Change to the directory to which it was downloaded (cd ~/Downloads in my case). One could also use wget here to download it.
$ chmod u+x biopieces_install.sh
$ ./biopieces_install.sh

At this point, the installer would abort after citing missing Perl dependencies. Each Perl dependency was obtained from CPAN (Perl's package manager).

$ sudo cpan
> install Inline
> install JSON::XS
#...and so on until all packages were obtained

And finally the installer would abort after being unable to find Ruby.

The real problems came in with installing Ruby. I ran into Ruby and Rubygems (Ruby's package manger) version problems and an issue installing the gem RubyInline due to an error in a RubyInline dependency called ZenTest. ZenTest required a different version of rubygem package manager than that which I had installed. The best solution I found was to avoid using the Debian packages for Ruby and Rubygems and compile them from source. Due to pilot error while trying to troubleshoot the Ruby installation, I had unwittingly put multiple versions on my system. The first thing I needed to do was get a fresh start by wiping all Ruby and Rubygem off my system. I did this by testing if Ruby and rubygem were in my path; if they were, these command return version numbers. For me, Biopieces required a Ruby version > 1.9 and a gem version > 2.0.

$ ruby -v
$ gem -v

So I just started removing Debian packages until those commands were unable to be found.

$ sudo apt-get remove ruby
$ sudo apt-get remove rubygems
$ sudo apt-get remove ruby1.9
$ sudo apt-get remove ruby1.8

And even then the executable for Ruby was still in my path. So I did the inelegant to get it out of my path:

$ sudo rm /usr/bin/ruby

Finally, testing versions returned nothing. Ruby nor gem were in my path.

Without Ruby on the system I had a bit of a fresh start. At this point, I grabbed the ruby_installer.sh script from the Biopieces site. This is a script to compile Ruby from source.

#Change to the directory to which it was downloaded (cd ~/Downloads in my case). One could also use wget here to download it.
$ chmod u+x ruby_installer.sh
$ ./ruby_installer.sh

This will compile Ruby from source and try to install the necessary gems, but for me it ultimately failed due to the issues with ZenTest and the provided version of Rubygem. As far as I could tell, this was because rubygems was not able to update through the ruby_install.sh script as was intended. The error I got was:

Installing RubyInline gem.
Fetching: ZenTest-4.9.2.gem (100%)
Invalid gemspec in [/home/user_name/ruby_install/lib/ruby/gems/1.9.1/specifications/ZenTest-4.9.2.gemspec]: Illformed requirement ["< 2.1, >= 1.8"]
Invalid gemspec in [/home/user_name/ruby_install/lib/ruby/gems/1.9.1/specifications/ZenTest-4.9.2.gemspec]: Illformed requirement ["< 2.1, >= 1.8"]
Fetching: RubyInline-3.12.2.gem (100%)
Invalid gemspec in [/home/user_name/ruby_install/lib/ruby/gems/1.9.1/specifications/ZenTest-4.9.2.gemspec]: Illformed requirement ["< 2.1, >= 1.8"]
ERROR:  Error installing RubyInline:
 RubyInline requires ZenTest (~> 4.3)

Importantly, at the end it states:

All done. Now append the following to your ~/.bashrc file:
export PATH="/home/user_name/ruby_install/bin:$PATH"

Here I added the ruby_install bin directory to my path by running that export command:

$ export PATH="/home/user_name/ruby_install/bin:$PATH"

To resolve the ZenTest illformed requirement error, I had to update Rubygems:

#This also gave some warnings about invalid gemspec and illformed requirement for ZenTest
$ gem update --system

And finally:

$ gem install RubyInline

At that point, the biopieces_install.sh installer worked. Don't forget to add the ruby_install bin directory to your .bashrc file. Lastly, this still leaves the third party software (BWA, Velvet, Bowtie, etc.) to be installed.

2 comments:

  1. Good work. I am sorry the installation is non-trivial - I blame the dependencies and not Biopieces. Especially, Ruby and ZenTest is a mess when using the packages from the different Linux distros. I hope that when Ruby 2.0 is adopted in the Linux distros life will become easier.

    ReplyDelete
    Replies
    1. Thanks for your comment, Martin, and for all of your work with Biopieces! I also blame the dependencies; I think my problem primarily stemmed from Ubuntu not allowing rubygems to update via the ruby_install.sh script.

      Delete