Skip to content

ImportError: cannot import name 'IAstroidChecker' from 'pylint.interfaces' #9144

Closed as not planned
@hintron

Description

@hintron

Bug description

I updated to the latest pylint via Poetry (pylint = "*"), and now it crashes for me. Should I downgrade to the latest 2.x until Pylint becomes stable?

Configuration

I'm not sure what is relevant in my config. From pyproject.toml:

[tool.pylint.master]
ignore-paths = ["docs"]

[tool.pylint.main]
# allow 1+ letter names for arguments and variables
# Original regex: [a-z_][a-z0-9_]{2,30}$
# http://pylint-messages.wikidot.com/messages:c0103
argument-rgx = '[a-z_][a-z0-9_]{0,30}$'
variable-rgx = '[a-z_][a-z0-9_]{0,30}$'
const-rgx = '[a-zA-Z_][a-zA-Z0-9_]{0,30}$'
load-plugins = [
  "pylint_pytest",
]

[tool.pylint.messages_control]

[tool.pylint.format]
max-line-length = 88

Command used

pylint

Pylint output

Traceback (most recent call last):
  File "<redacted-poetry-env>/bin/pylint", line 8, in <module>
    sys.exit(run_pylint())
  File "<redacted-poetry-env>/lib/python3.10/site-packages/pylint/__init__.py", line 34, in run_pylint
    PylintRun(argv or sys.argv[1:])
  File "<redacted-poetry-env>/lib/python3.10/site-packages/pylint/lint/run.py", line 162, in __init__
    args = _config_initialization(
  File "<redacted-poetry-env>/lib/python3.10/site-packages/pylint/config/config_initialization.py", line 61, in _config_initialization
    linter.load_plugin_modules(utils._splitstrip(config_data["load-plugins"]))
  File "<redacted-poetry-env>/lib/python3.10/site-packages/pylint/lint/pylinter.py", line 381, in load_plugin_modules
    module.register(self)
  File "<redacted-poetry-env>/lib/python3.10/site-packages/pylint_pytest/__init__.py", line 23, in register
    checker = importlib.import_module(module, package=os.path.basename(dirname))
  File "<redacted-poetry-env>/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "<redacted-poetry-env>/lib/python3.10/site-packages/pylint_pytest/checkers/class_attr_loader.py", line 2, in <module>
    from pylint.interfaces import IAstroidChecker
ImportError: cannot import name 'IAstroidChecker' from 'pylint.interfaces' (<redacted-poetry-env>/lib/python3.10/site-packages/pylint/interfaces.py)

Expected behavior

For it to not crash. I thought it worked initially when I upgraded to pylint 3, but now it seems to not work. I have another project set up via Poetry on the same system that works with Pylint 3.0.0/3.0.1, so I'm not sure what is going on, or what I did to mess this project up.

Pylint version

$ pylint --version
pylint 3.0.1
astroid 3.0.0
Python 3.10.13 (main, Sep 11 2023, 13:44:35) [GCC 11.2.0]

OS / Environment

LSB Version:    n/a
Distributor ID: SUSE
Description:    SUSE Linux Enterprise Server 12 SP5
Release:        12.5
Codename:       n/a

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions