2

I am using conda to install several packages. I already installed Perl under conda and is the one working in this machine (running Ubuntu 18.04). Now I am trying to use a script that requires bioperl.

I tried to update conda, install bioperl through conda AND installing bioperl through cpanm as shown below.

I checked to currently used Perl is the anaconda one. The shebang in the perl script is #!/home/evo-slave/anaconda_ete/bin/perl -w

This is the initial error while running the script

    Can't locate Bio/SeqIO.pm in @INC (you may need to install the 
    Bio::SeqIO module) (@INC contains: /home/evo- 
    slave/anaconda_ete/lib/site_perl/5.26.2/x86_64-linux-thread-multi 
    /home/evo-slave/anaconda_ete/lib/site_perl/5.26.2 /home/evo- 
    slave/anaconda_ete/lib/5.26.2/x86_64-linux-thread-multi /home/evo- 
    slave/anaconda_ete/lib/5.26.2 .) at ./cortador.pl line 9.
    BEGIN failed--compilation aborted at ./cortador.pl line 9.

I don`t know if this is an issue of bioperl not being called/installed by the anaconda perl or during the execution of the script, maybe this lines within the script should indicate something else

    use File::Basename;
    use Bio::SeqIO;
    use Bio::Seq;
    use Bio::DB::SeqFeature::Store;
    use Bio::SeqFeatureI;

When I try to install

    cpanm Bio::Perl

I got this error

    --> Working on Bio::Perl
    Fetching http://www.cpan.org/authors/id/C/CJ/CJFIELDS/BioPerl- 
    1.007002.tar.gz ... OK
    Configuring BioPerl-1.007002 ... OK
    ==> Found dependencies: IO::String, Data::Stag, Test::Most
    --> Working on IO::String
    Fetching http://www.cpan.org/authors/id/G/GA/GAAS/IO-String-

    1.08.tar.gz ... OK
    Configuring IO-String-1.08 ... OK
    Building and testing IO-String-1.08 ... OK
    Successfully installed IO-String-1.08
    --> Working on Data::Stag
    Fetching http://www.cpan.org/authors/id/C/CM/CMUNGALL/Data-Stag- 
    0.14.tar.gz ... OK
    Configuring Data-Stag-0.14 ... OK
    ==> Found dependencies: IO::String
    ! Installing the dependencies failed: Module 'IO::String' is not 
    installed
    ! Bailing out the installation for Data-Stag-0.14.
    --> Working on Test::Most
    Fetching http://www.cpan.org/authors/id/O/OV/OVID/Test-Most- 
    0.35.tar.gz ... OK
    Configuring Test-Most-0.35 ... OK
    ==> Found dependencies: Test::Warn, Test::Deep, Test::Differences, 
    Test::Exception, Exception::Class
    --> Working on Test::Warn
    Fetching http://www.cpan.org/authors/id/B/BI/BIGJ/Test-Warn- 
    0.36.tar.gz ... OK
    Configuring Test-Warn-0.36 ... OK
    ==> Found dependencies: Sub::Uplevel
    --> Working on Sub::Uplevel
    Fetching http://www.cpan.org/authors/id/D/DA/DAGOLDEN/Sub-Uplevel- 
    0.2800.tar.gz ... OK
    Configuring Sub-Uplevel-0.2800 ... OK
    Building and testing Sub-Uplevel-0.2800 ... OK
    Successfully installed Sub-Uplevel-0.2800
    ! Installing the dependencies failed: Module 'Sub::Uplevel' is not 
    installed
    ! Bailing out the installation for Test-Warn-0.36.
    --> Working on Test::Deep
    Fetching http://www.cpan.org/authors/id/R/RJ/RJBS/Test-Deep- 
    1.128.tar.gz ... OK
    Configuring Test-Deep-1.128 ... OK
    Building and testing Test-Deep-1.128 ... OK
    Successfully installed Test-Deep-1.128
    --> Working on Test::Differences
    Fetching http://www.cpan.org/authors/id/D/DC/DCANTRELL/Test- 
    Differences-0.67.tar.gz ... OK
    Configuring Test-Differences-0.67 ... OK
    ==> Found dependencies: Capture::Tiny, Text::Diff
    --> Working on Capture::Tiny
    Fetching http://www.cpan.org/authors/id/D/DA/DAGOLDEN/Capture- 
    Tiny-0.48.tar.gz ... OK
    Configuring Capture-Tiny-0.48 ... OK
    Building and testing Capture-Tiny-0.48 ... OK
    Successfully installed Capture-Tiny-0.48
    --> Working on Text::Diff
    Fetching http://www.cpan.org/authors/id/N/NE/NEILB/Text-Diff- 
    1.45.tar.gz ... OK
    Configuring Text-Diff-1.45 ... OK
    ==> Found dependencies: Algorithm::Diff
    --> Working on Algorithm::Diff
    Fetching http://www.cpan.org/authors/id/T/TY/TYEMQ/Algorithm-Diff- 
    1.1903.tar.gz ... OK
    Configuring Algorithm-Diff-1.1903 ... OK
    Building and testing Algorithm-Diff-1.1903 ... OK
    Successfully installed Algorithm-Diff-1.1903
    ! Installing the dependencies failed: Module 'Algorithm::Diff' is 
     not installed
    ! Bailing out the installation for Text-Diff-1.45.
    ! Installing the dependencies failed: Module 'Text::Diff' is not 
    installed, Module 'Capture::Tiny' is not installed
    ! Bailing out the installation for Test-Differences-0.67.
    --> Working on Test::Exception
    Fetching http://www.cpan.org/authors/id/E/EX/EXODIST/Test- 
    Exception-0.43.tar.gz ... OK
    Configuring Test-Exception-0.43 ... OK
    ==> Found dependencies: Sub::Uplevel
    ! Installing the dependencies failed: Module 'Sub::Uplevel' is not 
    installed
    ! Bailing out the installation for Test-Exception-0.43.
    --> Working on Exception::Class
    Fetching http://www.cpan.org/authors/id/D/DR/DROLSKY/Exception- 
    Class-1.44.tar.gz ... OK
    Configuring Exception-Class-1.44 ... OK
    ==> Found dependencies: Class::Data::Inheritable
    --> Working on Class::Data::Inheritable
    Fetching http://www.cpan.org/authors/id/T/TM/TMTM/Class-Data- 
    Inheritable-0.08.tar.gz ... OK
    Configuring Class-Data-Inheritable-0.08 ... OK
    Building and testing Class-Data-Inheritable-0.08 ... OK
    Successfully installed Class-Data-Inheritable-0.08
    ! Installing the dependencies failed: Module 
    'Class::Data::Inheritable' is not installed
    ! Bailing out the installation for Exception-Class-1.44.
    ! Installing the dependencies failed: Module 'Test::Exception' is 
    not installed, Module 'Test::Differences' is not installed, Module 
    'Exception::Class' is not installed, Module 'Test::Warn' is not 
    installed, Module 'Test::Deep' is not installed
    ! Bailing out the installation for Test-Most-0.35.
    ! Installing the dependencies failed: Module 'Test::Most' is not 
    installed, Module 'IO::String' is not installed, Module 
    'Data::Stag' 
    is not installed
    ! Bailing out the installation for BioPerl-1.007002.
    6 distributions installed

ETA: It seems something is wrong and the dependencies of the modules that are required are not installed during a simple cpanm Example of a round trying to install everything that is needed


    cpanm Sub::Uplevel

    --> Working on Sub::Uplevel
    Fetching http://www.cpan.org/authors/id/D/DA/DAGOLDEN/Sub-Uplevel-0.2800.tar.gz ... OK
    Configuring Sub-Uplevel-0.2800 ... OK
    Building and testing Sub-Uplevel-0.2800 ... OK
    Successfully installed Sub-Uplevel-0.2800
    1 distribution installed

then

    cpanm Test::Warn

    --> Working on Test::Warn
    Fetching http://www.cpan.org/authors/id/B/BI/BIGJ/Test-Warn-0.36.tar.gz ... OK
    Configuring Test-Warn-0.36 ... OK
    ==> Found dependencies: Sub::Uplevel
    --> Working on Sub::Uplevel
    Fetching http://www.cpan.org/authors/id/D/DA/DAGOLDEN/Sub-Uplevel-0.2800.tar.gz ... OK
    Configuring Sub-Uplevel-0.2800 ... OK
    Building and testing Sub-Uplevel-0.2800 ... OK
    Successfully installed Sub-Uplevel-0.2800
    ! Installing the dependencies failed: Module 'Sub::Uplevel' is not installed
    ! Bailing out the installation for Test-Warn-0.36.
    1 distribution installed

Some info to help debugging:

$ set | grep ^PERL
PERL5LIB=:/media/evo-slave/Disco2/ANDRES/DOWNLOADS/GENOME/CAV-POC/GAAS/annotation
PERL_MB_OPT='--install_base "/home/evo-slave/perl5"'
PERL_MM_OPT=INSTALL_BASE=/home/evo-slave/perl5

$ which cpanm
/home/evo-slave/anaconda_ete/bin/cpanm

$ head -n 1 "$( which cpanm )"
#!/home/evo-slave/anaconda_ete/bin/perl
ikegami
  • 367,544
  • 15
  • 269
  • 518
Andrés Parada
  • 319
  • 7
  • 21
  • Seem like the first failure is for `IO::String`. Try to install `IO::String` by itself first: `cpanm IO::String`. What errors do you get? – Håkon Hægland Oct 08 '19 at 18:28
  • I tried install `Bio::Perl` on my laptop now (Ubuntu 19.04, perl version 5.28.1) and it installed fine with `cpanm` – Håkon Hægland Oct 08 '19 at 18:32
  • @HåkonHægland I tried this and now it is another dependency that is required, I am installing one by one. Is this normal or something is off that cpanm can't find the dependencies and install itself without conflict? I had to manually install Capture::Tiny, Text:Differences etc – Andrés Parada Oct 08 '19 at 19:02
  • No I don't think it is normal, but it has happened to me also occasionally. Maybe some of the modules have failed to present their requisites in a way that `cpanm` can read them? Just a guess – Håkon Hægland Oct 08 '19 at 19:27
  • I think you are installing the modules into a non-standard location, and that you haven't told Perl to look there for modules. What's the output of `set | grep ^PERL ; which cpanm ; head -n 1 "$( which cpanm )"` – ikegami Oct 08 '19 at 19:47
  • @ikegami `(base) evo-slave@evo-slave:~$ set | grep ^PERL PERL5LIB=:/media/evo-slave/Disco2/ANDRES/DOWNLOADS/GENOME/CAV-POC/GAAS/annotation PERL_MB_OPT='--install_base "/home/evo-slave/perl5"' PERL_MM_OPT=INSTALL_BASE=/home/evo-slave/perl5 (base) evo-slave@evo-slave:~$ which cpanm /home/evo-slave/anaconda_ete/bin/cpanm (base) evo-slave@evo-slave:~$ head -n 1 "$( which cpanm )" #!/home/evo-slave/anaconda_ete/bin/perl ` – Andrés Parada Oct 08 '19 at 20:14
  • Yeah, I was right. `/home/evo-slave/perl5/` needs to be in `PERL5LIB`. Not sure what `` is, though. Judging by the leading `:`, I suspect the correct value was in `PERL5LIB`, but it got accidentally clobbered when `/media/evo-slave/Disco2/ANDRES/DOWNLOADS/GENOME/CAV-POC/GAAS/annotation` was added. Double check the statement that added that to `PERL5LIB`. Do you have `export PERL5LIB=$TYPO:/media/...` instead of `export PERL5LIB=$PERL5LIB:/media/...`? – ikegami Oct 08 '19 at 20:52

1 Answers1

4

UPDATE 2

This problem is coming up again in miniconda3 bioperl installs.

UPDATE

I have not experienced this error for a while with perl packages, so likely some updates occurred on the conda/package side that fixed this. I would recommend trying to update your conda and checking your conda channels before trying this kind of weird kludge.

ORIGINAL ANSWER

I am posting this as an answer not because it's a good idea, but because it provides more information. I am working on Amazon Linux so it's slightly different, but also running into issues with bioperl dependencies installed through conda. In my case I am trying to run VirSorter, which mentions this problem and proposes a solution that does not work for me, but suggests confirming that your PERL5LIB is properly set.

I observed that my perl is 5.26.2:

$ perl --version

This is perl 5, version 26, subversion 2 (v5.26.2) built for x86_64-linux-thread-multi

But conda is for some obscure reason installing my perl dependencies for 5.22.0: /home/ec2-user/anaconda3/envs/virsorter/lib/perl5/site_perl/5.22.0/:

$ ls /home/ec2-user/anaconda3/envs/virsorter/lib/perl5/site_perl/5.22.0/
Algorithm  Bio  Capture  Class  Data  Devel  Exception  IO  Sub  Test  Text  URI  URI.pm  x86_64-linux-thread-multi

I found that I could get VirSorter running, apparently successfully, by simply setting PERL5LIB to the 5.22.0 lib under conda:

OLD_PER5LIB=$PERL5LIB
export PERL5LIB=/home/ec2-user/anaconda3/envs/virsorter/lib/perl5/site_perl/5.22.0/
# run virsorter
# no errors!

I am sure that this throws up a bunch of red flags for the perl people, and I'm sure that it's very fragile if it actually works at all. Perhaps the question is why conda is installing perl modules as the wrong perl version?

Maximilian Press
  • 300
  • 4
  • 12
  • thanks for the response, I don't have that machine with that installation ATM, I hope this can be fixed in the future for other users too. – Andrés Parada Jun 02 '20 at 17:10
  • 1
    @AndrésParada Agreed- possibly you might be able to use the closely related solution suggested by VirSort authors for Ubuntu here: https://github.com/simroux/VirSorter/#note-for-conda-installation. Roughly, `export PERL5LIB=`pwd`/../../../lib/site_perl/5.26.2/`. This did not work for me as my `site_perl` was different, possibly due to linux distro. – Maximilian Press Jun 02 '20 at 19:04
  • 1
    Changing PERL5LIB to point to miniconda worked for me. `export PERL5LIB="/PATHTOHOME/miniconda3/envs/stable/lib/perl5/site_perl/5.22.0/"` – Shivam Sharma Aug 18 '21 at 17:34