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

Unable to import 'collections.abc' using python 3.13.1 #10112

Closed
Christian-B opened this issue Dec 6, 2024 · 20 comments · Fixed by pylint-dev/astroid#2647, pylint-dev/astroid#2665 or #10125
Labels
Bug 🪲 High priority Issue with more than 10 reactions
Milestone

Comments

@Christian-B
Copy link

Christian-B commented Dec 6, 2024

Bug description

import collections.abc

Configuration

Command used

We use a complex github actions but notice the change when python updated to 3.13.1
using pylint-3.3.2

Pylint output

************* Module spinn_utilities.checker
spinn_utilities/checker.py:1:0: C0304: Final newline missing (missing-final-newline)
spinn_utilities/checker.py:1:0: E0401: Unable to import 'collections.abc' (import-error)
spinn_utilities/checker.py:1:0: W0611: Unused import collections.abc (unused-import)

Expected behavior

Not seeing the Unable to import 'collections.abc' (import-error)

Other messages are due to the tiny example

likely due to
python/cpython@d46d291

Pylint version

Python 3.13.1

Did not happen with 
Python 3.13.0

OS / Environment

tested with github actions using
Ubuntu
22.04.5
LTS

Additional dependencies

@jacobtylerwalls
Copy link
Member

Thanks, we'll jump on this 👍

@jacobtylerwalls jacobtylerwalls added Bug 🪲 High priority Issue with more than 10 reactions and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Dec 7, 2024
@jacobtylerwalls
Copy link
Member

Reopening to keep visibility until we bump astroid later today.

@jacobtylerwalls
Copy link
Member

Polling other contributors, can anyone reproduce this locally? @zenlyj @mbyrnepr2

@mbyrnepr2
Copy link
Member

LGTM @jacobtylerwalls

(venv3131) markbyrne@Marks-MacBook-Air-2 programming % python -m pylint --version
pylint 4.0.0-dev0
astroid 3.3.6
Python 3.13.1 (v3.13.1:06714517797, Dec  3 2024, 14:00:22) [Clang 15.0.0 (clang-1500.3.9.4)]
(venv3131) markbyrne@Marks-MacBook-Air-2 programming % cat x.py
import collections.abc
(venv3131) markbyrne@Marks-MacBook-Air-2 programming % python -V
Python 3.13.1
(venv3131) markbyrne@Marks-MacBook-Air-2 programming % python -m pylint x.py
************* Module x
x.py:1:0: C0114: Missing module docstring (missing-module-docstring)
x.py:1:0: W0611: Unused import collections.abc (unused-import)

------------------------------------------------------------------
Your code has been rated at 0.00/10 (previous run: 0.00/10, +0.00)

(venv3131) markbyrne@Marks-MacBook-Air-2 programming % 

@zenlyj
Copy link
Contributor

zenlyj commented Dec 9, 2024

reproducible on my end

import.py:1:0: E0401: Unable to import 'collections.abc' (import-error)
import.py:1:0: W0611: Unused import collections.abc (unused-import)

with the following:

pylint 4.0.0-dev0 (latest main)
astroid 3.3.5 & 3.3.6
Python 3.13.1

@jacobtylerwalls
Copy link
Member

Thanks. By chance is anyone testing on linux locally? If it wasn't clear, I have doubts that astroid 3.3.6 fixed anything.

@Pierre-Sassoulas
Copy link
Member

I have linux but didn't find an easy way to install 3.13.1 yet.

@zenlyj
Copy link
Contributor

zenlyj commented Dec 9, 2024

i got the error testing with astroid 3.3.6

environment is WSL2, Ubuntu 20.04.6 LTS if it helps

@Torom
Copy link

Torom commented Dec 9, 2024

Here you can see my failed GitHub action due to the error: https://github.com/Torom/BotLi/actions/runs/12241011421/job/34145142509

Python 3.13.1
astroid-3.3.6
dill-0.3.9
isort-5.13.2
mccabe-0.7.0
platformdirs-4.3.6
pylint-3.3.2
tomlkit-0.13.2

@jacobtylerwalls
Copy link
Member

Thanks, our own actions are failing too, however I'm doubtful we can work on it until we have a contributor who can debug it locally.

@Torom
Copy link

Torom commented Dec 9, 2024

I have linux but didn't find an easy way to install 3.13.1 yet.

With https://github.com/pyenv/pyenv it is very easy to install any Python version, including 3.13.1.

@Pierre-Sassoulas
Copy link
Member

Thank you @Torom ! I managed to fix my issue with uv self update (then 3.13.1 is available)

@Pierre-Sassoulas
Copy link
Member

All right, I can reproduce the collections.abc issue locally. On main:

pylint 4.0.0-dev0
astroid 3.3.5
Python 3.13.1 (main, Dec  6 2024, 18:40:43) [Clang 18.1.8 ]

Switching to dependabot/pip/astroid-3.3.6 I also reproduce with:

pylint 4.0.0-dev0
astroid 3.3.6
Python 3.13.1 (main, Dec  6 2024, 18:40:43) [Clang 18.1.8 ]

I'm wondering if the race condition fixed in the initial issue is bypassing our astroid brain mechanism, but this is just intuition. Let me know if there's any particular test/debug I could do Jacob, I'll be able to dig into this in ~= 20 hours.

@jacobtylerwalls
Copy link
Member

Wonderful. I'd sniff around do_import_module(), maybe see if turning use_cache off helps? And also play with reverting the 3.3.6 change.

skirpichev added a commit to diofant/diofant that referenced this issue Dec 10, 2024

Verified

This commit was signed with the committer’s verified signature.
nateprewitt Nate Prewitt
inducer added a commit to inducer/ci-support that referenced this issue Dec 13, 2024
Torom added a commit to Torom/BotLi that referenced this issue Dec 16, 2024
KKoukiou added a commit to KKoukiou/anaconda that referenced this issue Dec 16, 2024
python-3.13.1 broke compatibility with pylint.

Revert this one the pylint issue [1] is fixed.

[1] pylint-dev/pylint#10112
[2] pylint-dev/astroid#2656
xavierog added a commit to xavierog/moulti that referenced this issue Dec 16, 2024
The bug is:
pylint-dev/pylint#10112

Fortunately, collections.abc is used only once, in the Ansible plugin, for type
checking.
xavierog added a commit to xavierog/moulti that referenced this issue Dec 16, 2024
The bug is:
pylint-dev/pylint#10112

Fortunately, collections.abc is used only once, in the Ansible plugin, for type
checking.
rvykydal pushed a commit to rvykydal/anaconda that referenced this issue Dec 17, 2024
python-3.13.1 broke compatibility with pylint.

Revert this one the pylint issue [1] is fixed.

[1] pylint-dev/pylint#10112
[2] pylint-dev/astroid#2656
chriskuehl added a commit to reddit/baseplate.py that referenced this issue Dec 18, 2024
@DanielNoord
Copy link
Collaborator

Fix for astroid in pylint-dev/astroid#2657. Please review if you have the time.

If anybody who is running into this issue could try to test out the astroid version of that branch to confirm that it fixes the issues that would be awesome. At least on my machine it does reproduce and with that fix it doesn't.

skirpichev added a commit to diofant/diofant that referenced this issue Dec 19, 2024
That's a workaround for pylint-dev/pylint#10112.

Also, properly filter out linting for "schedule" event.
chriskuehl added a commit to reddit/baseplate.py that referenced this issue Dec 19, 2024
@jacobtylerwalls jacobtylerwalls linked a pull request Dec 24, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment