Problems installing Perl modules

When a program requires a module that is not installed on the system, you may get an error similar to the following:

Can't locate XYZ.pm in @INC (you may need to install the XYZ module) (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5) at -e line 1.

or

Warining: XYZ module in Perl is missing

To get the perl modules installed, a Conda environment can be created with Perl installed within it using the following steps.

srun -p epyc -t 12:00:00 -c 4 --mem=4G --pty bash -l  # Conda can be compute heavy, so run on a compute node
conda create -n perl_env -c conda-forge perl  # Create a conda environment called "perl_env"
conda activate perl_env

At this point, running which cpan should return a path ending similar to:
..../.conda/envs/perl_env/bin/cpan

It should not return /usr/bin/cpan. If it does then please review your steps for setting up the conda environment and make sure it is activated.

With the environment activated, you use cpan to install packages, for example to install “SVG”:

cpan install SVG

In your batch scripts, or when running future Perl commands, make sure that you include conda activate perl_env to properly load the environment.