Installing perl modules as a non-root user

When you run the perl script create_newcase of ACME/cime, you may see a warning like this:

The perl module XML::LibXML is needed for XML parsing in the CESM script system. Please contact your local systems administrators or IT staff and have them install it for you, or install the module locally.

You can also check this issue with the following command:
perl -MXML::LibXML -e 1
If the perl module XML::LibXML is not installed, you will get an error message like this:
Can't locate XML/LibXML.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl .).
BEGIN failed--compilation aborted.


If you have root access, you can directly install XML::LibXML.

On systems using dpkg/apt (Debian, Ubuntu, Mint, etc.):

sudo apt-get install libxml-libxml-perl

On systems using rpm/yum (RedHat, CentOS, Fedora, etc.):

sudo yum install "perl(XML::LibXML)"


On machines where you do not have root access, you can install XML::LibXML locally to your home directory. The easiest method to install perl modules locally is to use cpanminus (cpanm).

Step-by-step guide

  1. Download and install cpanminus
    wget -O- http://cpanmin.us | perl - -l ~/perl5 App::cpanminus local::lib
  2. Set the environment variables needed to use the local modules
    eval `perl -I ~/perl5/lib/perl5 -Mlocal::lib`
  3. Ensure we will be able to use the environment variables the next time we log in

    echo 'eval `perl -I ~/perl5/lib/perl5 -Mlocal::lib`' >> ~/.profile

    This assumes your profile is named .profile, you may need to change that to be .bash_profile, .bashrc, etc.

  4. Install a perl module by saying "cpanm Module::Name". In this case, it is:
    cpanm  XML::LibXML

I have seen this issue more than once. Here is a potentially useful instructions from NERSC site:

http://www.nersc.gov/users/computational-systems/genepool/software/perl-on-genepool/#toc-anchor-2


Filter by label

There are no items with the selected labels at this time.