daler/pybedtools

Version number on pip fails to parse on import

Closed this issue · 3 comments

pybedtools installed from pip using pip install -U pybedtools==0.8.0 in a python virtual environment (venv root redacted) on a CentOS system. bedtools is installed in /usr/local/bin/bedtools from git source:

$ bedtools --version
bedtools v2.17.0-137-g83ce948

Python traceback:

Traceback (most recent call last):
  File [redacted], in <module>
    import pybedtools
  File "[redacted]/lib64/python3.6/site-packages/pybedtools/__init__.py", line 17, in <module>
    from .bedtool import BedTool
  File "[redacted]/lib64/python3.6/site-packages/pybedtools/bedtool.py", line 388, in <module>
    class BedTool(object):
  File "[redacted]/lib64/python3.6/site-packages/pybedtools/bedtool.py", line 1637, in BedTool
    @_wraps(prog='bed12ToBed6', implicit='i', bam=None, other=None)
  File "[redacted]/lib64/python3.6/site-packages/pybedtools/bedtool.py", line 167, in _wraps
    p = subprocess.Popen(helpers._version_2_15_plus_names(prog) + ['-h'],
  File "[redacted]/lib64/python3.6/site-packages/pybedtools/helpers.py", line 287, in _version_2_15_plus_names
    _check_for_bedtools()
  File "[redacted]/lib64/python3.6/site-packages/pybedtools/helpers.py", line 89, in _check_for_bedtools
    settings.bedtools_version = [int(i) for i in vv.split(".")]
  File "[redacted]/lib64/python3.6/site-packages/pybedtools/helpers.py", line 89, in <listcomp>
    settings.bedtools_version = [int(i) for i in vv.split(".")]
ValueError: invalid literal for int() with base 10: '0-137-g83ce948\n'

The issue was related to the fact that my system administrator compiled bedtools from a git clone rather than a release tarball. A workaround is to compile and locally install bedtools from the latest release tarball, and prepend it to PATH.

daler commented

Thanks for reporting. Does the fix in #281 work for you?

daler commented

Please re-open if this is still an issue.