Skip to end of metadata
Go to start of metadata


The local::lib Perl module lets you install packages in a directory called perl5-O2 in your home directory, so that you don't need permission to install in the O2-wide directories in /n/app or /usr.

Note: On Orchestra, we have encouraged installing packages for your own use in a directory named perl5 in your home directory. However, if you use both Orchestra and O2, you may experience issues using the same perl5 directory, as different Perl versions are available as modules on the two clusters. This is why we suggest using a directory called perl5-O2 for installing Perl packages on O2, and a directory called perl5 for installing packages on Orchestra.

Turning on local::lib

You can set up local::lib so that each time you login, you'll be using a relatively modern version of Perl and local::lib. That way, the modules you install in your local perl5-O2 directory today will be available next time you login.

The following three commands will modify your .bashrc file to always look in your local directory first:

echo 'module load gcc/6.2.0' >> ~/.bashrc
echo 'module load perl/5.24.0' >> ~/.bashrc
echo '[ $SHLVL -eq 1 ] && eval $(perl -I$HOME/perl5-O2/lib/perl5 -Mlocal::lib=~/perl5-O2)' >> ~/.bashrc

The above commands need to be done only once ever.

Note: If you are using both Orchestra and O2, it will be advantageous to ensure O2-specific commands in your ~/.bashrc are only executed when you are on O2. Check out the What if I am using both Orchestra and O2? section on the Moving from Orchestra to O2 page for more information. 


Alternatively, you can start up local::lib manually whenever you want (once per login), to install new packages in your local perl5-O2 directory, or to use packages in that directory:

module load gcc/6.2.0
module load perl/5.24.0
eval `perl -Mlocal::lib=~/perl5-O2`

Using local::lib

That's it! Once you've turned it on, installing Perl modules with tools like cpan or cpanm will automatically install them to your local perl5-O2 directory.


  • No labels