Question: ImportError: cannot import name getoutput (Biopython)
gravatar for afbrito
3.7 years ago by
afbrito0 wrote:

Dear all,

Could you please give me any help on how to deal with the error below. It concerns the package Bio._py3k, and occurs specifically at the last line of this package, failing to import getoutput.

I've tried to uninstall Biopython and reinstall different versions of it in order to fix the problem, however it was not successful. My last attempt was with Version 1.67. Seemingly, the other biopython packages are working fine, and only Phylo shows such problem.

I'm running Biopython on a Mac OSX Yosemite (10.10), python 2.7, biopython 1.68

What's the best solution for that?


[EDIT] I've just installed Python 3.6 and biopython 1.68, and the package could be imported without errors. However, with python 2.7 the problem persists.

    from Bio import Phylo
  File "/Library/Python/2.7/site-packages/Bio/Phylo/", line 11, in <module>
    from Bio.Phylo._io import parse, read, write, convert
  File "/Library/Python/2.7/site-packages/Bio/Phylo/", line 13, in <module>
    from Bio import File
  File "/Library/Python/2.7/site-packages/Bio/", line 28, in <module>
    from Bio._py3k import basestring
  File "/Library/Python/2.7/site-packages/Bio/_py3k/", line 267, in <module>
    from commands import getoutput
ImportError: cannot import name getoutput
importerror biopython python • 3.1k views
ADD COMMENTlink modified 12 months ago by kalilamali0 • written 3.7 years ago by afbrito0

You appear to have a problem with your python installation that is only being evidenced because biopython is trying to use a standard package that you don't have.

ADD REPLYlink written 3.7 years ago by Devon Ryan96k

I agree, from commands import getoutput is failing on something that Python 2.7 should come with

ADD REPLYlink written 3.7 years ago by Peter5.8k
gravatar for kalilamali
12 months ago by
kalilamali0 wrote:

What worked for me was: :)

1. dowload manually biopython-1.74.tar.gz 16Mb – Source Tarball from

2. decompress/unzip/tar biopython-1.74.tar.gz

3. in the terminal:

  • python build
  • python test sudo
  • python install


ADD COMMENTlink written 12 months ago by kalilamali0

Please do not spam old threads with content that is not relevant to the topic. I'll be deleting your comments where they are not relevant. Please be more careful in the future.

ADD REPLYlink written 12 months ago by RamRS30k
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1686 users visited in the last hour