Biopython: ImportError: No module named TreeConstruction
2
0
Entering edit mode
9.7 years ago
sivanc7 ▴ 10

Hi to all! Someone knows why I get the following error?

>>> from Bio.Phylo.TreeConstruction import DistanceCalculator, DistanceTreeConstructor

Traceback (most recent call last):
  File "<pyshell#6>", line 1, in <module>
    import Bio.Phylo.TreeConstruction
ImportError: No module named TreeConstruction

And also:

>>> from Bio.Phylo.Consensus import *

Traceback (most recent call last):
  File "<pyshell#9>", line 1, in <module>
    from Bio.Phylo.Consensus import *
ImportError: No module named Consensus

Thanks to all for you time =)

python software-error biopython • 4.0k views
ADD COMMENT
1
Entering edit mode
9.7 years ago

Which version of BioPython are you using ? You can check version:

python -c 'import Bio; print Bio.__version__'
python -c 'from Bio.Phylo.TreeConstruction import DistanceCalculator, DistanceTreeConstructor'

is working in BioPython 1.65.

ADD COMMENT
0
Entering edit mode

version 1.65. But this is weird, it works in the terminal, but not in the python IDLE !

ADD REPLY
1
Entering edit mode
9.7 years ago
sivanc7 ▴ 10

Ok. Fixed!

The problem was that in the python IDLE, the version of biopython was 1.63, whereas the code

>>>from Bio.Phylo.TreeConstruction import DistanceCalculator, DistanceTreeConstructor

works nice for version 1.65. So, the solution was delete the folder where biopython 1.63 was installed and download and later (re)install the biopython 1.65.

ADD COMMENT
0
Entering edit mode

Good to know it works now. :)

ADD REPLY

Login before adding your answer.

Traffic: 1695 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6