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: cannot import name 'Iterator' from 'collections' #62

Closed
sophialeeman opened this issue Jun 2, 2022 · 3 comments · Fixed by #66
Closed

ImportError: cannot import name 'Iterator' from 'collections' #62

sophialeeman opened this issue Jun 2, 2022 · 3 comments · Fixed by #66

Comments

@sophialeeman
Copy link

When I run
python /Users/sophialeeman/opt/anaconda3/envs/e3fp/e3fp/conformer/generate.py -s caffeine.smi --num_conf 3 -o ./

I receive the following output:
2022-06-02 09:18:27,522|INFO|num_proc is not specified. 'processes' mode will use all 8 processes
2022-06-02 09:18:27,522|INFO|Parallelizer initialized with mode 'processes' and 8 processors.
2022-06-02 09:18:27,522|INFO|Input type: Detected SMILES file(s)
2022-06-02 09:18:27,522|INFO|Input file number: 1
Traceback (most recent call last):
File "/Users/sophialeeman/opt/anaconda3/envs/e3fp/e3fp/conformer/generate.py", line 601, in
run(**kwargs)
File "/Users/sophialeeman/opt/anaconda3/envs/e3fp/e3fp/conformer/generate.py", line 363, in run
data_iterator = make_data_iterator(
File "/Users/sophialeeman/opt/anaconda3/envs/e3fp_env/lib/python3.10/site-packages/python_utilities/parallel.py", line 66, in make_data_iterator
from collections import Iterator
ImportError: cannot import name 'Iterator' from 'collections' (/Users/sophialeeman/opt/anaconda3/envs/e3fp_env/lib/python3.10/collections/init.py)

Upon further research into this, I've found that others sometimes struggle with Iterator in python 3.10. Are there dependencies in this program that prevent me from using 3.10?

@sethaxen
Copy link
Collaborator

sethaxen commented Jun 2, 2022

Thanks! Indeed it seems we were using aliases that were deprecated in Python 3.3 and are now removed in Python 3.10 (python/cpython#81505). Should be an easy fix.

@sethaxen
Copy link
Collaborator

sethaxen commented Jun 3, 2022

@sophialeeman the issue was that one of our dependencies had not updated for Python 3.10. It has now been updated on pypi and anaconda, so any of the following should work:

If you installed e3fp using conda:

conda update sdaxen_python_utilities

If you installed e3fp using pip (either from pypi or from the master branch of this repo)

pip install --upgrade sdaxen_python_utilities

@sophialeeman
Copy link
Author

Thank you so much, Seth!

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

Successfully merging a pull request may close this issue.

2 participants