asteca / ASteCA

Code for the ASteCA package.
http://asteca.github.io/
MIT License
18 stars 6 forks source link

Collections deprecated on Python 3.10 #547

Closed notluquis closed 8 months ago

notluquis commented 2 years ago

Hi,

due to the deprecation of Collections on Python 3.10, ASTECA won't compile on the first run.

Here is the error.

ImportError: cannot import name 'Iterable' from 'collections' (/Users/notluquis/opt/anaconda3/envs/spyder-env/lib/python3.10/collections/__init__.py)

Iterable can be imported from collections.abc, but the other modules won't. (at least on my try of change the code)

Gabriel-p commented 2 years ago

Hi, yes I see that was moved in v3.10. Have you tried editing the file ASteCA/packages/aux_funcs.py which is where the import is done? If so, what is the full error that you get?

A perhaps simpler solution would be to just set up a conda environment with Python 3.9 as described here: https://asteca.readthedocs.io/en/latest/install.html

notluquis commented 2 years ago

Yep, editing the file ASteCA/packages/aux_funcs.py is the solution.

I only change the line from collections import defaultdict, Iterable to

from collections import defaultdict
from collections.abc import Iterable

In Python 3.9.12 ASteCA also works with the modification.

Gabriel-p commented 2 years ago

Great! I'll fix this in the next release of the code, thank you for opening the issue!

Gabriel-p commented 2 years ago

Re-opening so I don't forget about it :)