Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

contrib files imported automatically, some require numpy and pandas which are not listed as dependencies in setup.py #171

Closed
jmanning2k opened this issue May 18, 2016 · 2 comments

Comments

@jmanning2k
Copy link

When installing pybedtools 0.7.7 in a clean python virtualenv or newly installed system, eg:

mkvirtualenv testpybedtools
pip install pybedtools

Installs just six, pysam, and pybedtools. (Currently: pybedtools-0.7.7 pysam-0.9.0 six-1.10.0)

Trying to import pybedtools after that results in an error.

$python -c 'import pybedtools'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File ".../python2.7/site-packages/pybedtools/__init__.py", line 12, in <module>
    from . import contrib
  File ".../python2.7/site-packages/pybedtools/contrib/__init__.py", line 4, in <module>
    from . import long_range_interaction
  File ".../python2.7/site-packages/pybedtools/contrib/long_range_interaction.py", line 7, in <module>
    import numpy as np
ImportError: No module named numpy

Current workaround is to also install numpy and pandas (which is also referenced in contrib, and becomes another ImportError after installing numpy).

numpy and pandas have lengthy builds from source, and are not otherwise necessary to use pybedtools. I would prefer to not have them as dependencies for my project, but I do want to use pybedtools.

Can pybedtools be tweaked to avoid importing contrib files? I think stuff in contrib should only be loaded if imported explicitly. They seem to be there mostly to serve as examples, not as part of the library.

@daler
Copy link
Owner

daler commented May 18, 2016

That's a good idea, I will fix that.

In the meantime, have you tried bioconda?

conda create -n testpybedtools -c bioconda pybedtools numpy pandas

@daler
Copy link
Owner

daler commented Nov 23, 2018

This was addressed in previous release; functions in the contrib module using pandas/matplotlib now do conditional imports within the function at runtime.

@daler daler closed this as completed Nov 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants