While using iNltk package i ran into this error
ImportError: cannot import name 'Iterable' from 'collections' (C:\Program Files\Python311\Lib\collections\__init__.py)
I was trying to setup the hindi language
from inltk.inltk import setup
setup('hi')
I was getting this error because the
Iterableabstract class was removed from thecollectionsmodule in Python 3.10. Theinltkpackage is still using the old version of thecollectionsmodule, which is why you are getting the error.There are a few ways to fix this error. One way is to upgrade the
inltkpackage to a version that is compatible with Python 3.10. Another way is to manuallyimport the Iterable classfrom thecollections.abcmodule.Or you can make changes in the core file by manually importing the
Iterableclass. This method is temporary but will save your day.note: recommended to make this changes if you are using venv(virtual env)
At path
..file_path..\venv\Lib\site-packages\fastai\imports\core.pymake the above changes.
This will import the Iterable class from the collections.abc module, which will allow you to use the inltk package without getting the error.
Another way to fix this error is to downgrade your Python installation to Python 3.9. However, this is not always an option, as some software may not be compatible with Python 3.9.