Unexpected import error in qt4_gui.py

45 megtekintés
Ugrás az első olvasatlan üzenetre

Paul Keating

olvasatlan,
2021. jún. 27. 16:30:522021. 06. 27.
– The ETE toolkit
Beginner question here. 

Following the drawing tutorial I did this at an IDLE prompt:

>>> from ete3 import Tree
>>> t = Tree( "((a,b),c);" )
>>> t.show()
Traceback (most recent call last):
  File "<pyshell#167>", line 1, in <module>
    t.show()
  File "C:\Program Files\Python39\lib\site-packages\ete3\coretype\tree.py", line 1362, in show
    from ..treeview import drawer
  File "C:\Program Files\Python39\lib\site-packages\ete3\treeview\drawer.py", line 45, in <module>
    from .qt4_gui import _GUI, _PropertiesDialog, _BasicNodeActions
  File "C:\Program Files\Python39\lib\site-packages\ete3\treeview\qt4_gui.py", line 61, in <module>
    from .. import Tree, TreeStyle
ImportError: cannot import name 'TreeStyle' from 'ete3' (C:\Program Files\Python39\lib\site-packages\ete3\__init__.py)

The module raising the error is qt4_gui and I think this message must be something to do with the PyQt4/PyQt5 shim in treeview\qt.py. I say this because 
  • I am running Python 3.9 for which PyQt4 is not available, but I have PyQt5, and that seemed initially to be sufficient, until I ran into the problem above.
  • I went back to my Python 3.7 installation, for which PyQt4 Is available, installed PyQt4 and ete3 there, and the 3 lines from the tutorial worked.
I can migrate my project to Python 3.7 without too much fuss but if there is a simple way to avoid the now deprecated PyQt4 then I would be happy to hear about it. 



Válasz mindenkinek
Válasz a szerzőnek
Továbbítás
0 új üzenet