Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: Update collections to collections.abc for Python 3.10 Compatibility #89

Open
Amr-00 opened this issue Sep 11, 2024 · 0 comments

Comments

@Amr-00
Copy link

Amr-00 commented Sep 11, 2024

Summary
pylogit encounters an ImportError in Python 3.10 because the Iterable class has been moved from collections to collections.abc.

Error Details
When running pylogit in Python 3.10, the following error is raised:
image

Cause
The error is caused by the following line in choice_tools.py:
from collections import Iterable

In Python 3.10, Iterable is now located in collections.abc, resulting in the ImportError.

Proposed Solution
To fix this issue and ensure compatibility with Python 3.10 and later versions, the import statement should be updated in choice_tools.py:

Update this line
from collections import Iterable

To this line
from collections.abc import Iterable

Testing
After making this change locally, pylogit works correctly without any ImportError in Python 3.10.

Request
Please update the import statement to (from collections.abc import Iterable) in the relevant files for Python 3.10 compatibility.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant