-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 is unable to import distutils.version under virtualenv #73
Comments
Original comment by Sylvain Thénault (BitBucket: sthenault, GitHub: @sthenault?): PYTHONPATH pb ?
|
Original comment by Sylvain Thénault (BitBucket: sthenault, GitHub: @sthenault?): can't reproduce |
Original comment by BitBucket: notsqrt, GitHub: @NotSqrt?: Seems to be messed up by virtualenvs. Steps to reproduce :
(with the same x.py as above) Fails with version:
|
Original comment by Jan Vermaete (BitBucket: jan.vermaete): I confirm it's related to virtualenv (python -m venv env). Python 3.3.2 (v3.3.2:d047928ae3f6, May 16 2013, 00:03:43) [MSC v.1600 32 bit (In Astroid: Changeset: 1073 (4b0a497acee0) Merged in AndroWiiid/astroid/dev (pull request #12) … |
Original comment by BitBucket: fbretel, GitHub: @fbretel?: Confirmed on Ubuntu 13.10, Python 2.7.5+, pylint 0.26.0 or 1.0.0, astng 0.24.3, common 0.60.0, virtualenv 1.10.1. |
Original comment by BitBucket: elmirjagudin, GitHub: @elmirjagudin?: This is caused by the monkey-patched distutils package which virtualenv creates. The virtualenv script only creates distutils/init.py inside it's sandbox, it does not create the distutils/versions.py file. When you do 'import distutils.version', the distutils module will be loaded from the sandbox, but the version module will be loaded from the global location. For example, this is run from inside of "~boris/tst" sandbox:
However, due to how modules look-up is implemented in logilab.common.modutils, pylint can't locate distutils.version. Pylint will only look for version module in the same directory where it have found it's parent module distutils. IMHO, the problem lies in logilab.common.modutils._module_file() function. It calls find_module() to locate the module. For any child modules it specifies only parent's directory as the search path. |
Original comment by Sylvain Thénault (BitBucket: sthenault, GitHub: @sthenault?): Removing version: 1.0 (automated comment) |
Original comment by Buck Evan (BitBucket: bukzor, GitHub: @bukzor?): @elmirjagudin What is your proposed change? From what I can see, the |
Original comment by Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore): Probably, it just needs someone to write the patch. We'll look into it after finishing with pylint 1.5.0, that's the main priority for now. |
- use /usr/bin/env instead of hard-coded /usr/bin/python3 - move mypy checks into the `check` target - disable pylint import checks for setup.py because of pylint-dev/pylint#73 (comment)
- use /usr/bin/env instead of hard-coded /usr/bin/python3 - move mypy checks into the `check` target - disable pylint import checks for setup.py because of pylint-dev/pylint#73 (comment)
- use /usr/bin/env instead of hard-coded /usr/bin/python3 - move mypy checks into the `check` target - disable coverage + multiprocessing - generates lots of JSON errors - disable pylint import checks for setup.py because of pylint-dev/pylint#73 (comment)
- use /usr/bin/env instead of hard-coded /usr/bin/python3 - move mypy checks into the `check` target - disable coverage + multiprocessing - generates lots of JSON errors - disable pylint import checks for setup.py because of pylint-dev/pylint#73 (comment)
- use /usr/bin/env instead of hard-coded /usr/bin/python3 - move mypy checks into the `check` target - disable pylint import checks for setup.py because of pylint-dev/pylint#73 (comment)
- use /usr/bin/env instead of hard-coded /usr/bin/python3 - move mypy checks into the `check` target - disable pylint import checks for setup.py because of pylint-dev/pylint#73 (comment)
- use /usr/bin/env instead of hard-coded /usr/bin/python3 - move mypy checks into the `check` target - disable pylint import checks for setup.py because of pylint-dev/pylint#73 (comment)
- use /usr/bin/env instead of hard-coded /usr/bin/python3 - move mypy checks into the `check` target - disable pylint import checks for setup.py because of pylint-dev/pylint#73 (comment)
- use /usr/bin/env instead of hard-coded /usr/bin/python3 - move mypy checks into the `check` target - disable pylint import checks for setup.py because of pylint-dev/pylint#73 (comment)
- use /usr/bin/env instead of hard-coded /usr/bin/python3 - move mypy checks into the `check` target - disable pylint import checks for setup.py because of pylint-dev/pylint#73 (comment)
- use /usr/bin/env instead of hard-coded /usr/bin/python3 - move mypy checks into the `check` target - disable pylint import checks for setup.py because of pylint-dev/pylint#73 (comment)
- use /usr/bin/env instead of hard-coded /usr/bin/python3 - move mypy checks into the `check` target - disable pylint import checks for setup.py because of pylint-dev/pylint#73 (comment)
Pylint doesn't grok monkey-patched distutils used in virtualenv: pylint-dev/pylint#73
Pylint doesn't grok monkey-patched distutils used in virtualenv: pylint-dev/pylint#73
* Fixes PyLint to run in the virtualenv used for all tests * Replaced 'LooseVersion' with 'parse_version' from setuptools - This is a work around for the issue in pylint-dev/pylint#73 in which pylint can not import disutils.version correctly in a virtualenv. * Removed the unused function 'delete_hosts' which was causing a pylint error as well * Removed a deprecated pylint pragma option, 'bad-builtin' * Fixed some import ordering issues it was picky about * Added another disable for a case where the PyLint suggestion would have us altering the container we would be iterating over * Add code-coverage reports to the unittests with the MINIMUM coverage percentage for success set to 70% - Current test coverage is at 76%
* Fixes PyLint to run in the virtualenv used for all tests * Replaced 'LooseVersion' with 'parse_version' from setuptools - This is a work around for the issue in pylint-dev/pylint#73 in which pylint can not import disutils.version correctly in a virtualenv. * Removed the unused function 'delete_hosts' which was causing a pylint error as well * Removed a deprecated pylint pragma option, 'bad-builtin' * Fixed some import ordering issues it was picky about * Added another disable for a case where the PyLint suggestion would have us altering the container we would be iterating over * Add code-coverage reports to the unittests with the MINIMUM coverage percentage for success set to 70% - Current test coverage is at 76%
The export version number in newer `aiida-core` versions is no longer a string but a float. Converting both to `StrictVersion` should solve the problem. The import of `StrictVersion` from `distutils` triggered an error in `pylint` and therefore `distutils` is currently ignored until the issue is addressed: pylint-dev/pylint#73
Despite the comment from @mattsb42-aws , I'm encountering this problem with Python 3.7.2. |
When's the next pylint release? We are waiting for this fix :) |
Pylint complains about distutils import in virtualenv (tox): pylint-dev/pylint#73 ``` E: 22, 0: No name 'version' in module 'distutils' (no-name-in-module) E: 22, 0: Unable to import 'distutils.version.StrictVersion' (import-error) ``` Add inline pylint disable for `no-name-in-module` and `import-error` checks as workaround for this issue.
Pylint complains about distutils import in virtualenv (tox): pylint-dev/pylint#73 ``` E: 22, 0: No name 'version' in module 'distutils' (no-name-in-module) E: 22, 0: Unable to import 'distutils.version.StrictVersion' (import-error) ``` Add inline pylint disable for `no-name-in-module` and `import-error` checks as workaround for this issue.
Pylint complains about distutils import in virtualenv (tox): pylint-dev/pylint#73 ``` E: 22, 0: No name 'version' in module 'distutils' (no-name-in-module) E: 22, 0: Unable to import 'distutils.version.StrictVersion' (import-error) ``` Add inline pylint disable for `no-name-in-module` and `import-error` checks as workaround for this issue.
Pylint complains about distutils import in virtualenv (tox): pylint-dev/pylint#73 ``` E: 22, 0: No name 'version' in module 'distutils' (no-name-in-module) E: 22, 0: Unable to import 'distutils.version.StrictVersion' (import-error) ``` Add inline pylint disable for `no-name-in-module` and `import-error` checks as workaround for this issue.
Older pylint version had issues with distutils imports: pylint-dev/pylint#73
Older pylint version had issues with distutils imports: pylint-dev/pylint#73
Pylint complains about distutils import in virtualenv (tox): pylint-dev/pylint#73 ``` E: 22, 0: No name 'version' in module 'distutils' (no-name-in-module) E: 22, 0: Unable to import 'distutils.version.StrictVersion' (import-error) ``` Add inline pylint disable for `no-name-in-module` and `import-error` checks as workaround for this issue.
Following change in the way distutil is stored in setuptools See pylint-dev/astroid#1321
Following change in the way distutil is stored in setuptools See pylint-dev/astroid#1321
Following change in the way distutil is stored in setuptools See pylint-dev/astroid#1321
Following change in the way distutil is stored in setuptools See pylint-dev/astroid#1321
Older pylint version had issues with distutils imports: pylint-dev/pylint#73
Older pylint version had issues with distutils imports: pylint-dev/pylint#73
Originally reported by: Chris Rebert (BitBucket: cvrebert, GitHub: @cvrebert?)
Testcase:
Output:
Which doesn't agree with Python itself:
The text was updated successfully, but these errors were encountered: