Skip to content
This repository has been archived by the owner on Nov 10, 2023. It is now read-only.

Python 3.10: third-party python modules need update (setuptools: No module named 'symbol', pex: cannot import name 'iterable' from 'collections') #2678

Closed
rpuntaie opened this issue Jan 29, 2022 · 10 comments · Fixed by #2697

Comments

@rpuntaie
Copy link

I just wanted to install Buck on Archlinux and got the mentioned error.
See also https://stackoverflow.com/questions/70836444/no-module-named-symbol

Buck has its own setuptools and would need to do without "symbol" to support systems with Python 3.10:

@aadsm
Copy link

aadsm commented Feb 9, 2022

This pr might fix it, I didn't actually tried it though, I only read the code: 1e57b5c

@rpuntaie rpuntaie changed the title Python 3.10: No module named 'symbol' Python 3.10: third-party python modules need update (setuptools: No module named 'symbol', pex: cannot import name 'iterable' from 'collections') Feb 10, 2022
@rpuntaie
Copy link
Author

rpuntaie commented Feb 10, 2022

It fixes "No module named 'symbol'", but then

third-party/py/pex/pex/base.py", line 6
ImportError: cannot import name 'Iterable' from 'collections'

I made the title a bit more general.

@bigfootjon
Copy link
Member

I think the real solution might be to upgrade the vendored PEX dep

@jc65536
Copy link

jc65536 commented Feb 10, 2022

It fixes "No module named 'symbol'", but then

third-party/py/pex/pex/base.py", line 6
ImportError: cannot import name 'Iterable' from 'collections'

I made the title a bit more general.

Could be related to this issue: Azure/azure-cli#20444 (comment)

@bigfootjon
Copy link
Member

bigfootjon commented Feb 10, 2022

It fixes "No module named 'symbol'", but then

third-party/py/pex/pex/base.py", line 6
ImportError: cannot import name 'Iterable' from 'collections'

I made the title a bit more general.

Could be related to this issue: Azure/azure-cli#20444 (comment)

I believe collections no longer exports Iterable in Python3.10, it is now exported from collections.abc

Ref: https://docs.python.org/3/whatsnew/3.10.html which says:

Remove deprecated aliases to Collections Abstract Base Classes from the collections module. (Contributed by Victor Stinner in bpo-37324.)

@aadsm
Copy link

aadsm commented Feb 10, 2022

I believe collections no longer exports Iterable in Python3.10, it is now exported from collections.abc

Exactly. I believe that's what @jc65536 was referring to in his comment, where a solution is provided by importing the Iterable from collections.abc instead.

@aadsm
Copy link

aadsm commented Feb 10, 2022

I think the real solution might be to upgrade the vendored PEX dep

Absolutely, is this something you're planning to work on? If yes, then I'll just cancel my PR, otherwise we can ship this one to unblock people using python 3.10.

@bigfootjon
Copy link
Member

Absolutely, is this something you're planning to work on?

I unfortunately don't have a good way to build Buck manually right now in my spare time and I have higher priority things when I'm at work. I want to help fix this but I just don't have the bandwidth :(

I'm happy to review the PR though, unless someone from the Buck team is monitoring this problem.

(I do work at Meta but I don't work anywhere near Buck, I just use Buck in a hobby project)

@bigfootjon
Copy link
Member

I went ahead and just patched the import collections and import symbols lines. Upgrading PEX is what should happen, but I don't have the expertise to do so.

@bigfootjon
Copy link
Member

@lisroach added support, and I ported this to the OSS version. This should be available in the next weekly release

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
4 participants