SegataLab / viromeqc

ViromeQC is a computational tool to benchmark and quantify non-viral contamination in VLP-enrihed viromes. ViromeQC provides an enrichment score for each virome. The score is calculated with respect to the expected prokaryotic markers abundances in reference metagenomes
MIT License
15 stars 1 forks source link

biopython error #4

Open mdtorohernando opened 1 year ago

mdtorohernando commented 1 year ago

Dear developers, I've downloaded viromeqc but I have some problems when running. I created a conda environment for it with python3.8, and I installed pandas and biopython, but after this, the following error occurs:

(viromeqc) pgen@pgen:~/sw/viromeqc$ python3.8 ./viromeQC.py Failed in importing Biopython. Please check Biopython is installed properly on your system! [ - FAIL - ]

when I try to reinstall biopython it seems to be properly installed:

(viromeqc) pgen@pgen:~/sw/viromeqc$ pip install biopython Requirement already satisfied: biopython in /home/pgen/miniconda3/envs/viromeqc/lib/python3.8/site-packages (1.79) Requirement already satisfied: numpy in /home/pgen/miniconda3/envs/viromeqc/lib/python3.8/site-packages (from biopython) (1.23.2)

Any help will be great!

azufre451 commented 1 year ago

Hi @mdtorohernando, thank you for reporting this.

I tried to run viromeqc in a newly created conda env but it works fine. Could you try to:

Also, could you report which versions of each package are you using in your environment with conda list -n viromeqc ?

Thanks!

mdtorohernando commented 1 year ago

Thank you very much for your quick response! I've tried opening python but it does not work. Packages are:

packages in environment at /home/pgen/miniconda3/envs/viromeqc:

#

Name Version Build Channel

_libgcc_mutex 0.1 conda_forge conda-forge _openmp_mutex 4.5 2_gnu conda-forge biopython 1.79 pypi_0 pypi bzip2 1.0.8 h7f98852_4 conda-forge ca-certificates 2022.07.19 h06a4308_0
ld_impl_linux-64 2.38 h1181459_1
libffi 3.4.2 h7f98852_5 conda-forge libgcc-ng 12.1.0 h8d9b700_16 conda-forge libgomp 12.1.0 h8d9b700_16 conda-forge libnsl 2.0.0 h7f98852_0 conda-forge libsqlite 3.39.2 h753d276_1 conda-forge libuuid 2.32.1 h7f98852_1000 conda-forge libzlib 1.2.12 h166bdaf_2 conda-forge ncurses 6.3 h27087fc_1 conda-forge numpy 1.23.2 pypi_0 pypi openssl 3.0.5 h166bdaf_1 conda-forge pandas 1.4.3 pypi_0 pypi pip 22.2.2 pyhd8ed1ab_0 conda-forge python 3.8.13 ha86cf86_0_cpython conda-forge python-dateutil 2.8.2 pypi_0 pypi python_abi 3.8 2_cp38 conda-forge pytz 2022.2.1 pypi_0 pypi readline 8.1.2 h0f457ee_0 conda-forge setuptools 65.2.0 py38h578d9bd_0 conda-forge six 1.16.0 pypi_0 pypi sqlite 3.39.2 h4ff8645_1 conda-forge tk 8.6.12 h27826a3_0 conda-forge wheel 0.37.1 pyhd8ed1ab_0 conda-forge xz 5.2.6 h166bdaf_0 conda-forge

mdtorohernando commented 1 year ago

I tried to create another environment for python3.6 (recommended at the README file) called "prueba" but the error is the same:

(prueba) pgen@pgen:~/sw/viromeqc$ python3.6 ./viromeQC.py 
Failed in importing Biopython. Please check Biopython is
installed properly on your system!                                [ -  FAIL - ]

The list of the packages in this environment is as follows (now biopython is also in version 1.79 but installed through conda-forge)

(prueba) pgen@pgen:~/sw/viromeqc$ conda list -n prueba
# packages in environment at /home/pgen/miniconda3/envs/prueba:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       2_gnu    conda-forge
biopython                 1.79             py36h8f6f2f9_0    conda-forge
boost-cpp                 1.74.0               h75c5d50_8    conda-forge
bzip2                     1.0.8                h7f98852_4    conda-forge
ca-certificates           2022.07.19           h06a4308_0  
certifi                   2020.6.20          pyhd3eb1b0_3  
diamond                   2.0.15               hb97b32f_1    bioconda
icu                       70.1                 h27087fc_0    conda-forge
ld_impl_linux-64          2.38                 h1181459_1  
libblas                   3.9.0           16_linux64_openblas    conda-forge
libcblas                  3.9.0           16_linux64_openblas    conda-forge
libffi                    3.4.2                h7f98852_5    conda-forge
libgcc-ng                 12.1.0              h8d9b700_16    conda-forge
libgfortran-ng            12.1.0              h69a702a_16    conda-forge
libgfortran5              12.1.0              hdcd56e2_16    conda-forge
libgomp                   12.1.0              h8d9b700_16    conda-forge
liblapack                 3.9.0           16_linux64_openblas    conda-forge
libnsl                    2.0.0                h7f98852_0    conda-forge
libopenblas               0.3.21          pthreads_h78a6416_2    conda-forge
libsqlite                 3.39.2               h753d276_1    conda-forge
libstdcxx-ng              12.1.0              ha89aaad_16    conda-forge
libzlib                   1.2.12               h166bdaf_2    conda-forge
ncurses                   6.3                  h27087fc_1    conda-forge
numpy                     1.19.5           py36hfc0c790_2    conda-forge
openssl                   1.1.1q               h166bdaf_0    conda-forge
pandas                    1.1.5            py36h284efc9_0    conda-forge
pip                       21.2.4             pyhd8ed1ab_0    conda-forge
python                    3.6.15          hb7a2778_0_cpython    conda-forge
python-dateutil           2.8.2              pyhd8ed1ab_0    conda-forge
python_abi                3.6                     2_cp36m    conda-forge
pytz                      2022.2.1           pyhd8ed1ab_0    conda-forge
readline                  8.1.2                h0f457ee_0    conda-forge
setuptools                49.6.0           py36h5fab9bb_3    conda-forge
six                       1.16.0             pyh6c4a22f_0    conda-forge
sqlite                    3.39.2               h4ff8645_1    conda-forge
tk                        8.6.12               h27826a3_0    conda-forge
wheel                     0.37.1             pyhd8ed1ab_0    conda-forge
xz                        5.2.6                h166bdaf_0    conda-forge
zlib                      1.2.12               h166bdaf_2    conda-forge
zstd                      1.5.2                h6239696_4    conda-forge

Sorry for all these inconveniences...

azufre451 commented 1 year ago

Hi mdtorohernando,

It seems your conda env has biopython correctly installed. Does this code give you any error?

conda activate prueba
python
from Bio import SeqIO
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
mdtorohernando commented 1 year ago

Thank you for your answer, I attached to you the output, it does not return any error

(base) pgen@pgen:~$ conda activate prueba
(prueba) pgen@pgen:~$ python
Python 3.6.15 | packaged by conda-forge | (default, Dec  3 2021, 18:49:41) 
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from Bio import SeqIO
>>> from Bio.Seq import Seq
>>> from Bio.SeqRecord import SeqRecord
>>> 
mdtorohernando commented 1 year ago

prueba

azufre451 commented 1 year ago

Hi @mdtorohernando, sorry for replying late.

I see you used python 3.6.15 in the screenshot, but you tried ViromeQC with python 3.8 in the previous example. Could you either: a) confirm that you can import Biopython from python 3.8; or b) try running viromeqc with python ./viromeQC instead of python 3.8 ./viromeQC.py or python 3.6 ./viromeQC.py?

Just to make sure you are using the same python as the one in your conda env.

Thanks!

mdtorohernando commented 1 year ago

Thank you four your answer!! a) more errors...


**(prueba) pgen@pgen:~/sw/viromeqc$ python3.8 
Python 3.8.10 (default, Jun 22 2022, 20:18:18) 
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from Bio import SeqIO
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'Bio'
>>> from Bio.Seq import Seq
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'Bio'
>>> from Bio.SeqRecord import SeqRecord
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'Bio'
>>> 
**

b) does not work...

(prueba) pgen@pgen:~/sw/viromeqc$ ./viromeQC.py 
Failed in importing Biopython. Please check Biopython is
installed properly on your system!                                [ -  FAIL - ]
azufre451 commented 1 year ago

@mdtorohernando, sorry for the long time taken to answer.

It seems an issue related to Conda packages. Probably you already tried (and a bit extreme) but, what about trying on a fresh conda installation?

Sorry again for the delay. Please let me know if you managed to fix it!

Chrisjrt commented 1 year ago

Just for anyone that stumbles across this error that was in the same boat as me. The packaged v1.0.0 of viromeQC will give the above error if using Biopython >= 1.78 as viromeQC v1.0.0 uses the Bio.Alphabet module of biopython that was removed in biopython v1.78.

The use of this module was removed in a subsequent version of viromeQC, so cloning from the repo (v1.0.2 of viromeQC at time of writing) will allow Biopython >= 1.78 to be used in your conda environment.

If you super want to use v1.0.0 of viromeQC then lower your biopython version to 1.77 and that will solve this error.

Thanks azufre451 and others for putting together this great tool!