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 'Sequence' from 'collections' #895

Closed
weissmanuel opened this issue Sep 26, 2022 · 5 comments
Closed

ImportError: cannot import name 'Sequence' from 'collections' #895

weissmanuel opened this issue Sep 26, 2022 · 5 comments

Comments

@weissmanuel
Copy link

Got the following error when using skorch.helper.predefined_split with Python 3.10

ImportError: cannot import name 'Sequence' from 'collections'

Using Python 3.9 worked as workaround but would nice if skorch would also work for Python 3.10.

@BenjaminBossan
Copy link
Collaborator

Hmm, this works for me:

python3.10 -c "from collections.abc import Sequence"

Same for

python3.9 -c "from collections.abc import Sequence"

Any idea what the issue could be?

Officially, we don't have 3.10 support yet because for a long time, there was an issue with underlying libraries, but now everything should work. We'll add 3.10 to our CI soon and then check if this issue or similar issues appear.

@BenjaminBossan
Copy link
Collaborator

@weissmanuel any updates?

@dliu-fn
Copy link

dliu-fn commented Oct 7, 2022

I'm encountering the exact same issue as @weissmanuel, but I checked:

  • Python == 3.10
  • skorch == 0.11.0
  • pytorch == 1.12.1+cu102
  • python3.10 -c "from collections.abc import Sequence" worked for me

And I'm confused, because I see that it's correct in the repo: https://github.com/skorch-dev/skorch/blob/master/skorch/helper.py#L6

and yet, for some reason my virtual environment is using a much older version of skorch, somehow.

@dliu-fn
Copy link

dliu-fn commented Oct 7, 2022

Ohhhh this was only merged into a release recently on the 0.12.0
release, so 0.11.0was insufficient.

@weissmanuel We seem to have the same anticipation as the person here: #872

Try using 0.12.0 and the bug should be resolved.

@BenjaminBossan
Copy link
Collaborator

Thanks for @dliu-fn for figuring this out, sorry that I forgot about it. I think we can close the issue now :)

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

3 participants