bioconda / bioconda-recipes

Conda recipes for the bioconda channel.
https://bioconda.github.io
MIT License
1.61k stars 3.22k forks source link

cgpBattenberg fails with "lib/Bio/DB/Sam.c: loadable library and perl binaries are mismatched" errors #30199

Open lconde-ucl opened 3 years ago

lconde-ucl commented 3 years ago

Hi,

I downloaded cgpBattemberg via bioconda (perl-sanger-cgp-battenberg, version 1.4.1, built pl5262h779adbc_6) but when I try to run the software (battenberg.pl) it fails with lib/Bio/DB/Sam.c: loadable library and perl binaries are mismatched (got handshake key 0xdb00080, needed 0xde00080) errors. Has anybody found the same problem?

To replicate the issue, this is what I am doing:

#- 1.- install miniconda2
mkdir cgpBattenberg
cd cgpBattenberg
wget https://repo.anaconda.com/miniconda/Miniconda2-latest-Linux-x86_64.sh
bash Miniconda2-latest-Linux-x86_64.sh  #- this installs conda in [...]/cgpBattenberg/conda_cgpBattenberg

#- 2.- activate env
conda config --append envs_dirs cgpBattenberg
conda activate conda_cgpBattenberg

#- 3.- install cgpBattenberg and dependencies (this runs well, no inconsistencies found)
conda config --add channels defaults
conda config --add channels bioconda
conda config --add channels conda-forge
conda install perl-sanger-cgp-battenberg

#- 4.- test cgpBattenberg: it's installed, but not working
$ battenberg.pl
lib/Bio/DB/Sam.c: loadable library and perl binaries are mismatched (got handshake key 0xdb00080, needed 0xde00080)

$ which battenberg.pl
[...]/cgpBattenberg/conda_cgpBattenberg/bin/battenberg.pl

$ which perl
[...]/cgpBattenberg/conda_cgpBattenberg/bin/perl

I also tried using the bioconda docker image but as in here the container does not seem to have all the dependencies and fails to find PCAP/Cli.pl

To replicate:

$ singularity pull docker://quay.io/biocontainers/perl-sanger-cgp-battenberg:1.4.1--pl5262h779adbc_6

$ singularity exec perl-sanger-cgp-battenberg_1.4.1--pl5262h779adbc_6.sif battenberg.pl
        WARNING: Bind mount '/home/regmond => /home/regmond' overlaps container CWD /home/regmond/Scratch/battenberg, may not be available
        Can't locate PCAP/Cli.pm in @INC (you may need to install the PCAP::Cli module) (@INC contains: /usr/local/bin/../lib/5.26.2/x86_64-linux-thread-multi /usr/local/bin/../lib/5.26.2 /usr/local/bin/../lib 
        /shared/ucl/depts/cancer/apps/miniconda/cgpBattenberg/conda_cgpBattenberg/lib/perl5/site_perl/5.22.0/x86_64-linux-thread-multi 
        /shared/ucl/depts/cancer/apps/miniconda/cgpBattenberg/conda_cgpBattenberg/lib/perl5/site_perl/5.22.0 /usr/local/lib/site_perl/5.26.2/x86_64-linux-thread-multi /usr/local/lib/site_perl/5.26.2 
        /usr/local/lib/5.26.2/x86_64-linux-thread-multi /usr/local/lib/5.26.2 .) at /usr/local/bin/battenberg.pl line 39.
        BEGIN failed--compilation aborted at /usr/local/bin/battenberg.pl line 39.

Any help would be greatly appreciated.

Thanks Lucia

pvanheus commented 3 years ago

Oddly enough, this works in my local (bio)conda but when I set up a fresh environment with Docker I can get it to fail, with this Dockerfile:

FROM ubuntu

RUN apt update && apt install -y wget && mkdir cgpBattenberg
WORKDIR cgpBattenberg

ENV STEP1=unknown
RUN wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
    bash Miniconda3-latest-Linux-x86_64.sh -b -p $(pwd)/conda_cgpBattenberg 

SHELL ["/bin/bash", "-c"]

RUN source $(pwd)/conda_cgpBattenberg/bin/activate && conda config --add channels defaults && conda config --add channels bioconda && conda config --add channels conda-forge && conda create -n bat -y perl-sanger-cgp-battenberg

RUN source $(pwd)/conda_cgpBattenberg/bin/activate && conda activate bat && battenberg.pl
pvanheus commented 3 years ago

I see that this recipe was contributed by @chapmanb quite some years ago. You might want to raise this issue with the upstream software maintainers. I see that they make a Docker image available, perhaps that is an alternative here.

lconde-ucl commented 3 years ago

@pvanheus I think their docker image does not contain cgpBattenberg as per this comment. Maybe @chapman has any suggestions on how to fix this? Otherwise I'll to install battenberg directly (I was trying cgpBattenberg via bioconda first, as it seemed the easiest way to install battenberg)

jmarshall commented 3 years ago

lib/Bio/DB/Sam.c: loadable library and perl binaries are mismatched (got handshake key 0xdb00080, needed 0xde00080)

This error indicates that there is a version mismatch between the main Perl executable and an XS module that was compiled for a (significantly) different version.

Sure enough, in the massive pile of packages that is installed when you install perl-sanger-cgp-battenberg, most are Perl 5.26.2 (including the main Perl runtime) but several are built against 5.22.0 — critically perl-bio-db-sam (and also the one that provides PCAP/Cli.pm, as observed).

At some point after perl 5.22.0, perl-bio-db-sam was renamed to perl-bio-samtools (which is a more accurate name matching the upstream name), which provides the same methods and functionality and has been built for 5.26.2.

Many of the bioconda packages in this particular pile have not been rebuilt for years. Ideally the perl-sanger-cgp-battenberg package (or whatever it is that it depends on that brings in perl-bio-db-sam) would be rebuilt with up-to-date dependencies. But in the meantime you should be able to get a working installation by specifying this explicitly with

conda create -n battenbergenv perl-sanger-cgp-battenberg perl-bio-samtools

(and removing any $PERL5LIB settings that you made to try to get the previous 5.26.2 / 5.22.0 chimera to work), which, for me at least, causes Conda to select an entirely 5.26.2-based set of packages.

lconde-ucl commented 3 years ago

@jmarshall Absolutely brilliant, many thanks for the detailed explanation!