etetoolkit / ete

Python package for building, comparing, annotating, manipulating and visualising trees. It provides a comprehensive API and a collection of command line tools, including utilities to work with the NCBI taxonomy tree.
http://etetoolkit.org
GNU General Public License v3.0
795 stars 214 forks source link

Python v3.6.6 and ete3 v3.1.1 breaks when rendering trees both in notebook and in file #381

Open jolespin opened 6 years ago

jolespin commented 6 years ago

In my terminal of JupyterLab I am getting this error:

[I 12:05:49.340 LabApp] Adapting to protocol v5.1 for kernel 189b4299-a5dd-4a2d-a970-9fe8191b8c2d
This application failed to start because it could not find or load the Qt platform plugin "cocoa"
in "".

Reinstalling the application may fix this problem.
[I 12:06:00.309 LabApp] KernelRestarter: restarting kernel (1/5), keep random ports

My Qt and PyQT versions:

(µ_env) jespinozlt-osx:install jespinoz$ conda list | grep "qt"
pyqt                      5.9.2            py36h655552a_2
qt                        5.9.6                h45cd832_2

I also tried installing cocoa again via:

pip install pyobjc-framework-cocoa
jolespin commented 6 years ago

I just tried a fresh install and I'm still getting the same error:

conda create --name ete3_env -c etetoolkit ete3

and then in Python

import ete3
newick = "(((petal_width:0.02441414758236135,petal_length:0.02441414758236135):0.08401047159792807,sepal_length:0.10842461918028942):0.6593033819912253,sepal_width:0.7677280011715147);"
tree = ete3.Tree(newick)
tree.render("./tree.png")

image

jhcepas commented 6 years ago

Sounds difficult to debug... Does this happen only with specific OSX or Qt5 versions?

jolespin commented 6 years ago

Indeed this one is a bit tricky. It must have to do with a different dependency because after I posted this I created a new environment installing everything with pip and it worked correctly. From my main environment I removed all the packages and tried to replicate this approach but got the same error. I’m going to try a fresh install of my main environment today when I get to work and will update you on the verdict. Do you have any insight on what backends could be broken in my current main environment that could produce this error?

On Oct 25, 2018, at 1:27 AM, Jaime Huerta-Cepas notifications@github.com wrote:

Sounds difficult to debug... Does this happen only with specific OSX or Qt5 versions?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

jolespin commented 6 years ago

I'm working on the debug right now to figure out what the issue. I'm also going to log any progress here. Here is a working installation environment with Python 3.6.6 and ete3. Here is my yml export file

name: ete3_env
channels:
  - defaults
dependencies:
  - appdirs=1.4.3=py36h28b3542_0
  - appnope=0.1.0=py36hf537a9a_0
  - asn1crypto=0.24.0=py36_0
  - attrs=18.2.0=py36h28b3542_0
  - automat=0.7.0=py36_0
  - backcall=0.1.0=py36_0
  - blas=1.0=mkl
  - bleach=3.0.2=py36_0
  - ca-certificates=2018.03.07=0
  - certifi=2018.10.15=py36_0
  - cffi=1.11.5=py36h6174b99_1
  - constantly=15.1.0=py36h28b3542_0
  - cryptography=2.3.1=py36hdbc3d79_0
  - dbus=1.13.2=h760590f_1
  - decorator=4.3.0=py36_0
  - entrypoints=0.2.3=py36_2
  - expat=2.2.6=h0a44026_0
  - freetype=2.9.1=hb4e5f40_0
  - gettext=0.19.8.1=h15daf44_3
  - glib=2.56.2=hd9629dc_0
  - html5lib=1.0.1=py36_0
  - hyperlink=18.0.0=py36_0
  - icu=58.2=h4b95b61_1
  - idna=2.7=py36_0
  - incremental=17.5.0=py36_0
  - intel-openmp=2019.0=118
  - ipykernel=5.1.0=py36h39e3cac_0
  - ipython=7.0.1=py36h39e3cac_0
  - ipython_genutils=0.2.0=py36h241746c_0
  - ipywidgets=7.4.2=py36_0
  - jedi=0.13.1=py36_0
  - jinja2=2.10=py36_0
  - jpeg=9b=he5867d9_2
  - jsonschema=2.6.0=py36hb385e00_0
  - jupyter=1.0.0=py36_7
  - jupyter_client=5.2.3=py36_0
  - jupyter_console=6.0.0=py36_0
  - jupyter_core=4.4.0=py36_0
  - libcxx=4.0.1=h579ed51_0
  - libcxxabi=4.0.1=hebd6815_0
  - libedit=3.1.20170329=hb402a30_2
  - libffi=3.2.1=h475c297_4
  - libgfortran=3.0.1=h93005f0_2
  - libiconv=1.15=hdd342a3_7
  - libpng=1.6.35=ha441bb4_0
  - libsodium=1.0.16=h3efe00b_0
  - libxml2=2.9.4=0
  - libxslt=1.1.29=hc208041_6
  - lxml=4.1.1=py36h6c891f4_0
  - markupsafe=1.0=py36h1de35cc_1
  - mistune=0.8.4=py36h1de35cc_0
  - mkl=2019.0=118
  - mkl_fft=1.0.6=py36hb8a8100_0
  - mkl_random=1.0.1=py36h5d10147_1
  - nbconvert=5.3.1=py36_0
  - nbformat=4.4.0=py36h827af21_0
  - ncurses=6.1=h0a44026_0
  - notebook=5.7.0=py36_0
  - numpy=1.15.3=py36h6a91979_0
  - numpy-base=1.15.3=py36h8a80b8c_0
  - openssl=1.0.2p=h1de35cc_0
  - pandoc=2.2.3.2=0
  - pandocfilters=1.4.2=py36_1
  - parso=0.3.1=py36_0
  - pcre=8.42=h378b8a2_0
  - pexpect=4.6.0=py36_0
  - pickleshare=0.7.5=py36_0
  - pip=10.0.1=py36_0
  - prometheus_client=0.4.2=py36_0
  - prompt_toolkit=2.0.6=py36_0
  - ptyprocess=0.6.0=py36_0
  - pyasn1=0.4.4=py36h28b3542_0
  - pyasn1-modules=0.2.2=py36_0
  - pycparser=2.19=py36_0
  - pygments=2.2.0=py36h240cd3f_0
  - pyopenssl=18.0.0=py36_0
  - pyqt=5.9.2=py36h655552a_2
  - python=3.6.6=hc167b69_0
  - python-dateutil=2.7.3=py36_0
  - pyzmq=17.1.2=py36h1de35cc_0
  - qt=5.9.6=h45cd832_2
  - qtconsole=4.4.2=py36_0
  - readline=7.0=h1de35cc_5
  - scipy=1.1.0=py36h28f7352_1
  - send2trash=1.5.0=py36_0
  - service_identity=17.0.0=py36h28b3542_0
  - setuptools=40.4.3=py36_0
  - simplegeneric=0.8.1=py36_2
  - sip=4.19.8=py36h0a44026_0
  - six=1.11.0=py36_1
  - sqlite=3.25.2=ha441bb4_0
  - terminado=0.8.1=py36_1
  - testpath=0.4.2=py36_0
  - tk=8.6.8=ha441bb4_0
  - tornado=5.1.1=py36h1de35cc_0
  - traitlets=4.3.2=py36h65bd3ce_0
  - twisted=17.5.0=py36_0
  - wcwidth=0.1.7=py36h8c6ec74_0
  - webencodings=0.5.1=py36_1
  - wheel=0.32.2=py36_0
  - widgetsnbextension=3.4.2=py36_0
  - xz=5.2.4=h1de35cc_4
  - zeromq=4.2.5=h0a44026_1
  - zlib=1.2.11=hf3cbc9b_2
  - zope=1.0=py36_1
  - zope.interface=4.5.0=py36h1de35cc_0
  - pip:
    - absl-py==0.2.2
    - ete3==3.1.1
    - grpcio==1.12.1
    - tb-nightly==1.9.0a20180606
    - tf-nightly==1.9.0.dev20180605
    - tfp-nightly==0.5.0.dev20181009
prefix: /Users/jespinoz/anaconda/envs/ete3_env
jolespin commented 6 years ago

I'm having difficult recreating the environment from above. This simple installation still yields an error.

env_name=testing_env
conda create -n $env_name python=3.6.6  --yes
source activate $env_name
conda install jupyter --yes
conda install  pyqt --yes
pip install ete3

Here are differences between the working and the broken environments: image

Interestingly, I tried installing just these and I'm still getting the same error. The only packages that did not install are the following conflicts. Note, I tried this for a different environment so maybe that could be why but thought it was still worth sharing.:

UnsatisfiableError: The following specifications were found to be in conflict:
  - libxml2==2.9.4=0
  - r-fansi -> r-base[version='>=3.5.1,<3.5.2.0a0'] -> libxml2[version='>=2.9.8,<2.10.0a0']
Use "conda info <package>" to see the dependencies for each package.

I've tried just about everything I could think of so I'm not sure what is breaking the installation. Hope some of this helps.

y9c commented 6 years ago

Did you try this before? Seems I met the same issue, and setting qt env variable manually fix it.

import os
os.environ['QT_QPA_PLATFORM']='offscreen'
jolespin commented 6 years ago

Thanks for the suggestion. I just tried it but it didn't end up fixing it in my env :/. I wonder what about other packages in my list above that makes it work?

jolespin commented 6 years ago

I was thinking about bruteforcing it. From this package, iteratively install a package try to render a tree to file and then print the environment specs. Is there a better way to do this?

orangeSi commented 6 years ago

Did you try this before? Seems I met the same issue, and setting qt env variable manually fix it.

import os
os.environ['QT_QPA_PLATFORM']='offscreen'

I meet the same question, QT_QPA_PLATFORM not works for me. I solved this by https://github.com/etetoolkit/ete/issues/387