debbiemarkslab / EVcouplings

Evolutionary couplings from protein and RNA sequence alignments
http://evcouplings.org
Other
232 stars 75 forks source link

EVcouplings not compatible with Python 3.10 version #275

Closed kpgbrock closed 2 years ago

kpgbrock commented 2 years ago

After creating a clean environment with develop branch and python 3.10, I got the following error when trying to run evcouplings:

from evcouplings.utils.app import app from collections import Mapping

ImportError: cannot import name 'Mapping' from 'collections' ImportError: cannot import name 'Mapping' from 'collections' (/n/groups/marks/software/anaconda_o2/envs/evcouplings_22/lib/python3.10/collections/init.py)

This error disappears when using python 3.9, and I confirmed it's caused by a change in how Mapping is called (see below). To make evcouplings forward compatible, can we replace the import statement with the below?

try: from collections.abc import Mapping except ImportError: from collections import Mapping

samberry19 commented 2 years ago

I was just trying to install the latest version of EVcouplings in a new environment (Python 3.10.4) on my computer and I had to change "from collections import Iterable" to "from collections.abc import Iterable" in a number of the scripts in order to get it to work: couplings/mapping.py, couplings/model.py, and align/protocol.py.

loodvn commented 2 years ago

Fixed those in my calc_weights branch, which I'll hopefully merge soon. Collections.iterable and mapping have been in collections.abc since 3.3 actually, and since the EVCouplings repo has a lower dependency of python 3.5 this change should be harmless :)

thomashopf commented 2 years ago

Thanks - any PRs addressing these code rot issues are highly welcome