xc2333
xc2333

Reputation: 99

Can't locate perl module in @INC after install the module

I am really new to perl and trying to use the BioPerl module on CentOS 7 with apache2. After I successfully installed the module, the program still complain that it can't locate Bio/SeqIO.pm in @INC.

Full error trace:

Cant locate Bio/SeqIO.pm in @INC (@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 superpose/seqAlign.pm line 39.
BEGIN failed--compilation aborted at superpose/seqAlign.pm line 39.
Compilation failed in require at superpose/superposeController.pm line 38.
BEGIN failed--compilation aborted at superpose/superposeController.pm line 38.
Compilation failed in require at /var/www/cgi-bin/superpose.cgi line 11.
BEGIN failed--compilation aborted at /var/www/cgi-bin/superpose.cgi line 11.

Here is the location that I found the bioperl module:

/root/.cpan/build/BioPerl-1.007002-oajj3K/Bio
/root/.cpan/build/BioPerl-1.007002-oajj3K/blib/lib/Bio
/root/perl5/lib/perl5/x86_64-linux-thread-multi/auto/Bio
/root/perl5/lib/perl5/Bio
/root/.cpanm/work/1551466691.17906/BioPerl-1.007002/Bio
/root/.cpanm/work/1551466691.17906/BioPerl-1.007002/blib/lib/Bio
/root/.cpanm/work/1551734157.15167/BioPerl-1.007002/Bio
/root/.cpanm/work/1551734157.15167/BioPerl-1.007002/blib/lib/Bio
/root/.cpanm/work/1551825394.27587/BioPerl-1.007002/Bio
/root/.cpanm/work/1551825394.27587/BioPerl-1.007002/blib/lib/Bio

The @INC and %ENV from perl -V

%ENV:
PERL5LIB="/root/perl5/lib/perl5:"
PERL_LOCAL_LIB_ROOT=":/root/perl5"
PERL_MB_OPT="--install_base /root/perl5"
PERL_MM_OPT="INSTALL_BASE=/root/perl5"
@INC:
/root/perl5/lib/perl5/5.16.3/x86_64-linux-thread-multi
/root/perl5/lib/perl5/5.16.3
/root/perl5/lib/perl5/x86_64-linux-thread-multi
/root/perl5/lib/perl5
/usr/local/lib64/perl5
/usr/local/share/perl5
/usr/lib64/perl5/vendor_perl
/usr/share/perl5/vendor_perl
/usr/lib64/perl5
/usr/share/perl5

I realized that my @INC doesn't contain the path to "/root/perl5/lib/perl5/Bio", but I think as long as PERL5LIB contain "/root/perl5/lib/perl5", it should be able to find the module.

For the seqAlign.pm script, it links the perl library like this:

....
use lib qw(..);
use strict;
use Data::Dumper;

use Bio::SeqIO;
use Bio::PrimarySeq;
.... 

Thanks for help!

Upvotes: 1

Views: 6314

Answers (1)

ikegami
ikegami

Reputation: 385496

You've demonstrated that setting PERL5LIB to /root/perl5/lib/perl5 causes the following to be prepended to @INC:

/root/perl5/lib/perl5/5.16.3/x86_64-linux-thread-multi
/root/perl5/lib/perl5/5.16.3
/root/perl5/lib/perl5/x86_64-linux-thread-multi
/root/perl5/lib/perl5

However, these are absent in the @INC of the perl that gave the error message, so PERL5LIB is clearly not set to /root/perl5/lib/perl5 in environment in which you ran your script. Setting it appropriately in that environment will fix your problem.

Upvotes: 1

Related Questions