Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Perl dependencies not found for conda-installed package with biocontainers image #84

Closed
jaeddy opened this issue Feb 7, 2017 · 3 comments
Assignees

Comments

@jaeddy
Copy link

jaeddy commented Feb 7, 2017

Posted this in the 'bioconda-recipes' repo earlier and was directed here. I'm trying to build a Docker image with the variant-effect-predictor package and another tool, but I'm running into an issue with the installed script not detecting the required CGI Perl module.

I'm using the base image from BioContainers to manually test the VEP install. The installation with conda seems to work fine, but I get an error when I try to run the tool. It seems to be looking in the default Perl path for the container but not the conda-specific path. I can't tell whether this is a problem with the BioContainers image or with the VEP recipe.

Dockerfile here: https://github.com/BioContainers/containers/blob/master/biocontainers/Dockerfile

docker run -it biocontainers/biocontainers:latest
biodocker@0d70df106dd3:/data$ conda install variant-effect-predictor=86

Here's the error message:

biodocker@0d70df106dd3:/data$ variant_effect_predictor.pl --help
Can't locate CGI.pm in @INC (you may need to install the CGI module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.22.1 /usr/local/share/perl/5.22.1 /usr/lib/x86_64-linux-gnu/perl5/5.22 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.22 /usr/share/perl/5.22 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base .) at /opt/conda/bin/variant_effect_predictor.pl line 46.
BEGIN failed--compilation aborted at /opt/conda/bin/variant_effect_predictor.pl line 46.

Confirming that CGI was installed by the conda recipe under /opt/conda/lib/:

biodocker@0d70df106dd3:/data$ ls /opt/conda/lib/perl5/site_perl/5.22.0/
Algorithm  CGI.pod  Encode     HTML  LWP.pm      Sub     WWW       lwpcook.pod
Archive    Capture  Exception  HTTP  Mozilla     Test    YAML      lwptut.pod
Bio        Class    Exporter   IO    Net         Text    YAML.pm   x86_64-linux-thread-multi
CGI        Data     Fh.pm      IPC   SUPER.pm    URI     YAML.pod
CGI.pm     Devel    File       LWP   Statistics  URI.pm  auto
@prvst
Copy link
Member

prvst commented Feb 7, 2017

Hey @jaeddy;

This is a pretty common error message. As you know, it signs that the module can't be found. Since we are dealing with a container and a conda installation, the problem may come from different sources.

It seems to be looking in the default Perl path for the container but not the conda-specific path. I can't tell whether this is a problem with the BioContainers image or with the VEP recipe.

The perl interpreter will always look at the default place plus any other directory specified on the script. In this particular case, what's going on is that the module is being installed by conda on the conda directory, not the default directory for Perl modules. There is a way to circumvent this during run time, you just need to run the script like this:

perl -I /opt/conda/lib/perl5/site_perl/5.22.0/ /opt/conda/bin/variant_effect_predictor.pl --help

The -I (capital i) flag tells the interpreter that you are adding another directory to the @inc array on the fly.

When I run it like that I also have another error from a missing DBI module. So my guess here is that you will have the same problems with other modules, so:

  1. The conda manager is installing the modules on a custom folder and you need to:
    a) change that
    b) add the conda folder to your @inc array on your script.
  1. You mentioned about a recipe but, your exemple is using the base image and you are installing thing manually, so my second suggestion is to you to create a real recipe with all directives to have your script running.

I hope that can help you, I'm closing the issue but let me know if you need further asisstance

good luck

@jaeddy
Copy link
Author

jaeddy commented Feb 7, 2017

Thanks, @prvst! My understanding of Perl is admittedly rough. Working with that information, I was able to get the tool working within the container using these commands:

export PERL5LIB="/opt/conda/lib/perl5/site_perl/5.22.0"
export PERL5LIB="/opt/conda/lib/perl5/site_perl/5.22.0/x86_64-linux-thread-multi:$PERL5LIB"

Per your second point, I need to get up to speed on writing my own conda recipes - hopefully that will happen soon. Is there a good rule of thumb for how best to combine dependencies when building recipes/containers? For example, if some tool X required samtools, would you include samtools in the recipe for X; or would you install both samtools and X via conda in the Dockerfile?

@prvst
Copy link
Member

prvst commented Feb 7, 2017

I'm glad to know that you manage to have that working.

You should try conda first if your software is available there.
Have in mind that this is a general guideline, sometimes depending on the situation, like this problem you had, for example, if you feel that the conda installation can create some problems, then go ahead and include the software.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants