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)"
For RHEL9, I had to do this to get perl working:
sudo yum install perl-XML-LibXML
sudo yum install perl-English
sudo yum install perl-File-Copy
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
- Download and install cpanminus
wget -O- http://cpanmin.us | perl - -l ~/perl5 App::cpanminus local::lib - Set the environment variables needed to use the local modules
eval `perl -I ~/perl5/lib/perl5 -Mlocal::lib` - 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.
- 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
Related articles
Filter by label
There are no items with the selected labels at this time.