sjackman / docker-bio

Docker images of bioinformatics software
21 stars 0 forks source link

prokka: failed to build with XML:parser perl module error #2

Closed michaelbarton closed 7 years ago

michaelbarton commented 7 years ago

I get the following error when trying to build the prokka Dockerfile:

Installing XML::Parser failed. See /home/linuxbrew/.cpanm/work/1478040181.5/build.log for details. Retry with --force to force install it.
! Installing the dependencies failed: Module 'XML::Parser' is not installed
! Bailing out the installation for XML-SAX-Expat-0.51.
! Installing the dependencies failed: Module 'XML::SAX::Expat' is not installed
! Bailing out the installation for XML-Simple-2.22.
sjackman commented 7 years ago

The hack workaround is to cpanm --force XML::Parser and cross your fingers that it works. Perhaps it's failing because a dependency of XML::Parser is not installed. I'd have to troubleshoot. There may be useful info in /home/linuxbrew/.cpanm/work/1478040181.5/build.log

michaelbarton commented 7 years ago

Might it be possible to switch this out for the bioperl libxml-simple-perl apt dependencies? These seem to install successfully.

sjackman commented 7 years ago

Yes, so long as any of the other installed tools don't pull in perl as a dependency, in which case you're back to square one. I'd first try cpanm --force XML::Parser and/or check the log file. I've often seen that PERL modules fail to install due to a failed unit test, but appear to work fine nonetheless.

michaelbarton commented 7 years ago

Installing libxml-sax-expat-incremental-perl seemed to fix the xml parser install problem. Googling around about the bio perl one seems to agree with your assessment, where we should not expect all unit tests to pass. This seems a little disconcerting though.

michaelbarton commented 7 years ago

I can't seem to get prokka installed via linux brew in a docker container. I'd like use linuxbrew however I've been getting the following errors:

error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory

This comes from the blast dependency which installs python, which in turn gives the above error. I can fix this with brew install --build-from-source python. However when I do brew install prokka I get the error:

makeblastdb: error while loading shared libraries: libblastinput.so: cannot open shared object file: No such file or directory

I can't seem to get around or find a fix for this. Here is my complete dockerfile:

FROM ubuntu

RUN localedef -i en_US -f UTF-8 en_US.UTF-8

RUN apt-get update
RUN apt-get install -y \
    curl \
    g++ \
    gawk \
    gfortran \
    git \
    libbz2-dev \
    libcurl4-openssl-dev \
    libexpat-dev \
    libncurses-dev \
    libxml-sax-expat-incremental-perl \
    m4 \
    make \
    patch \
    ruby-dev \
    sudo \
    tcl \
    texinfo \
    unzip \
    uuid-runtime \
    zlib1g-dev

RUN useradd -m -s /bin/bash linuxbrew
RUN echo 'linuxbrew ALL=(ALL) NOPASSWD:ALL' >>/etc/sudoers

USER linuxbrew
WORKDIR /home/linuxbrew
ENV PATH /home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:$PATH
ENV SHELL /bin/bash
RUN yes |ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install)"
RUN brew doctor || true

RUN brew install cpanm
RUN cpanm --force Bio::Perl

RUN cpanm XML::Simple
ENV PERL5LIB /home/linuxbrew/perl5/lib/perl5

RUN brew tap homebrew/science

RUN sudo apt-get install --yes xz-utils bzip2

# python install error otherwise
# python: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory
#RUN brew install xz pkg-config gpatch homebrew/dupes/unzip makedepend
RUN brew install --build-from-source python

# Install infernal before hmmer to avoid this error:
# exactmatch.c: undefined reference to `fm_getChar'
RUN brew install infernal -v
RUN brew install jdk homebrew/dupes/ncurses readline sqlite gdbm openssl bzip2 jpeg libpng pcre hmmer aragorn prodigal tbl2asn parallel minced barrnap

#makeblastdb: error while loading shared libraries: libblastinput.so: cannot open shared object file: No such file or directory
RUN brew install --build-from-source blast

RUN brew install prokka -v
michaelbarton commented 7 years ago

If you have any suggestions that would be great, otherwise I will close this issue.

sjackman commented 7 years ago

libpython2.7.so.1.0 is provided by python and brew install python should resolve it. --build-from-source shouldn't be necessary. Did you find that it was?

libblastinput.so is provided by blast and located at ~/.linuxbrew/Cellar/blast/2.4.0/libexec/libblastinput.so Note that it's installed in libexec rather than lib.

makeblastdb should work. If it doesn't, you can trouble shoot using

patchelf --print-rpath `which makeblastdb`
ldd `which makeblastdb`

Two possible workarounds are to install blast from source using brew install -s blast or to symlink the blast libraries from libexec to $(brew --prefix)/lib

michaelbarton commented 7 years ago

libpython2.7.so.1.0 is provided by python and brew install python should resolve it. --build-from-source shouldn't be necessary. Did you find that it was?

Yes I found in this case that I got this error related to libpython2.7.so.1.0. This was fixed with the --build-from-source flag.

libblastinput.so is provided by blast and located at ~/.linuxbrew/Cellar/blast/2.4.0/libexec/libblastinput.so Note that it's installed in libexec rather than lib.

makeblastdb should work. If it doesn't, you can trouble shoot using

 patchelf --print-rpath `which makeblastdb`
ldd `which makeblastdb`

Two possible workarounds are to install blast using brew install -s blast or to symlink the blast libraries from libexec to $(brew --prefix)/lib.

I ended up using the binaries @tseemann provides in the prokka repository:

https://github.com/michaelbarton/prokka-assembly-evaluator/blob/db9325c52c616f46d723998daefdb95752a5c61d/image/bin/install.sh

Ideally I would like to have used linuxbrew and done a one-click install, however I struggled with the linuxbrew install for ~1.5 days for reasons above, whereas using the precompiled binaries I was able to do it in about ~1hr. I do want to emphasise that using linuxbrew is I think the "right-way" we should be managing software it just seemed like in this case I was not experienced enough to debug the install process.

sjackman commented 7 years ago

brew install blast should just work, and it is a bug if it doesn't. I'm afraid I don't have the time right now to dig into it further, but I will. I'm planning to update this Dockefile to make use of the precompiled binary bottles that have been built since I first created this repo to build a substantial image in the two hour Docker Hub automated build time limit.

sjackman commented 7 years ago

And sorry to hear of your struggles. It shouldn't be difficult. Something's gone off the rails in your case, and I'll have to do some digging to figure out why.