phac-nml / mob-suite

MOB-suite: Software tools for clustering, reconstruction and typing of plasmids from draft assemblies
Apache License 2.0
124 stars 33 forks source link

mob-suite :: ete3 import TreeStyle error #28

Closed EricDeveaud closed 5 years ago

EricDeveaud commented 5 years ago

Hello after installing mob-suite using conda as described on the README I have the following error

(py36) mob-suite:~/tt> mob_typer --infile AB040415.fasta --outdir xx
Traceback (most recent call last):
  File "/opt/miniconda/envs/py36/bin/mob_typer", line 8, in <module>
    from mob_suite.mob_typer import main
  File "/opt/miniconda/envs/py36/lib/python3.6/site-packages/mob_suite/mob_typer.py", line 28, in <module>
    from mob_suite.mob_host_range import getTaxonomyTree, getLiteratureBasedHostRange, loadliteratureplasmidDB, \
  File "/opt/miniconda/envs/py36/lib/python3.6/site-packages/mob_suite/mob_host_range.py", line 9, in <module>
    from ete3 import NCBITaxa, TreeStyle
ImportError: cannot import name 'TreeStyle'

regards

Eric

kbessonov1984 commented 5 years ago

Hi Eric. We've also observed this behaviour with ete3 library. Other users also reported this issue. Unfortunately ete3 does not print a nice error exception message when it fails to import TreeStyle submodule responsible for graphically rendering trees. It happens because the qt5 library is not installed or it is non-functional. This issue was mentioned before here. See if you can install qt5 by running the commands below and make ete3 to be fully functional.

conda install -c conda-forge pyqt=5.9.2
conda install -c conda-forge qt=5.9.7

I am thinking to replace the ete3 dependency by our own code, but did not have time to write this functionality.

EricDeveaud commented 5 years ago

thanks for the advice. unfortunatly this not solve the problem.

after digging on pyqt libraries I noticed that some libraries are linked vs system libs that are missing

 (py36) mob-suite:/opt/miniconda/envs/py36/lib/python3.6/site-packages/PyQt5> ldd *.so | grep 'not found'| sort | uniq
        libEGL.so.1 => not found
        libGL.so.1 => not found
        libXcomposite.so.1 => not found
        libXcursor.so.1 => not found
        libXdamage.so.1 => not found
        libXfixes.so.3 => not found
        libXi.so.6 => not found
        libXrandr.so.2 => not found
        libXss.so.1 => not found
        libXtst.so.6 => not found
        libasound.so.2 => not found

installing libgGL.so.1 missing library (debian: libgl1-mesa-glx) solved the problem

EricDeveaud commented 5 years ago

FIY here is the singularity recipe I've come with.

Bootstrap: docker
From: ubuntu:16.04

%environment
    PATH="/opt/miniconda/condabin/bin:$PATH"

%post
    #---- system  
    #        libgl1-mesa-glx required to fix https://github.com/phac-nml/mob-suite/issues/28
    apt-get update
    apt-get install -y python3 python3-pip wget libgl1-mesa-glx
    apt-get clean

    #---- install conda
    wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh && \
       bash miniconda.sh -b -p /opt/miniconda && \
       rm -f miniconda.sh

    #---- conda config 
    . /opt/miniconda/bin/activate
    conda config --add channels defaults
    conda config --add channels conda-forge
    conda config --add channels bioconda

    #---- default conda use python3.7 => some reuirements of mob-suite requires python3.6
    conda create -y -n py36 python=3.6 conda
    conda activate py36

    #---- install mob_suite
    conda install -y blast amos mash circlator mob_suite
    sed -i 's%/usr/local%${CONDA_PREFIX}%g' ${CONDA_PREFIX}/bin/minimus2
    mob_init

%runscript
    #---- export PYTHONNOUSERSITE=1 in order to avoid container's python 
    #     to check ${HOME}/.local aka user installed libraries
    #     as we will mount ${HOME} in the container at run time
    . /opt/miniconda/etc/profile.d/conda.sh && conda activate py36 && PYTHONNOUSERSITE=1 exec ${1+"$@"}
kbessonov1984 commented 5 years ago

Thank you Eric. I did not know that you were trying to build a singularity container. We also have a docker container and instructions on how to convert it to singularity container at https://hub.docker.com/r/kbessonov/mob_suite. Thank you for the singularity recipe. I will add it to our repository for other users to easily build a singularity container. Your recipe is very valuable as it fixes both the ete3 dependency on mesa graphic libraries and minimus2 hard coded /user/local/bin path bugs that we had in the past.

kbessonov1984 commented 5 years ago

We had removed TreeStyle submodule dependency in version 2.0.1.