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

Pylint (>=2.13.0) cannot find misc_util module in numpy.distutils #6497

Closed
Thijss opened this issue May 4, 2022 · 2 comments · Fixed by #6498
Closed

Pylint (>=2.13.0) cannot find misc_util module in numpy.distutils #6497

Thijss opened this issue May 4, 2022 · 2 comments · Fixed by #6498
Assignees
Labels

Comments

@Thijss
Copy link

Thijss commented May 4, 2022

Bug description

Hi there,

No sure whether this is an issue in numpy or pylint.

Starting from pylint 2.13.0, pylint reports an error when importing numpy.distutils.misc_util
When I downgrade pylint to the previous version (2.12.2) there is no error reported.

I could not find a significant change in the release notes of 2.13.0 that would cause this.

script a.py:

"""Script that uses numpy's misc_util module"""

from numpy.distutils.misc_util import is_sequence


assert is_sequence("ABC") is False
assert is_sequence([1, 2, 3]) is True

Configuration

No response

Command used

pylint a.py

Pylint output

************* Module a
a.py:3:0: E0611: No name 'misc_util' in module 'numpy.distutils' (no-name-in-module)
a.py:3:0: E0401: Unable to import 'numpy.distutils.misc_util' (import-error)

Expected behavior

Python can import the module without issues, so I would not expect pylint to report an issue here

Pylint version

2.13.0

OS / Environment

Mac OS 12.3.1

Additional dependencies

numpy==1.22.3

@Thijss Thijss added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label May 4, 2022
@Thijss Thijss changed the title Pylint cannot find misc_util module in numpy.distutils Pylint >=2.13.0 cannot find misc_util module in numpy.distutils May 4, 2022
@Thijss Thijss changed the title Pylint >=2.13.0 cannot find misc_util module in numpy.distutils Pylint (>=2.13.0) cannot find misc_util module in numpy.distutils May 4, 2022
@jacobtylerwalls
Copy link
Member

Thanks for the report. I bisected it to pylint-dev/astroid#1386. Apparently numpy has its own distutils module, and we need a smarter to test to distinguish virtualenv's patching of distutils from other packages like numpy that have their own versions.

@jacobtylerwalls jacobtylerwalls added Astroid Related to astroid Regression Import system and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels May 4, 2022
@jacobtylerwalls jacobtylerwalls self-assigned this May 4, 2022
jacobtylerwalls added a commit to jacobtylerwalls/pylint that referenced this issue May 4, 2022
@oh-my-lawdy
Copy link

I'm seeing a similar issue, but with pydantic instead of numpy.

a.py

from pydantic import BaseModel

Command Used

pylint a.py

Pylint Output

************* Module test
test.py:1:0: C0114: Missing module docstring (missing-module-docstring)
test.py:1:0: E0611: No name 'BaseModel' in module 'pydantic' (no-name-in-module)
test.py:1:0: W0611: Unused BaseModel imported from pydantic (unused-import)

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

Pylint Version

2.13.8

OS/Environment

Amazon Linux 2

Other Dependencies

pydantic==1.9.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants