ProDy icon indicating copy to clipboard operation
ProDy copied to clipboard

fail to import prody

Open nongbaoting opened this issue 2 years ago • 7 comments

Python 3.9.12 | packaged by conda-forge | (main, Mar 24 2022, 23:22:55) 
[GCC 10.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import prody
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/dat1/nbt2/miniconda3/envs/structure/lib/python3.9/site-packages/prody/__init__.py", line 66, in <module>
    from . import utilities
  File "/dat1/nbt2/miniconda3/envs/structure/lib/python3.9/site-packages/prody/utilities/__init__.py", line 74, in <module>
    from .TreeConstruction import *
  File "/dat1/nbt2/miniconda3/envs/structure/lib/python3.9/site-packages/prody/utilities/TreeConstruction.py", line 18, in <module>
    from Bio.Phylo.TreeConstruction import _DistanceMatrix as DistanceMatrix
  File "/dat1/nbt2/miniconda3/envs/structure/lib/python3.9/site-packages/Bio/Phylo/TreeConstruction.py", line 360, in <module>
    class DistanceCalculator:
  File "/dat1/nbt2/miniconda3/envs/structure/lib/python3.9/site-packages/Bio/Phylo/TreeConstruction.py", line 433, in DistanceCalculator
    matrix = substitution_matrices.load(name)
  File "/dat1/nbt2/miniconda3/envs/structure/lib/python3.9/site-packages/Bio/Align/substitution_matrices/__init__.py", line 513, in load
    matrix = read(path)
  File "/dat1/nbt2/miniconda3/envs/structure/lib/python3.9/site-packages/Bio/Align/substitution_matrices/__init__.py", line 495, in read
    matrix[letter1, letter2] = float(word)
ValueError: could not convert string to float: 'A'
>>> 

nongbaoting avatar May 11 '22 12:05 nongbaoting

This seems to be a problem with biopython. What version are you using? Can you go down to an earlier version?

I'd also suggest raising this issue with the biopython team at https://github.com/biopython/biopython/issues. They may even have it already. It doesn't look like it but it could be good to double check.

jamesmkrieger avatar May 11 '22 13:05 jamesmkrieger

Thanks for your advice, I lowered biopython version to 1.76 and then it just works. by the way, The origin biopython version is 1.79.

nongbaoting avatar May 11 '22 13:05 nongbaoting

ok. It looks like we set that requirement for python 2.7 but not for python 3. I've updated it at #1547 and then we shouldn't have any problems. Thanks.

jamesmkrieger avatar May 11 '22 14:05 jamesmkrieger

Hi, apologies for reopening this issue.

Do we know if the biopython>1.76 incompatibility was ever resolved? I am working with libraries that depend on 1.79.

It works fine for me locally if I forcibly ignore the requirement from prody,

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.
>>> import Bio
>>> Bio.__version__
'1.79'
>>> import prody
>>> prody.__version__
'2.2.0'

but I need biopython<=1.76 removed for CI and deployment.

Thanks.

fcomitani avatar Aug 24 '22 16:08 fcomitani

I don’t think we ever did. I can check next week probably

jamesmkrieger avatar Aug 24 '22 20:08 jamesmkrieger

Hi, I just wanted to check if there was any progress on this. Thank you!

fcomitani avatar Sep 12 '22 15:09 fcomitani

No, no progress. Sorry

Have you run the prody tests with biopython 1.79 installed?

It could well be that everything is fine by now and this requirement can be removed, but I really don't know.

jamesmkrieger avatar Sep 12 '22 16:09 jamesmkrieger

Hi! I have run into the same issues as @fcomitani with the necessity of newer versions of biopython incompatible with prody.

The biopython restriction makes sense for older pythons due to support limitations. It should answer this.

Version 1.76 is the last release to support Python 2.7 and 3.5, all later releases require Python 3.6 or greater

But for python 3.6+ the more recent biopython packages available should work flawlessly with prody. I ran the CI tests after removing the restrictions and everything seems fine.

I suggest to just revert the biopython restrictions for python 3.

boneta avatar Oct 14 '22 17:10 boneta

Ok. We can probably remove support and CI for python 3.5 as basically no one uses it anyway. Thanks very much

jamesmkrieger avatar Oct 14 '22 21:10 jamesmkrieger

Hi, apologies I forgot to follow through. I ended up downgrading to v2.1.0 for my project, but support for future versions would be great. Thanks both for the help!

fcomitani avatar Oct 14 '22 22:10 fcomitani

It still would be good to know what caused the original import error but the fact that so many people failed to reproduce it is reassuring

jamesmkrieger avatar Oct 15 '22 08:10 jamesmkrieger

I have now made a pull request that should address this (#1595). Thanks to all of you for the feedback

Hi! I have run into the same issues as @fcomitani with the necessity of newer versions of biopython incompatible with prody.

The biopython restriction makes sense for older pythons due to support limitations. It should answer this.

Version 1.76 is the last release to support Python 2.7 and 3.5, all later releases require Python 3.6 or greater

But for python 3.6+ the more recent biopython packages available should work flawlessly with prody. I ran the CI tests after removing the restrictions and everything seems fine.

I suggest to just revert the biopython restrictions for python 3.

jamesmkrieger avatar Oct 15 '22 09:10 jamesmkrieger

I now found that Biopython 1.76 doesn't even install with Python 3.11

I am currently running tests on ProDy installed in a Python 3.11 environment with Biopython 1.77 and will try others after that

jamesmkrieger avatar Nov 15 '22 13:11 jamesmkrieger

I think we also need to delete or modify pyproject.toml and that forced Biopython 1.76 still. Does anyone have any views on that?

jamesmkrieger avatar Nov 15 '22 13:11 jamesmkrieger

ok, 1.76, 1.77, 1.78 and 1.79 all pass the tests. The GitHub Actions continuous integration tests are also using 1.79

jamesmkrieger avatar Nov 15 '22 13:11 jamesmkrieger

and the installation works fine on Windows and Ubuntu without pyproject.toml and it was added fairly recently so I guess removing it is fine and I have done it in #1616

jamesmkrieger avatar Nov 15 '22 14:11 jamesmkrieger