limix / pandas-plink

PLINK reader for Python.
MIT License
78 stars 18 forks source link

ImportError: No module named 'pandas_plink.bed_reader' #6

Closed WillJStone closed 6 years ago

WillJStone commented 6 years ago

I am encountering a similar problem to one that I believe has come up in the past. I am using python 3.5.2 and pandas_plink 1.2.25, which was installed with pip.

I have tried this in a clean virtualenv

The full error message:

$ python -c "import pandas_plink; pandas_plink.test()"
=============================================== test session starts ================================================
platform linux -- Python 3.5.2, pytest-3.4.2, py-1.5.2, pluggy-0.6.0
rootdir: /home/user/analysis, inifile:
plugins: pep8-1.0.6
collected 10 items                                                                                                 

pandas_plink/__init__.py .                                                                                   [ 10%]
pandas_plink/bed_read.py .                                                                                   [ 20%]
pandas_plink/builder.py .                                                                                    [ 30%]
pandas_plink/conftest.py .                                                                                   [ 40%]
pandas_plink/read.py .F

===================================================== FAILURES =====================================================
______________________________________ [doctest] pandas_plink.read.read_plink ______________________________________
056         1     1   rs2949420  0.0  45257  C  T  1
057         2     1   rs2949421  0.0  45413  0  0  2
058         3     1   rs2691310  0.0  46844  A  T  3
059         4     1   rs4030303  0.0  72434  0  G  4
060         >>> print(fam.head()) #doctest: +NORMALIZE_WHITESPACE
061                 fid       iid    father    mother gender trait  i
062         0  Sample_1  Sample_1         0         0      1    -9  0
063         1  Sample_2  Sample_2         0         0      2    -9  1
064         2  Sample_3  Sample_3  Sample_1  Sample_2      2    -9  2
065         >>> print(bed.compute()) #doctest: +NORMALIZE_WHITESPACE
UNEXPECTED EXCEPTION: ImportError("No module named 'pandas_plink.bed_reader'",)
Traceback (most recent call last):

  File "/usr/lib/python3.5/doctest.py", line 1321, in __run
    compileflags, 1), test.globs)

  File "<doctest pandas_plink.read.read_plink[5]>", line 1, in <module>

  File "/home/user/bio/lib/python3.5/site-packages/dask/base.py", line 143, in compute
    (result,) = compute(self, traverse=False, **kwargs)

  File "/home/user/bio/lib/python3.5/site-packages/dask/base.py", line 392, in compute
    results = get(dsk, keys, **kwargs)

  File "/home/user/bio/lib/python3.5/site-packages/dask/threaded.py", line 75, in get
    pack_exception=pack_exception, **kwargs)

  File "/home/user/bio/lib/python3.5/site-packages/dask/local.py", line 521, in get_async
    raise_exception(exc, tb)

  File "/home/user/bio/lib/python3.5/site-packages/dask/compatibility.py", line 67, in reraise
    raise exc

  File "/home/user/bio/lib/python3.5/site-packages/dask/local.py", line 290, in execute_task
    result = _execute_task(task, data)

  File "/home/user/bio/lib/python3.5/site-packages/dask/local.py", line 271, in _execute_task
    return func(*args2)

  File "/home/userl/bio/lib/python3.5/site-packages/pandas_plink/bed_read.py", line 6, in read_bed_chunk
    from .bed_reader import ffi, lib

ImportError: No module named 'pandas_plink.bed_reader'

/home/user/bio/lib/python3.5/site-packages/pandas_plink/read.py:65: UnexpectedException
======================================== 1 failed, 5 passed in 0.14 seconds ========================================

Thanks in advance for any help you may be able to provide

horta commented 6 years ago

Hi @WillJStone , I just installed pandas-plink using pip in a Linux distribution having python 3.5 and it worked. I wonder if you saw any problem during the pip installation? It looks like the Python sources have been installed but the C extension has not been compiled.

horta commented 6 years ago

Also, pip install --upgrade pip setuptools might also help.

WillJStone commented 6 years ago

I have successfully installed it on one of my machines, but it is still not working on the machine it needs to be on. There does not seem to be any issues when it installs, but at this point I figure it's a problem with the state of the machine itself. Thanks for the quick response!

horta commented 6 years ago

Glad you've solved the problem =)