mossmatters / HybPiper

Recovering genes from targeted sequence capture data
GNU General Public License v3.0
109 stars 45 forks source link

distribute_reads_to_targets_bwa.py error #56

Open markusruhsam opened 4 years ago

markusruhsam commented 4 years ago

I am running the reads_first.py script without problems until it hits the distribute_reads_to_targets_bwa.py script which results in this error File "/home/mruhsam/HybPiper/HybPiper_master/distribute_reads_to_targets_bwa.py", line 4, in <module> from Bio import SeqIO ImportError: No module named Bio However, Biopython is installed as mruhsam@tobyg1:~/HybPiper/HybPiper_master$ python Python 3.6.9 (default, Jul 17 2020, 12:50:27) [GCC 8.4.0] on linux and >>> import Bio does not result in any error meassages.

Any ideas what the problem might be?

mossmatters commented 4 years ago

The distribute_reads_to_targets_bwa.py script is being called from the reads_first.py script as:

time python distribute_reads_to_targets_bwa.py ...

Errors like this suggest that there is an issue with either the $PATH or the $PYTHONPATH environmental variables. It can sometimes happen when you have multiple versions of python installed, or if you have used a package manager (like pip or conda) to install packages using a different version of python. It can also happen on computer clusters where the $PATH is slightly different depending on whether something is run interactively, or is submitted as part of a cluster job.

You can check that you are using your expected version of Python with: which python

At a Python prompt, you can do the following to verify that the same version of python is being run via system commands:

>>> import os
>>> os.system("which python")

Let me know if any of those start to reveal the problem!

markusruhsam commented 4 years ago

which python gives me /usr/bin/python and >>> import os followed by >>> os.system("which python") shows /usr/bin/python 0 which I suppose tells me that the same version of python is used via system commands. I have also added the alias alias python=python3 to the .bashrc file but still get the same 'no module named Bio' error. To get round this I have now replaced 'python' with 'python3' in reads_first.py and the script is running.

However, there's a different error coming up later when running spades_runner.py

image

Any ideas how to solve this one?

YanTingNiu commented 3 years ago

The distribute_reads_to_targets_bwa.py script is being called from the reads_first.py script as:

time python distribute_reads_to_targets_bwa.py ...

Errors like this suggest that there is an issue with either the $PATH or the $PYTHONPATH environmental variables. It can sometimes happen when you have multiple versions of python installed, or if you have used a package manager (like pip or conda) to install packages using a different version of python. It can also happen on computer clusters where the $PATH is slightly different depending on whether something is run interactively, or is submitted as part of a cluster job.

You can check that you are using your expected version of Python with: which python

At a Python prompt, you can do the following to verify that the same version of python is being run via system commands:

>>> import os
>>> os.system("which python")

Let me know if any of those start to reveal the problem!

I have checked the python version it was Python 2.7.16

import os os.system("which python") /bulid/bin/python

it still shows : from Bio import SeqIO ImportError: No module named Bio

k7sosa commented 3 years ago

I'm having a related problem, in that HybPiper is calling Python 2 instead of 3 even though I changed the shebang to python 3 as such: #!/usr/bin/env python3

I am getting the following error when I try to run the tutorial:

Traceback (most recent call last):
  File "/Users/ks378/HybPiper/distribute_reads_to_targets_bwa.py", line 4, in <module>
    from Bio import SeqIO
ImportError: No module named Bio

real    0m0.265s
user    0m0.030s
sys 0m0.088s
ERROR: Something went wrong with distributing reads to gene directories.

If I start python on its own I can run all lines of code in distrubute_reads just fine (aka I don't get the 'No module named Bio' error, so I'm at loss as to how to work around this. Any ideas are much appreciated!