Multiqc: docker image of multiqc:1.9 error with singularity

Created on 9 Jun 2020  路  5Comments  路  Source: ewels/MultiQC

Description of bug:
I recently tried to update the multiqc docker image in my workflow to multiqc:1.9 and found that multiqc now errors out, even though i did not change my inputs or script.

MultiQC Error log:

Traceback (most recent call last):
  File "/home/noronhaa/.local/lib/python3.8/site-packages/numpy/core/__init__.py", line 24, in <module>
    from . import multiarray
  File "/home/noronhaa/.local/lib/python3.8/site-packages/numpy/core/multiarray.py", line 14, in <module>
    from . import overrides
  File "/home/noronhaa/.local/lib/python3.8/site-packages/numpy/core/overrides.py", line 7, in <module>
    from numpy.core._multiarray_umath import (
ImportError: Error loading shared library ld-linux-x86-64.so.2: No such file or directory (needed by /home/noronhaa/.local/lib/python3.8/site-packages/numpy/core/_multiarray_umath.cpython-38-x86_64-linux-gnu.so)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/multiqc", line 11, in <module>
    load_entry_point('multiqc==1.9', 'console_scripts', 'multiqc')()
  File "/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 489, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 2852, in load_entry_point
    return ep.load()
  File "/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 2443, in load
    return self.resolve()
  File "/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 2449, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/lib/python3.8/site-packages/multiqc/__init__.py", line 16, in <module>
    from .multiqc import run
  File "/usr/lib/python3.8/site-packages/multiqc/multiqc.py", line 38, in <module>
    from .plots import table
  File "/usr/lib/python3.8/site-packages/multiqc/plots/table.py", line 9, in <module>
    from multiqc.utils import config, report, util_functions, mqc_colour
  File "/usr/lib/python3.8/site-packages/multiqc/utils/mqc_colour.py", line 7, in <module>
    import spectra
  File "/home/noronhaa/.local/lib/python3.8/site-packages/spectra/__init__.py", line 1, in <module>
    from .core import COLOR_SPACES, Color, Scale
  File "/home/noronhaa/.local/lib/python3.8/site-packages/spectra/core.py", line 1, in <module>
    from colormath import color_objects, color_conversions
  File "/home/noronhaa/.local/lib/python3.8/site-packages/colormath/color_objects.py", line 8, in <module>
    import numpy
  File "/home/noronhaa/.local/lib/python3.8/site-packages/numpy/__init__.py", line 142, in <module>
    from . import core
  File "/home/noronhaa/.local/lib/python3.8/site-packages/numpy/core/__init__.py", line 50, in <module>
    raise ImportError(msg)
ImportError: 

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.

We have compiled some common reasons and troubleshooting tips at:

    https://numpy.org/devdocs/user/troubleshooting-importerror.html

Please note and check the following:

  * The Python version is: Python3.8 from "/usr/local/bin/python"
  * The NumPy version is: "1.18.4"

and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.

Original error was: Error loading shared library ld-linux-x86-64.so.2: No such file or directory (needed by /home/noronhaa/.local/lib/python3.8/site-packages/numpy/core/_multiarray_umath.cpython-38-x86_64-linux-gnu.so)

File that triggers the error:

MultiQC run details (please complete the following):

  • Command used to run MultiQC: multiqc .
  • MultiQC Version: v1.9
  • Operating System: linux
  • Python Version: Python3.8, because that is installed in the image
  • Method of MultiQC installation: ewels/multiqc:1.9 docker image

Additional context
I pulled and ran the docker image using singularity (tried versions 3.1.1 and 3.3.0). Even when running multiqc . in an empty folder, i still get the above error. i tried to pull the image to a different location and still got the same error.

bug

All 5 comments

Just tested locally with Docker and this image works fine for me, both in an empty directory and with test files:

$ cd empty_dir/

$ docker run -v `pwd`:`pwd` -w `pwd` ewels/multiqc:1.9 .
Unable to find image 'ewels/multiqc:1.9' locally
1.9: Pulling from ewels/multiqc
e6b0cf9c0882: Pull complete
536836f33c44: Pull complete
f3dabb2f3b73: Pull complete
60269c4ac601: Pull complete
2dd3f264438a: Pull complete
Digest: sha256:225eb701ed423cfc2cc6d4548fb22eb803e2d34be25298f112c84b23aca50abc
Status: Downloaded newer image for ewels/multiqc:1.9
[INFO   ]         multiqc : This is MultiQC v1.9
[INFO   ]         multiqc : Template    : default
[INFO   ]         multiqc : Searching   : /Users/philewels/empty_test
[WARNING]         multiqc : No analysis results found. Cleaning up..
[INFO   ]         multiqc : MultiQC complete

$ cd ../star/

$ docker run -v `pwd`:`pwd` -w `pwd` ewels/multiqc:1.9 .
[INFO   ]         multiqc : This is MultiQC v1.9
[INFO   ]         multiqc : Template    : default
[INFO   ]         multiqc : Searching   : /Users/philewels/GitHub/MultiQC_TestData/data/modules/star
[INFO   ]            star : Found 4 reports and 1 gene count files
[INFO   ]         multiqc : Compressing plot data
[INFO   ]         multiqc : Report      : multiqc_report.html
[INFO   ]         multiqc : Data        : multiqc_data
[INFO   ]         multiqc : MultiQC complete

So my guess is that this problem is due to the installation in the Singularity container incorrectly interacting with your local Python installation outside of the container.

You can see that MultiQC is in the container at /usr/lib/python3.8/site-packages/multiqc/
However, the numpy files are at /home/noronhaa/.local/lib/python3.8/site-packages/numpy/

We've come across this in the nf-core community before, leading us to add this to our pipelines, setting the environment variable PYTHONNOUSERSITE = 1 (see python docs). This seemed to fix the problem that we encountered at that time.

Do you think you could give this a go and see if it helps @anoronh4?

Phil

i did a quick test outside of nextflow where i set export PYTHONNOUSERSITE=1 and then ran my container.

$ export PYTHONNOUSERSITE=1
$ singularity exec ../multiqc_1.9.sif /bin/bash
$ multiqc . 
[INFO   ]         multiqc : This is MultiQC v1.9
[INFO   ]         multiqc : Template    : default
[INFO   ]         multiqc : Searching   : /home/noronhaa/testmqc
/usr/lib/python3.8/site-packages/multiqc/modules/custom_content/custom_content.py:71: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  cust_mods[c_id]['config'].update( { k:v for k, v in f.items() if k is not 'data' } )
[WARNING]         multiqc : No analysis results found. Cleaning up..
[INFO   ]         multiqc : MultiQC complete

Seems that a warning is thrown, but to my understanding it will still "work by accident" so to speak, and i can import numpy with no issues as well. Thanks! I think i can consider the issue resolved for now...

Ah nice, I've not seen that warning before - code updated accordingly 馃憤

That's great though! Glad that solved the problem. I'll add something to the documentation about Singularity and how to avoid this issue.

Phil

New documentation: https://multiqc.info/docs/#using-singularity

Was this page helpful?
0 / 5 - 0 ratings