Using pybedtools under Python 2.6

I encountered an import error from collections import OrderedDict, while using pybedtools under Python 2.6. It took me some time to find a workaround… I posted it below.

# install dependencies and pybedtools
pip install cython ordereddict
pip install pybedtools

# edit file ... lib/python2.6/site-packages/pybedtools/contrib/
# comment import from collections and add try-except
#from collections import OrderedDict
    from collections import OrderedDict
except ImportError:
    from ordereddict import OrderedDict

Leave a Reply

Your email address will not be published. Required fields are marked *