1

If found some hits on stackoverflow where people have issues using ete3 tools when PyQT4 is not installed, and this (used to) also apply for me. However, I've now tried to reinstall a piece of software and it keeps complaining about 'Module' has no attritube 'Treestyle'.

To test whether PyQT was installed, I ran this python script:

from PyQt4.Qt import PYQT_VERSION_STR
print("PyQt version:", PYQT_VERSION_STR)

Which prints:

('PyQt version:', '4.12.1')

I get this (common) error:

Traceback (most recent call last):
  File "/mnt/f/mypy/bin/virtualmicrobes.py", line 1820, in <module>
    sys.exit(main())
  File "/mnt/f/mypy/bin/virtualmicrobes.py", line 1793, in main
    args.start(args)
  File "/mnt/f/mypy/bin/virtualmicrobes.py", line 408, in start_evo_sim
    result = init_and_simulate(simu, intermediate_load_file, _options)
  File "/mnt/f/mypy/local/lib/python2.7/site-packages/VirtualMicrobes/my_tools/utility.py", line 117, in wrapper
    raise ex_type(message)
AttributeError: 'module' object has no attribute 'TreeStyle' (in subprocess)
  File "/mnt/f/mypy/local/lib/python2.7/site-packages/VirtualMicrobes/my_tools/utility.py", line 91, in process_func
    ret = func(*args, **kwargs)
  File "/mnt/f/mypy/bin/virtualmicrobes.py", line 295, in init_and_simulate
    sim = sim_mod.create_simulation(**options)
  File "/mnt/f/mypy/local/lib/python2.7/site-packages/VirtualMicrobes/simulation/Simulation.py", line 1940, in create_simulation
    sim = ODE_simulation(params_dict)
  File "/mnt/f/mypy/local/lib/python2.7/site-packages/VirtualMicrobes/simulation/Simulation.py", line 1342, in __init__
    super(ODE_simulation, self).__init__(params)
  File "/mnt/f/mypy/local/lib/python2.7/site-packages/VirtualMicrobes/simulation/Simulation.py", line 86, in __init__
    self.init_graphs()
  File "/mnt/f/mypy/local/lib/python2.7/site-packages/VirtualMicrobes/simulation/Simulation.py", line 795, in init_graphs
    show=show, clean=clean, create=create)
  File "/mnt/f/mypy/local/lib/python2.7/site-packages/VirtualMicrobes/plotting/Graphs.py", line 1188, in __init__
    self.init_phylo_tree_graph(clean=clean)
  File "/mnt/f/mypy/local/lib/python2.7/site-packages/VirtualMicrobes/plotting/Graphs.py", line 1219, in init_phylo_tree_graph
    show=show, attribute_dict=self.attribute_mapper, create=clean, **kwargs)
  File "/mnt/f/mypy/local/lib/python2.7/site-packages/VirtualMicrobes/plotting/Graphs.py", line 985, in __init__
    self.init_tree_style_dict() # NOTE: unordered ok
  File "/mnt/f/mypy/local/lib/python2.7/site-packages/VirtualMicrobes/plotting/Graphs.py", line 1110, in init_tree_style_dict
    branch_vertical_margin=branch_vertical_margin)
  File "/mnt/f/mypy/local/lib/python2.7/site-packages/VirtualMicrobes/plotting/Graphs.py", line 1083, in make_tree_style
    ts = ete3.TreeStyle() 

Note: this time arround I am trying to install it on Ubuntu for Windows, but up till now almost everything that ran on Linux ran on this one too. It might be relevent though.

Any ideas?

PS To reproduce the problem, follow the following steps:

$ sudo apt-get install python-qt4
$ virtualenv ~/mypy --system-site-packages
$ source ~/mypy/bin/activate 
$ (mypy) > pip install VirtualMicrobes
$ (mypy) > virtualmicrobes evo --name TestMicrobes >> error

PPS User eyllanesc confirmed this is an 'Ubuntu for Windows' problem. I'm still trying to fix it though, if anyone can help me figure out how to link the pyqt4 packages correctly to my virtualenv that would be great. I've tried linken the native one with ln -s but I'm not getting any further

user2810298
  • 111
  • 9
  • Do not place just a piece of the error you must put the complete error message, you must also indicate how you have installed the packages and provide a [mcve] – eyllanesc Oct 17 '18 at 23:13
  • If you named a file `ete3.py` or a folder `ete`, pick a different name. – user2357112 Oct 17 '18 at 23:20
  • @eyllanesc Yeah.. how do you paste an entire stretch of code without having to format all the tabs? Its super anoying. – user2810298 Oct 17 '18 at 23:22
  • Copy the code, select all the code and press `Ctrl + k`, it's simple. Read https://meta.stackexchange.com/questions/22186/how-do-i-format-my-code-blocks – eyllanesc Oct 17 '18 at 23:24
  • with apt-get you install the package in the system python, not in the venv. What you must do is after activating the venv you must execute the following command: `pip install PyQt4` – eyllanesc Oct 17 '18 at 23:28
  • I think the system site packages should handle that, no? I tried your method, but I already have bad experiences with that one: `Collecting PyQt4 Could not find a version that satisfies the requirement PyQt4 (from versions: ) No matching distribution found for PyQt4` – user2810298 Oct 17 '18 at 23:30
  • @user2357112 thanks but that's not it :) – user2810298 Oct 17 '18 at 23:35
  • @user2810298 Do you get that error when installing when running `virtualmicrobes evo --name TestMicrobes` or when executing some script? – eyllanesc Oct 17 '18 at 23:43
  • I get it when running that specific line. Does it work on your side? – user2810298 Oct 17 '18 at 23:50
  • @user2810298 I am in arch linux and I have executed the commands that you point out without errors. – eyllanesc Oct 17 '18 at 23:53
  • Alright, then it might be a problem of the Ubuntu subsystem on Windows I guess. Would be nice to know why it does this though.. any ideas on how to figure this out? Somehow it cant find Pyqt4, basedon earlier SO posts... Btw, just to be sure, did you get into the simulation loop that iterates time? PS a huge thank you is in order. Thanks for helping me out so far :) – user2810298 Oct 17 '18 at 23:59
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/182056/discussion-between-user2810298-and-eyllanesc). – user2810298 Oct 18 '18 at 00:07
  • Ah wait, it should be virtualmicrobes.py, not just virtualmicrobes... I hope you figured that one out :/ – user2810298 Oct 18 '18 at 00:08
  • @user2810298 I have executed the commands that you point out without problems, I do not know what virtualmicrobes is for. I do not understand your last comment. – eyllanesc Oct 18 '18 at 00:10
  • I ment to say that in that final command “virtualmicrobes” should be replaced with “virtualmicrobes.py”. What output did that give? (Iow what if you run it without the final ‘>> error’ part) – user2810298 Oct 18 '18 at 00:21
  • @user2810298 I recommend editing your question adding that so that other users do not have to point out the same. I have not used >> since I want to see the error message. Please use `@username` – eyllanesc Oct 18 '18 at 02:14
  • @user2810298 I have not had any errors when executing the command but it takes too long so I have canceled it. – eyllanesc Oct 18 '18 at 03:59
  • @eyllanesc More than 20 seconds? – user2810298 Oct 18 '18 at 06:15
  • much more, it was running for at least 1 hour. – eyllanesc Oct 18 '18 at 06:18
  • Lol, thanks. It’s a major evolutionary simulation taking at least weeks, so that just means you got it running. Weird that I got issues on this specific machine (its a 2nd person trying to install it, who also wants to work with the simulation software but in ‘ubuntu for windows’) I’ll try to figure this out further, thanks a lot again, you were a major help! – user2810298 Oct 18 '18 at 06:30
  • @eyllanesc I tried to contact you via chat (to not spam anyone). Could you maybe help me figuring out what causes this problem? (you are pretty much one of the only people that got it working all at once..) – user2810298 Oct 19 '18 at 06:29

1 Answers1

0

I had similar issues. The problem might be that you don't have all the depencies installed and ete3 is not telling you all of them.

You can see which dependencies are missing with this code:

import ete3
ete3.__file__

Run it and it will tell you which dependencies are missing. Note that you might need to run it multiple times before you install them all!

aLbAc
  • 337
  • 3
  • 18