khyox / recentrifuge

Recentrifuge: robust comparative analysis and contamination removal for metagenomics
http://www.recentrifuge.org
Other
86 stars 7 forks source link

ImportError: cannot import name 'SequentialSequenceWriter' from 'Bio.SeqIO.Interfaces' #49

Closed pimarin closed 11 months ago

pimarin commented 1 year ago

Hello,

I failed to use recentrifuge using conda after installation. Failed for :

This error :

rcf --help
Traceback (most recent call last):
  File "/home/pierre/miniconda3/envs/rcf/bin/rcf", line 33, in <module>
    from recentrifuge import __version__, __author__, __date__
  File "/home/pierre/miniconda3/envs/rcf/lib/python3.8/site-packages/recentrifuge/__init__.py", line 41, in <module>
    from . import lmat_io  # LMAT support
  File "/home/pierre/miniconda3/envs/rcf/lib/python3.8/site-packages/recentrifuge/lmat_io.py", line 11, in <module>
    from Bio.SeqIO.Interfaces import SequentialSequenceWriter
ImportError: cannot import name 'SequentialSequenceWriter' from 'Bio.SeqIO.Interfaces' (/home/pierre/miniconda3/envs/rcf/lib/python3.8/site-packages/Bio/SeqIO/Interfaces.py)
khyox commented 1 year ago

Hello @pimarin and thank you very much for reporting this bug! This seems an issue with SequentialSequenceWriter being deprecated in biopython from version 1.80 and beyond. Thanks!

khyox commented 1 year ago

I found that this is a bioconda problem, not a Recentrifuge's one, as the conda recipe is not updated with the proper versions for the dependencies. I have issued a PR to try to correct and update the bioconda recipe for Recentrifuge, but I am not the maintainer of the recipe nor a bioconda dev, so I don't know if I will be successful. If I am not, @pimarin, feel free to open this issue against bioconda. Thanks.

khyox commented 1 year ago

@pimarin, my bioconda PR has been reviewed and accepted. Hopefully, it will be soon propagated and you'll have the last Recentrifuge version working properly on conda.

pimarin commented 1 year ago

Thank you @khyox, this is also to the Galaxy community to have the last rcf available version !

nbat64 commented 1 year ago

Hello, I have updated recentrifuge to version 1.12.1 (conda env), but I still have the same error message. Python in my environment is 3.9. Do we have to downgrade python to a version before 3.8? Thank you

khyox commented 1 year ago

Hi @nbat64, thanks for reporting. The problem is not with the python version, since Recentrifuge supports from python 3.6 to python 3.11 version. The issue is with the biopython package, which should be not newer than 1.79. The current bioconda recipe for 1.12.1 has the right dependencies. Please check your version of biopython. Perhaps reinstalling the Recentrifuge conda package will make conda work with the right dependencies. Let me know if that solves the problem.

nbat64 commented 1 year ago

Hi @khyox Thanks for your response. I was able to make it work by creating a new env only for recentrifuge. My main env have biopython 1.79 but rcf 1.12.1 failed with the SequentialSequenceWriter error message. I will check version of deoendencies.

koppk commented 10 months ago

pip install biopython==1.78 did the trick for me

khyox commented 10 months ago

It's weird that biopython 1.79 fails: both the manual and automated tests are using that version of biopython and are all OK. Also, the problem in the conda recipe should be solved by now —unless it's an old conda env before this problem was addressed.