throws error
ubuntu@ip-0000:~/scripts/pooja/ext-code/pylint$ pip list | grep astroid
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
astroid (1.5.0)
ubuntu@ip-0000:~/scripts/pooja/ext-code/pylint$ pip list | grep pylint
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
pylint (1.7.0, /usr/local/lib/python2.7/dist-packages/pylint-1.7.0-py2.7.egg)
ubuntu@ip-00000:~/scripts/pooja/ext-code/pylint$ cd /var/lib/jenkins/jobs/CI_SyntaxValidator_commons/workspace
(reverse-i-search)`inst': sudo python setup.py ^Cstall
ubuntu@ip-00000:/var/lib/jenkins/jobs/CI_SyntaxValidator_commons/workspace$ ^C
ubuntu@ip-0000:/var/lib/jenkins/jobs/CI_SyntaxValidator_commons/workspace$ pylint commons/
Traceback (most recent call last):
File "/usr/local/bin/pylint", line 11, in <module>
load_entry_point('pylint==1.7.0', 'console_scripts', 'pylint')()
File "/usr/local/lib/python2.7/dist-packages/pylint-1.7.0-py2.7.egg/pylint/__init__.py", line 13, in run_pylint
Run(sys.argv[1:])
File "/usr/local/lib/python2.7/dist-packages/pylint-1.7.0-py2.7.egg/pylint/lint.py", line 1220, in __init__
linter.load_default_plugins()
File "/usr/local/lib/python2.7/dist-packages/pylint-1.7.0-py2.7.egg/pylint/lint.py", line 453, in load_default_plugins
checkers.initialize(self)
File "/usr/local/lib/python2.7/dist-packages/pylint-1.7.0-py2.7.egg/pylint/checkers/__init__.py", line 114, in initialize
register_plugins(linter, __path__[0])
File "/usr/local/lib/python2.7/dist-packages/pylint-1.7.0-py2.7.egg/pylint/utils.py", line 992, in register_plugins
module = modutils.load_module_from_file(join(directory, filename))
File "/usr/local/lib/python2.7/dist-packages/astroid-1.5.0-py2.7.egg/astroid/modutils.py", line 272, in load_module_from_file
return load_module_from_modpath(modpath, path, use_sys)
File "/usr/local/lib/python2.7/dist-packages/astroid-1.5.0-py2.7.egg/astroid/modutils.py", line 233, in load_module_from_modpath
module = imp.load_module(curname, mp_file, mp_filename, mp_desc)
File "/usr/local/lib/python2.7/dist-packages/pylint-1.7.0-py2.7.egg/pylint/checkers/python3.py", line 100, in <module>
class Python3Checker(checkers.BaseChecker):
File "/usr/local/lib/python2.7/dist-packages/pylint-1.7.0-py2.7.egg/pylint/checkers/python3.py", line 501, in Python3Checker
'sys.version_info < (3, 0)',
File "/usr/local/lib/python2.7/dist-packages/astroid-1.5.0-py2.7.egg/astroid/node_classes.py", line 624, in repr_tree
_repr_tree(self, result, set())
File "build/bdist.linux-x86_64/egg/singledispatch.py", line 210, in wrapper
File "/usr/local/lib/python2.7/dist-packages/astroid-1.5.0-py2.7.egg/astroid/node_classes.py", line 613, in _repr_node
depth)
File "build/bdist.linux-x86_64/egg/singledispatch.py", line 210, in wrapper
File "/usr/local/lib/python2.7/dist-packages/astroid-1.5.0-py2.7.egg/astroid/node_classes.py", line 613, in _repr_node
depth)
File "build/bdist.linux-x86_64/egg/singledispatch.py", line 210, in wrapper
File "build/bdist.linux-x86_64/egg/singledispatch.py", line 191, in dispatch
File "build/bdist.linux-x86_64/egg/singledispatch.py", line 142, in _find_impl
File "build/bdist.linux-x86_64/egg/singledispatch.py", line 130, in _compose_mro
File "build/bdist.linux-x86_64/egg/singledispatch.py", line 84, in _c3_mro
File "build/bdist.linux-x86_64/egg/singledispatch.py", line 88, in _c3_mro
File "build/bdist.linux-x86_64/egg/singledispatch.py", line 39, in _c3_merge
RuntimeError: Inconsistent hierarchy
ubuntu@ip-0000:/var/lib/workspace$ pip list | grep pylint
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
pylint (1.7.0, /usr/local/lib/python2.7/dist-packages/pylint-1.7.0-py2.7.egg)
ubuntu@ip-0000:/var/lib/workspace$ pip list | grep astroid
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
astroid (1.5.0)
Try doing this:
uninstall pylint and astroid with pip:
pip uninstall astroid
pip uninstall pylint
Verify that they were really uninstalled using pip list
Install astroid using pip:
pip install git+https://github.com/PyCQA/astroid.git@master
or
pip install -e /path/to/astroid/repo
Install pylint using pip:
pip install git+https://github.com/PyCQA/pylint.git@master
or
pip install -e /path/to/pylint/repo
thanks @degustaf but now it fails with
Traceback (most recent call last):
File "/var/lib/jenkins/workspace/venv/bin/pylint", line 11, in <module>
load_entry_point('pylint==1.7.0', 'console_scripts', 'pylint')()
File "/var/lib/jenkins/workspace/venv/local/lib/python2.7/site-packages/pylint/__init__.py", line 13, in run_pylint
Run(sys.argv[1:])
File "/var/lib/jenkins/workspace/venv/local/lib/python2.7/site-packages/pylint/lint.py", line 1268, in __init__
linter.load_config_file()
File "/var/lib/jenkins/workspace/venv/local/lib/python2.7/site-packages/pylint/config.py", line 654, in load_config_file
self.global_set_option(option, value)
File "/var/lib/jenkins/workspace/venv/local/lib/python2.7/site-packages/pylint/config.py", line 560, in global_set_option
self._all_options[opt].set_option(opt, value)
File "/var/lib/jenkins/workspace/venv/local/lib/python2.7/site-packages/pylint/lint.py", line 514, in set_option
self._load_reporter()
File "/var/lib/jenkins/workspace/venv/local/lib/python2.7/site-packages/pylint/lint.py", line 478, in _load_reporter
modutils.get_module_part(qname))
File "/var/lib/jenkins/workspace/venv/local/lib/python2.7/site-packages/astroid/modutils.py", line 437, in get_module_part
context_file=context_file)
File "/var/lib/jenkins/workspace/venv/local/lib/python2.7/site-packages/astroid/modutils.py", line 338, in file_from_modpath
return file_info_from_modpath(modpath, path, context_file).location
File "/var/lib/jenkins/workspace/venv/local/lib/python2.7/site-packages/astroid/modutils.py", line 383, in file_info_from_modpath
return _spec_from_modpath(modpath, path, context)
File "/var/lib/jenkins/workspace/venv/local/lib/python2.7/site-packages/astroid/modutils.py", line 603, in _spec_from_modpath
found_spec = spec.find_spec(modpath, path)
File "/var/lib/jenkins/workspace/venv/local/lib/python2.7/site-packages/astroid/interpreter/_import/spec.py", line 279, in find_spec
submodule_path or path)
File "/var/lib/jenkins/workspace/venv/local/lib/python2.7/site-packages/astroid/interpreter/_import/spec.py", line 246, in _find_spec_with_path
raise ImportError('No module named %s' % '.'.join(module_parts))
ImportError: No module named html
update:
the same problem exists if done normally (without virtual env)
[email protected]:~/scripts/pooja/ext-code$ pylint --version
Traceback (most recent call last):
File "/usr/local/bin/pylint", line 11, in <module>
load_entry_point('pylint==1.7.0', 'console_scripts', 'pylint')()
File "/usr/local/lib/python2.7/dist-packages/pylint/__init__.py", line 13, in run_pylint
Run(sys.argv[1:])
File "/usr/local/lib/python2.7/dist-packages/pylint/lint.py", line 1220, in __init__
linter.load_default_plugins()
File "/usr/local/lib/python2.7/dist-packages/pylint/lint.py", line 453, in load_default_plugins
checkers.initialize(self)
File "/usr/local/lib/python2.7/dist-packages/pylint/checkers/__init__.py", line 114, in initialize
register_plugins(linter, __path__[0])
File "/usr/local/lib/python2.7/dist-packages/pylint/utils.py", line 992, in register_plugins
module = modutils.load_module_from_file(join(directory, filename))
File "/usr/local/lib/python2.7/dist-packages/astroid/modutils.py", line 272, in load_module_from_file
return load_module_from_modpath(modpath, path, use_sys)
File "/usr/local/lib/python2.7/dist-packages/astroid/modutils.py", line 233, in load_module_from_modpath
module = imp.load_module(curname, mp_file, mp_filename, mp_desc)
File "/usr/local/lib/python2.7/dist-packages/pylint/checkers/python3.py", line 100, in <module>
class Python3Checker(checkers.BaseChecker):
File "/usr/local/lib/python2.7/dist-packages/pylint/checkers/python3.py", line 501, in Python3Checker
'sys.version_info < (3, 0)',
File "/usr/local/lib/python2.7/dist-packages/astroid/node_classes.py", line 624, in repr_tree
_repr_tree(self, result, set())
File "build/bdist.linux-x86_64/egg/singledispatch.py", line 210, in wrapper
File "/usr/local/lib/python2.7/dist-packages/astroid/node_classes.py", line 613, in _repr_node
depth)
File "build/bdist.linux-x86_64/egg/singledispatch.py", line 210, in wrapper
File "/usr/local/lib/python2.7/dist-packages/astroid/node_classes.py", line 613, in _repr_node
depth)
File "build/bdist.linux-x86_64/egg/singledispatch.py", line 210, in wrapper
File "build/bdist.linux-x86_64/egg/singledispatch.py", line 191, in dispatch
File "build/bdist.linux-x86_64/egg/singledispatch.py", line 142, in _find_impl
File "build/bdist.linux-x86_64/egg/singledispatch.py", line 130, in _compose_mro
File "build/bdist.linux-x86_64/egg/singledispatch.py", line 84, in _c3_mro
File "build/bdist.linux-x86_64/egg/singledispatch.py", line 88, in _c3_mro
File "build/bdist.linux-x86_64/egg/singledispatch.py", line 39, in _c3_merge
RuntimeError: Inconsistent hierarchy
but if done inside virtual environment, the error changes to this:
Traceback (most recent call last):
File "/var/lib/jenkins/workspace/venv/bin/pylint", line 11, in <module>
load_entry_point('pylint==1.7.0', 'console_scripts', 'pylint')()
File "/var/lib/jenkins/workspace/venv/local/lib/python2.7/site-packages/pylint/__init__.py", line 13, in run_pylint
Run(sys.argv[1:])
File "/var/lib/jenkins/workspace/venv/local/lib/python2.7/site-packages/pylint/lint.py", line 1268, in __init__
linter.load_config_file()
File "/var/lib/jenkins/workspace/venv/local/lib/python2.7/site-packages/pylint/config.py", line 654, in load_config_file
self.global_set_option(option, value)
File "/var/lib/jenkins/workspace/venv/local/lib/python2.7/site-packages/pylint/config.py", line 560, in global_set_option
self._all_options[opt].set_option(opt, value)
File "/var/lib/jenkins/workspace/venv/local/lib/python2.7/site-packages/pylint/lint.py", line 514, in set_option
self._load_reporter()
File "/var/lib/jenkins/workspace/venv/local/lib/python2.7/site-packages/pylint/lint.py", line 478, in _load_reporter
modutils.get_module_part(qname))
File "/var/lib/jenkins/workspace/venv/local/lib/python2.7/site-packages/astroid/modutils.py", line 437, in get_module_part
context_file=context_file)
File "/var/lib/jenkins/workspace/venv/local/lib/python2.7/site-packages/astroid/modutils.py", line 338, in file_from_modpath
return file_info_from_modpath(modpath, path, context_file).location
File "/var/lib/jenkins/workspace/venv/local/lib/python2.7/site-packages/astroid/modutils.py", line 383, in file_info_from_modpath
return _spec_from_modpath(modpath, path, context)
File "/var/lib/jenkins/workspace/venv/local/lib/python2.7/site-packages/astroid/modutils.py", line 603, in _spec_from_modpath
found_spec = spec.find_spec(modpath, path)
File "/var/lib/jenkins/workspace/venv/local/lib/python2.7/site-packages/astroid/interpreter/_import/spec.py", line 279, in find_spec
submodule_path or path)
File "/var/lib/jenkins/workspace/venv/local/lib/python2.7/site-packages/astroid/interpreter/_import/spec.py", line 246, in _find_spec_with_path
raise ImportError('No module named %s' % '.'.join(module_parts))
ImportError: No module named html
@PCManticore any hints would be helpful
@p00j4 Note that it's actually a RuntimeError from standard/backported library. Is there any chance that your backported library is not the same version that's used in our testing?
@p00j4 Can you still reproduce this using the freshly released pylint 1.7?
@PCManticore I just installed 1.7 and am getting this issue, so yes it is also a problem with 1.7
I also get the error. I just installed everything from pip.
pylint 1.7.1
python 2.7.12
astroid 1.5.2
singledispatch 3.4.0.3
$ pylint
Traceback (most recent call last):
File "/usr/local/bin/pylint", line 11, in <module>
sys.exit(run_pylint())
File "/usr/local/lib/python2.7/dist-packages/pylint/__init__.py", line 13, in run_pylint
Run(sys.argv[1:])
File "/usr/local/lib/python2.7/dist-packages/pylint/lint.py", line 1220, in __init__
linter.load_default_plugins()
File "/usr/local/lib/python2.7/dist-packages/pylint/lint.py", line 453, in load_default_plugins
checkers.initialize(self)
File "/usr/local/lib/python2.7/dist-packages/pylint/checkers/__init__.py", line 114, in initialize
register_plugins(linter, __path__[0])
File "/usr/local/lib/python2.7/dist-packages/pylint/utils.py", line 992, in register_plugins
module = modutils.load_module_from_file(join(directory, filename))
File "/usr/local/lib/python2.7/dist-packages/astroid/modutils.py", line 272, in load_module_from_file
return load_module_from_modpath(modpath, path, use_sys)
File "/usr/local/lib/python2.7/dist-packages/astroid/modutils.py", line 233, in load_module_from_modpath
module = imp.load_module(curname, mp_file, mp_filename, mp_desc)
File "/usr/local/lib/python2.7/dist-packages/pylint/checkers/python3.py", line 100, in <module>
class Python3Checker(checkers.BaseChecker):
File "/usr/local/lib/python2.7/dist-packages/pylint/checkers/python3.py", line 501, in Python3Checker
'sys.version_info < (3, 0)',
File "/usr/local/lib/python2.7/dist-packages/astroid/node_classes.py", line 624, in repr_tree
_repr_tree(self, result, set())
File "/usr/local/lib/python2.7/dist-packages/singledispatch.py", line 210, in wrapper
return dispatch(args[0].__class__)(*args, **kw)
File "/usr/local/lib/python2.7/dist-packages/astroid/node_classes.py", line 613, in _repr_node
depth)
File "/usr/local/lib/python2.7/dist-packages/singledispatch.py", line 210, in wrapper
return dispatch(args[0].__class__)(*args, **kw)
File "/usr/local/lib/python2.7/dist-packages/astroid/node_classes.py", line 613, in _repr_node
depth)
File "/usr/local/lib/python2.7/dist-packages/singledispatch.py", line 210, in wrapper
return dispatch(args[0].__class__)(*args, **kw)
File "/usr/local/lib/python2.7/dist-packages/singledispatch.py", line 191, in dispatch
impl = _find_impl(cls, registry)
File "/usr/local/lib/python2.7/dist-packages/singledispatch.py", line 142, in _find_impl
mro = _compose_mro(cls, registry.keys())
File "/usr/local/lib/python2.7/dist-packages/singledispatch.py", line 130, in _compose_mro
return _c3_mro(cls, abcs=mro)
File "/usr/local/lib/python2.7/dist-packages/singledispatch.py", line 84, in _c3_mro
other_c3_mros = [_c3_mro(base, abcs=abcs) for base in other_bases]
File "/usr/local/lib/python2.7/dist-packages/singledispatch.py", line 88, in _c3_mro
[explicit_bases] + [abstract_bases] + [other_bases]
File "/usr/local/lib/python2.7/dist-packages/singledispatch.py", line 39, in _c3_merge
raise RuntimeError("Inconsistent hierarchy")
RuntimeError: Inconsistent hierarchy
My first time trying pylint last night and was very confused by this error.
(venv) n8henrie@NateAir:~/git/pycookiecheat $ pylint -h
Traceback (most recent call last):
File "/Users/n8henrie/git/pycookiecheat/venv/bin/pylint", line 11, in <module>
sys.exit(run_pylint())
File "/Users/n8henrie/git/pycookiecheat/venv/lib/python3.6/site-packages/pylint/__init__.py", line 13, in run_pylint
Run(sys.argv[1:])
File "/Users/n8henrie/git/pycookiecheat/venv/lib/python3.6/site-packages/pylint/lint.py", line 1268, in __init__
linter.load_config_file()
File "/Users/n8henrie/git/pycookiecheat/venv/lib/python3.6/site-packages/pylint/config.py", line 654, in load_config_file
self.global_set_option(option, value)
File "/Users/n8henrie/git/pycookiecheat/venv/lib/python3.6/site-packages/pylint/config.py", line 560, in global_set_option
self._all_options[opt].set_option(opt, value)
File "/Users/n8henrie/git/pycookiecheat/venv/lib/python3.6/site-packages/pylint/lint.py", line 514, in set_option
self._load_reporter()
File "/Users/n8henrie/git/pycookiecheat/venv/lib/python3.6/site-packages/pylint/lint.py", line 480, in _load_reporter
reporter_class = getattr(module, class_name)
AttributeError: module 'html' has no attribute 'html'
(venv) n8henrie@NateAir:~/git/pycookiecheat $
(venv) n8henrie@NateAir:~/git/pycookiecheat $ pip freeze | grep -P -i '(pylint)|(astroid)'
astroid==1.5.2
pylint==1.7.1
(venv) n8henrie@NateAir:~/git/pycookiecheat $ python --version
Python 3.6.1
May help others find it to add the html part to the issue title, since that was I was fruitlessly searching for yesterday.
I attempted to reproduce an issue and failed.
My steps we're as following:
mac-mini:pylint-issue1388 rogalski$ python3 -m pip freeze | grep virtualenv
virtualenv==15.1.0
mac-mini:pylint-issue1388 rogalski$ python3 -m virtualenv venv
Using base prefix '/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6'
New python executable in /Users/rogalski/pylint-issue1388/venv/bin/python3.6
Also creating executable in /Users/rogalski/pylint-issue1388/venv/bin/python
Installing setuptools, pip, wheel...done.
mac-mini:pylint-issue1388 rogalski$ source venv/bin/activate
(venv) mac-mini:pylint-issue1388 rogalski$
(venv) mac-mini:pylint-issue1388 rogalski$ pip install pylint
Collecting pylint
Using cached pylint-1.7.1-py2.py3-none-any.whl
Collecting isort>=4.2.5 (from pylint)
Using cached isort-4.2.5-py2.py3-none-any.whl
Requirement already satisfied: six in ./venv/lib/python3.6/site-packages (from pylint)
Collecting astroid>=1.5.1 (from pylint)
Using cached astroid-1.5.2-py2.py3-none-any.whl
Collecting mccabe (from pylint)
Using cached mccabe-0.6.1-py2.py3-none-any.whl
Collecting wrapt (from astroid>=1.5.1->pylint)
Collecting lazy-object-proxy (from astroid>=1.5.1->pylint)
Installing collected packages: isort, wrapt, lazy-object-proxy, astroid, mccabe, pylint
Successfully installed astroid-1.5.2 isort-4.2.5 lazy-object-proxy-1.2.2 mccabe-0.6.1 pylint-1.7.1 wrapt-1.10.10
pylint --version from vnv(venv) mac-mini:pylint-issue1388 rogalski$ pylint --version
No config file found, using default configuration
pylint 1.7.1,
astroid 1.5.2
Python 3.6.1 (default, Mar 23 2017, 21:03:47)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)]
Can anyone of reporters seek for any discrepancies between my reproduction steps and their environment?
In case it's relevant, I'm on macOS 10.12.4 (16E195).
Steps for Python 2.7:
mac-mini:pylint-issue1388 rogalski$ python -m pip freeze | grep virtualenv
virtualenv==15.1.0
mac-mini:pylint-issue1388 rogalski$ python -m virtualenv venv27
New python executable in /Users/rogalski/pylint-issue1388/venv27/bin/python2.7
Also creating executable in /Users/rogalski/pylint-issue1388/venv27/bin/python
Installing setuptools, pip, wheel...done.
mac-mini:pylint-issue1388 rogalski$ source venv27/bin/activate
(venv27) mac-mini:pylint-issue1388 rogalski$ pip install pylint
Collecting pylint
Using cached pylint-1.7.1-py2.py3-none-any.whl
Requirement already satisfied: six in ./venv27/lib/python2.7/site-packages (from pylint)
Collecting isort>=4.2.5 (from pylint)
Using cached isort-4.2.5-py2.py3-none-any.whl
Collecting singledispatch; python_version < "3.4" (from pylint)
Using cached singledispatch-3.4.0.3-py2.py3-none-any.whl
Collecting mccabe (from pylint)
Using cached mccabe-0.6.1-py2.py3-none-any.whl
Collecting configparser; python_version == "2.7" (from pylint)
Collecting backports.functools-lru-cache; python_version == "2.7" (from pylint)
Using cached backports.functools_lru_cache-1.3-py2.py3-none-any.whl
Collecting astroid>=1.5.1 (from pylint)
Using cached astroid-1.5.2-py2.py3-none-any.whl
Collecting wrapt (from astroid>=1.5.1->pylint)
Collecting lazy-object-proxy (from astroid>=1.5.1->pylint)
Collecting enum34; python_version < "3.4" (from astroid>=1.5.1->pylint)
Using cached enum34-1.1.6-py2-none-any.whl
Installing collected packages: isort, singledispatch, mccabe, configparser, backports.functools-lru-cache, wrapt, lazy-object-proxy, enum34, astroid, pylint
Successfully installed astroid-1.5.2 backports.functools-lru-cache-1.3 configparser-3.5.0 enum34-1.1.6 isort-4.2.5 lazy-object-proxy-1.2.2 mccabe-0.6.1 pylint-1.7.1 singledispatch-3.4.0.3 wrapt-1.10.10
(venv27) mac-mini:pylint-issue1388 rogalski$ pylint --version
No config file found, using default configuration
pylint 1.7.1,
astroid 1.5.2
Python 2.7.13 (default, Dec 18 2016, 21:02:40)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)]
(venv27) mac-mini:pylint-issue1388 rogalski$
Same here.
Python2
#!/bin/bash
# test.sh
python2 --version
python2 -m pip freeze | grep virtualenv
python2 -m virtualenv venv
venv/bin/python -m pip install --upgrade pylint
venv/bin/python -m pip freeze | grep pylint
venv/bin/pylint --version
n8henrie@NateAir:~ [1]$ bash test.sh
Python 2.7.13
virtualenv==15.1.0
New python executable in /Users/n8henrie/venv/bin/python2.7
Also creating executable in /Users/n8henrie/venv/bin/python
Installing setuptools, pip, wheel...done.
Collecting pylint
Using cached pylint-1.7.1-py2.py3-none-any.whl
Requirement already up-to-date: six in ./venv/lib/python2.7/site-packages (from pylint)
Collecting isort>=4.2.5 (from pylint)
Collecting singledispatch; python_version < "3.4" (from pylint)
Using cached singledispatch-3.4.0.3-py2.py3-none-any.whl
Collecting mccabe (from pylint)
Using cached mccabe-0.6.1-py2.py3-none-any.whl
Collecting configparser; python_version == "2.7" (from pylint)
Collecting backports.functools-lru-cache; python_version == "2.7" (from pylint)
Using cached backports.functools_lru_cache-1.3-py2.py3-none-any.whl
Collecting astroid>=1.5.1 (from pylint)
Using cached astroid-1.5.2-py2.py3-none-any.whl
Collecting wrapt (from astroid>=1.5.1->pylint)
Collecting lazy-object-proxy (from astroid>=1.5.1->pylint)
Collecting enum34; python_version < "3.4" (from astroid>=1.5.1->pylint)
Using cached enum34-1.1.6-py2-none-any.whl
Installing collected packages: isort, singledispatch, mccabe, configparser, backports.functools-lru-cache, wrapt, lazy-object-proxy, enum34, astroid, pylint
Successfully installed astroid-1.5.2 backports.functools-lru-cache-1.3 configparser-3.5.0 enum34-1.1.6 isort-4.2.5 lazy-object-proxy-1.2.2 mccabe-0.6.1 pylint-1.7.1 singledispatch-3.4.0.3 wrapt-1.10.10
pylint==1.7.1
Traceback (most recent call last):
File "venv/bin/pylint", line 11, in <module>
sys.exit(run_pylint())
File "/Users/n8henrie/venv/lib/python2.7/site-packages/pylint/__init__.py", line 13, in run_pylint
Run(sys.argv[1:])
File "/Users/n8henrie/venv/lib/python2.7/site-packages/pylint/lint.py", line 1268, in __init__
linter.load_config_file()
File "/Users/n8henrie/venv/lib/python2.7/site-packages/pylint/config.py", line 654, in load_config_file
self.global_set_option(option, value)
File "/Users/n8henrie/venv/lib/python2.7/site-packages/pylint/config.py", line 560, in global_set_option
self._all_options[opt].set_option(opt, value)
File "/Users/n8henrie/venv/lib/python2.7/site-packages/pylint/lint.py", line 514, in set_option
self._load_reporter()
File "/Users/n8henrie/venv/lib/python2.7/site-packages/pylint/lint.py", line 478, in _load_reporter
modutils.get_module_part(qname))
File "/Users/n8henrie/venv/lib/python2.7/site-packages/astroid/modutils.py", line 437, in get_module_part
context_file=context_file)
File "/Users/n8henrie/venv/lib/python2.7/site-packages/astroid/modutils.py", line 338, in file_from_modpath
return file_info_from_modpath(modpath, path, context_file).location
File "/Users/n8henrie/venv/lib/python2.7/site-packages/astroid/modutils.py", line 383, in file_info_from_modpath
return _spec_from_modpath(modpath, path, context)
File "/Users/n8henrie/venv/lib/python2.7/site-packages/astroid/modutils.py", line 603, in _spec_from_modpath
found_spec = spec.find_spec(modpath, path)
File "/Users/n8henrie/venv/lib/python2.7/site-packages/astroid/interpreter/_import/spec.py", line 279, in find_spec
submodule_path or path)
File "/Users/n8henrie/venv/lib/python2.7/site-packages/astroid/interpreter/_import/spec.py", line 246, in _find_spec_with_path
raise ImportError('No module named %s' % '.'.join(module_parts))
ImportError: No module named html
Python3
n8henrie@NateAir:~ [1]$ cat test.sh
#!/bin/bash
# test.sh
python3 -m venv venv
venv/bin/python --version
venv/bin/python -m pip install --upgrade pylint
venv/bin/python -m pip freeze | grep pylint
venv/bin/pylint --version
n8henrie@NateAir:~ [1]$ bash test.sh
Python 3.6.1
Collecting pylint
Using cached pylint-1.7.1-py2.py3-none-any.whl
Collecting six (from pylint)
Collecting isort>=4.2.5 (from pylint)
Collecting astroid>=1.5.1 (from pylint)
Using cached astroid-1.5.2-py2.py3-none-any.whl
Collecting mccabe (from pylint)
Using cached mccabe-0.6.1-py2.py3-none-any.whl
Collecting wrapt (from astroid>=1.5.1->pylint)
Collecting lazy-object-proxy (from astroid>=1.5.1->pylint)
Installing collected packages: six, isort, wrapt, lazy-object-proxy, astroid, mccabe, pylint
Successfully installed astroid-1.5.2 isort-4.2.5 lazy-object-proxy-1.2.2 mccabe-0.6.1 pylint-1.7.1 six-1.10.0 wrapt-1.10.10
pylint==1.7.1
Traceback (most recent call last):
File "venv/bin/pylint", line 11, in <module>
sys.exit(run_pylint())
File "/Users/n8henrie/venv/lib/python3.6/site-packages/pylint/__init__.py", line 13, in run_pylint
Run(sys.argv[1:])
File "/Users/n8henrie/venv/lib/python3.6/site-packages/pylint/lint.py", line 1268, in __init__
linter.load_config_file()
File "/Users/n8henrie/venv/lib/python3.6/site-packages/pylint/config.py", line 654, in load_config_file
self.global_set_option(option, value)
File "/Users/n8henrie/venv/lib/python3.6/site-packages/pylint/config.py", line 560, in global_set_option
self._all_options[opt].set_option(opt, value)
File "/Users/n8henrie/venv/lib/python3.6/site-packages/pylint/lint.py", line 514, in set_option
self._load_reporter()
File "/Users/n8henrie/venv/lib/python3.6/site-packages/pylint/lint.py", line 480, in _load_reporter
reporter_class = getattr(module, class_name)
AttributeError: module 'html' has no attribute 'html'
@n8henrie can you check what is the value of output-format from your pylintrc file? I presume it is html. The html reporter does not exist any longer in pylint 1.7.
This is a new project with which I haven't used pylint previously that I can recall, but I wonder if I have some global config somewhere that could be causing the issue. I'll check when I get home.
On Apr 21, 2017, at 8:40 AM, Claudiu Popa notifications@github.com wrote:
@n8henrie can you check what is the value of output-format from your pylintrc file? I presume it is html. The html reporter does not exist any longer in pylint 1.7.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
@PCManticore @n8henrie keep in mind that pylintrc may also come from other locations than project dir. This may be a source of confusion.
@rogalski I'll sheepishly confess that I found a $HOME/.pylintrc, and removing it solves the issue for me. I guess I must have tried pylint at some point in the past and forgotten?
Anyway, thanks for helping me figure out such a simple issue!
We still need a graceful error message and not this ugly crash.
Furthermore, we need to reproduce _Inconsistent Hierarchy_ crash.
@p00j4 @Leonidaz0r maybe you can help with that? I've added my reproduction steps few comments above.
I just merged #1450 which should resolve isolated "AttributeError" / "no module" issue.
If someone of reporters could use versions form master branch and try to reproduce first issue (RuntimeError: Inconsistent hierarchy) I'd be grateful.
@rogalski I am getting the same issue from master branch
pylint]# pip freeze | grep -P -i '(pylint)|(astroid)'
astroid==1.5.2
pylint==1.8.0
[root@Mgmt_334 pylint]# pylint
Traceback (most recent call last):
File "/usr/bin/pylint", line 9, in <module>
load_entry_point('pylint==1.8.0', 'console_scripts', 'pylint')()
File "/usr/lib/python2.7/site-packages/pylint-1.8.0-py2.7.egg/pylint/__init__.py", line 13, in run_pylint
Run(sys.argv[1:])
File "/usr/lib/python2.7/site-packages/pylint-1.8.0-py2.7.egg/pylint/lint.py", line 1228, in __init__
linter.load_default_plugins()
File "/usr/lib/python2.7/site-packages/pylint-1.8.0-py2.7.egg/pylint/lint.py", line 453, in load_default_plugins
checkers.initialize(self)
File "/usr/lib/python2.7/site-packages/pylint-1.8.0-py2.7.egg/pylint/checkers/__init__.py", line 114, in initialize
register_plugins(linter, __path__[0])
File "/usr/lib/python2.7/site-packages/pylint-1.8.0-py2.7.egg/pylint/utils.py", line 992, in register_plugins
module = modutils.load_module_from_file(join(directory, filename))
File "/usr/lib/python2.7/site-packages/astroid/modutils.py", line 272, in load_module_from_file
return load_module_from_modpath(modpath, path, use_sys)
File "/usr/lib/python2.7/site-packages/astroid/modutils.py", line 233, in load_module_from_modpath
module = imp.load_module(curname, mp_file, mp_filename, mp_desc)
File "/usr/lib/python2.7/site-packages/pylint-1.8.0-py2.7.egg/pylint/checkers/python3.py", line 100, in <module>
class Python3Checker(checkers.BaseChecker):
File "/usr/lib/python2.7/site-packages/pylint-1.8.0-py2.7.egg/pylint/checkers/python3.py", line 501, in Python3Checker
'sys.version_info < (3, 0)',
File "/usr/lib/python2.7/site-packages/astroid/node_classes.py", line 624, in repr_tree
_repr_tree(self, result, set())
File "/usr/lib/python2.7/site-packages/singledispatch.py", line 209, in wrapper
return dispatch(args[0].__class__)(*args, **kw)
File "/usr/lib/python2.7/site-packages/astroid/node_classes.py", line 613, in _repr_node
depth)
File "/usr/lib/python2.7/site-packages/singledispatch.py", line 209, in wrapper
return dispatch(args[0].__class__)(*args, **kw)
File "/usr/lib/python2.7/site-packages/astroid/node_classes.py", line 613, in _repr_node
depth)
File "/usr/lib/python2.7/site-packages/singledispatch.py", line 209, in wrapper
return dispatch(args[0].__class__)(*args, **kw)
File "/usr/lib/python2.7/site-packages/singledispatch.py", line 190, in dispatch
impl = _find_impl(cls, registry)
File "/usr/lib/python2.7/site-packages/singledispatch.py", line 141, in _find_impl
mro = _compose_mro(cls, registry.keys())
File "/usr/lib/python2.7/site-packages/singledispatch.py", line 129, in _compose_mro
return _c3_mro(cls, abcs=mro)
File "/usr/lib/python2.7/site-packages/singledispatch.py", line 83, in _c3_mro
other_c3_mros = [_c3_mro(base, abcs=abcs) for base in other_bases]
File "/usr/lib/python2.7/site-packages/singledispatch.py", line 87, in _c3_mro
[explicit_bases] + [abstract_bases] + [other_bases]
File "/usr/lib/python2.7/site-packages/singledispatch.py", line 38, in _c3_merge
raise RuntimeError("Inconsistent hierarchy")
RuntimeError: Inconsistent hierarchy
@rogalski its exact steps & i can reproduce all the time
however, i will recheck tonight & share the finding
According to stacktrace, this code should be enough to trigger an issue.
import astroid
_ = [astroid.extract_node(x).repr_tree() for x in [
'sys.version_info[0] == 2',
'sys.version_info[0] < 3',
'sys.version_info == (2, 7)',
'sys.version_info <= (2, 7)',
'sys.version_info < (3, 0)',
]]
It would be great to have this reproduced. Maybe step-by-step instruction that works in some Docker image?
I tried pylint on Ubuntu 16.04 and I can report same problem as @p00j4 . I cannot even run 'pylint --version'.
Is there a support for ubuntu?
pip freeze gives following:
astroid==1.4.4
pylint==1.5.2
@ivan2angelov There is nothing os-specific about Pylint.
By any chance you have installed it via apt-get and not pip? Maybe external installation tools handle dependencies improperly?
I get AttributeError: module 'html' has no attribute 'html', when I try to run pylint --output-format=html. Other output formats work well.
@unstope Yes, it's fixed via cb6e4523ce001012202e5767c8029fdfad21af1e and will be included in next release (not sure if it'll be available in 1.7.x or 1.8.0).
Steps to reproduce RuntimeError: Inconsistent hierarchy (Python 2.7, CentOS 7.2):
Create a fresh virtualenv:
cd ~/virtualenvs; virtualenv test
Enter the virtualenv:
source ~/virtualenvs/test/bin/activate
Install pylint:
pip install pylint
which also installs pylint's dependencies, including singledispatch 3.4.0.3
Install an incompatible version of enum34:
pip install enum34==1.0.4
Now, running:
pylint --version
gives:
RuntimeError: Inconsistent hierarchy
Why?
This line of singledispatch: https://github.com/ambv/singledispatch/blob/master/singledispatch.py#L38
appears to assume that when "not candidate" is True, candidate has been set to None.
But with enum34 v1.0.4:
>>> import enum
>>> enum.version
(1, 0, 4)
>>> not enum.Enum
True
so if "candidate" is the "Enum" class, "not candidate" can be True, even when "candidate" is not None.
Why was an old version of enum34 in my PYTHONPATH? I created a virtualenv on CentOS 7.2, and allowed the virtualenv to access Python modules from my system Python installation, including enum34 v1.0.4.
On the CentOS 7.2 machine, I had the python-enum34-1.0.4-1.el7.noarch RPM installed. I don't recall installing it, but it appears to be a dependency of the python-cryptography-0.8.2-1.el7.x86_64 RPM, which I don't recall installing either.
As it turned out, we we're all chasing well-known issue.
See referenced pull request for fix.
Right now it's job for @PCManticore to review and merge those fixes and ship new minor release.
Doesn't the minimal astroid dependency version need to be bumped to 1.5.3 now (once it's released)?
Yes, it will be bumped.
Wysłane z iPhone'a
Dnia 14.05.2017 o godz. 23:30 Dmitry Erastov notifications@github.com napisał(a):
Doesn't the minimal astroid version need to be bumped to 1.5.3 now (once it's released)?
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub, or mute the thread.
thank you @rogalski 👍 the fix works, just confirmed.
i'm trying to understand what clues taken you in digging it & make out the enum34>=1.1.3 as fix.. its small but hard to find, your hint suggestions will help finding root cause next time
Users, please make sure to uninstall existing pylint & astroid versions before installing new
this should work
pip uninstall pylint; pip uninstall astroid
pip uninstall pylint; pip uninstall astroid (ensure they are uninstalled)
git clone https://github.com/PyCQA/pylint.git
cd pylint
python setup.py install
git clone https://github.com/PyCQA/astroid.git
cd astroid
python setup.py install
@p00j4 Changelog entry in PyCQA/astroid@56db400412fb36b5c2bbdb9ffb18b7c007f19b49 contains all references you need to understand what was happening here.
@p00j4, you can just pip install -U enum34 to upgrade enum34 to the latest version, which is easier than git cloning the latest astroid.
You said "i'm trying to understand what clues taken you in digging it & make out the enum34>=1.1.3".
I had Pylint working fine on my Mac laptop but giving "Inconsistent Hierarchy" on a CentOS 7 VM, so first I checked that the versions of pylint, astroid and singledispatch were the same on both systems, which they were, so I suspected that the version of another Python module dependency was different.
Then I added some logging near the exception:
$ diff -c singledispatch.py.original lib/python2.7/site-packages/singledispatch.py
*** singledispatch.py.original 2017-05-16 10:54:33.000000000 +1000
--- lib/python2.7/site-packages/singledispatch.py 2017-05-16 10:54:02.000000000 +1000
***************
*** 36,41 ****
--- 36,43 ----
else:
break
if not candidate:
+ import sys
+ sys.stderr.write("candidate: %s\n" % candidate)
raise RuntimeError("Inconsistent hierarchy")
result.append(candidate)
which resulted in:
$ pylint --version
candidate: <enum 'Enum'>
...
line 41, in _c3_merge
raise RuntimeError("Inconsistent hierarchy")
RuntimeError: Inconsistent hierarchy
which gave the clue that there was a problem with the "Enum" class from the "enum" module.
thanks a lot James @wettenhj : the details gives good understanding now, highly appreciate your time and efforts in explaining 👍
With pylint 1.7.1 and python 2.7, using django-jenkins, I'm having the same issue than n8henrie (that was resolved by removing the html option in its pylintrc file). I think its django-jenkins that is using the html option for me. Downgrading to 1.6.5 works. I think a more informative error message for example, 'The html reporter does not exist any longer in pylint 1.7." would still be nice.
Traceback just in case :
Traceback (most recent call last):
File "/home/user/workspace/.env/bin/pylint", line 11, in <module>
sys.exit(run_pylint())
File "/home/user/workspace/.env/local/lib/python2.7/site-packages/pylint/__init__.py", line 13, in run_pylint
Run(sys.argv[1:])
File "/home/user/workspace/.env/local/lib/python2.7/site-packages/pylint/lint.py", line 1275, in __init__
args = linter.load_command_line_configuration(args)
File "/home/user/workspace/.env/local/lib/python2.7/site-packages/pylint/config.py", line 679, in load_command_line_configuration
(options, args) = self.cmdline_parser.parse_args(args=args)
File "/usr/lib/python2.7/optparse.py", line 1400, in parse_args
stop = self._process_args(largs, rargs, values)
File "/usr/lib/python2.7/optparse.py", line 1440, in _process_args
self._process_long_opt(rargs, values)
File "/usr/lib/python2.7/optparse.py", line 1515, in _process_long_opt
option.process(opt, value, values, self)
File "/home/user/workspace/.env/local/lib/python2.7/site-packages/pylint/config.py", line 308, in process
self.action, self.dest, opt, value, values, parser)
File "/usr/lib/python2.7/optparse.py", line 809, in take_action
self.callback(self, opt, value, parser, *args, **kwargs)
File "/home/user/workspace/.env/local/lib/python2.7/site-packages/pylint/config.py", line 556, in cb_set_provider_option
self.global_set_option(opt, value)
File "/home/user/workspace/.env/local/lib/python2.7/site-packages/pylint/config.py", line 560, in global_set_option
self._all_options[opt].set_option(opt, value)
File "/home/user/workspace/.env/local/lib/python2.7/site-packages/pylint/lint.py", line 514, in set_option
self._load_reporter()
File "/home/user/workspace/.env/local/lib/python2.7/site-packages/pylint/lint.py", line 478, in _load_reporter
modutils.get_module_part(qname))
File "/home/user/workspace/.env/local/lib/python2.7/site-packages/astroid/modutils.py", line 437, in get_module_part
context_file=context_file)
File "/home/user/workspace/.env/local/lib/python2.7/site-packages/astroid/modutils.py", line 338, in file_from_modpath
return file_info_from_modpath(modpath, path, context_file).location
File "/home/user/workspace/.env/local/lib/python2.7/site-packages/astroid/modutils.py", line 383, in file_info_from_modpath
return _spec_from_modpath(modpath, path, context)
File "/home/user/workspace/.env/local/lib/python2.7/site-packages/astroid/modutils.py", line 603, in _spec_from_modpath
found_spec = spec.find_spec(modpath, path)
File "/home/user/workspace/.env/local/lib/python2.7/site-packages/astroid/interpreter/_import/spec.py", line 279, in find_spec
submodule_path or path)
File "/home/user/workspace/.env/local/lib/python2.7/site-packages/astroid/interpreter/_import/spec.py", line 246, in _find_spec_with_path
raise ImportError('No module named %s' % '.'.join(module_parts))
ImportError: No module named html
@Pierre-Sassoulas please check your astroid version, it has to do with it.
theses combination works (tried, tested)
1.
pylint (1.8.0)
astroid (1.5.2)
enum34 (1.1.6)
python 2.7.11
pylint 1.6.4,
astroid 1.4.8
Python 2.7.11
pylint 1.7.1,
astroid 1.4.9
Python 2.7.11
django-jenkins versions would be changing astroid versions indirectly so you must be seeing the differnece
follow step by step if you want to use latest
https://github.com/PyCQA/pylint/issues/1388#issuecomment-301434682
@p00j4 thanks for the quick answer !
I tried :
pip uninstall pylint; pip uninstall astroid
pip uninstall pylint; pip uninstall astroid
pip install pylint==1.7.1
pip install astroid==1.4.9
I then got the following traceback during test :
Traceback (most recent call last):
File "/home/user/workspace/.env/bin/pylint", line 11, in <module>
sys.exit(run_pylint())
File "/home/user/workspace/.env/local/lib/python2.7/site-packages/pylint/__init__.py", line 13, in run_pylint
Run(sys.argv[1:])
File "/home/user/workspace/.env/local/lib/python2.7/site-packages/pylint/lint.py", line 1220, in __init__
linter.load_default_plugins()
File "/home/user/workspace/.env/local/lib/python2.7/site-packages/pylint/lint.py", line 453, in load_default_plugins
checkers.initialize(self)
File "/home/user/workspace/.env/local/lib/python2.7/site-packages/pylint/checkers/__init__.py", line 114, in initialize
register_plugins(linter, __path__[0])
File "/home/user/workspace/.env/local/lib/python2.7/site-packages/pylint/utils.py", line 992, in register_plugins
module = modutils.load_module_from_file(join(directory, filename))
File "/home/user/workspace/.env/local/lib/python2.7/site-packages/astroid/modutils.py", line 268, in load_module_from_file
return load_module_from_modpath(modpath, path, use_sys)
File "/home/user/workspace/.env/local/lib/python2.7/site-packages/astroid/modutils.py", line 229, in load_module_from_modpath
module = imp.load_module(curname, mp_file, mp_filename, mp_desc)
File "/home/user/workspace/.env/local/lib/python2.7/site-packages/pylint/checkers/python3.py", line 100, in <module>
class Python3Checker(checkers.BaseChecker):
File "/home/user/workspace/.env/local/lib/python2.7/site-packages/pylint/checkers/python3.py", line 501, in Python3Checker
'sys.version_info < (3, 0)',
AttributeError: 'module' object has no attribute 'extract_node'
If you can live without the last version until it reach pipy and you have django-djenkins this is working :
Python 2.7.12
pylint<1.7
django-jenkins==0.110.0
(Astroid is a dependency but if you want to be explicit it's astroid==1.4.9)
Pylint 1.7 needs astroid 1.5+
Dnia 23.05.2017 o godz. 17:04 Pierre Sassoulas notifications@github.com napisał(a):
@p00j4 thanks for the quick answer !
I tried :
pip uninstall pylint; pip uninstall astroid
pip uninstall pylint; pip uninstall astroid
pip install pylint==1.7.1
pip install astroid==1.4.9
I then got the following traceback during test :Traceback (most recent call last):
File "/home/user/workspace/.env/bin/pylint", line 11, in
sys.exit(run_pylint())
File "/home/user/workspace/.env/local/lib/python2.7/site-packages/pylint/__init__.py", line 13, in run_pylint
Run(sys.argv[1:])
File "/home/user/workspace/.env/local/lib/python2.7/site-packages/pylint/lint.py", line 1220, in __init__
linter.load_default_plugins()
File "/home/user/workspace/.env/local/lib/python2.7/site-packages/pylint/lint.py", line 453, in load_default_plugins
checkers.initialize(self)
File "/home/user/workspace/.env/local/lib/python2.7/site-packages/pylint/checkers/__init__.py", line 114, in initialize
register_plugins(linter, __path__[0])
File "/home/user/workspace/.env/local/lib/python2.7/site-packages/pylint/utils.py", line 992, in register_plugins
module = modutils.load_module_from_file(join(directory, filename))
File "/home/user/workspace/.env/local/lib/python2.7/site-packages/astroid/modutils.py", line 268, in load_module_from_file
return load_module_from_modpath(modpath, path, use_sys)
File "/home/user/workspace/.env/local/lib/python2.7/site-packages/astroid/modutils.py", line 229, in load_module_from_modpath
module = imp.load_module(curname, mp_file, mp_filename, mp_desc)
File "/home/user/workspace/.env/local/lib/python2.7/site-packages/pylint/checkers/python3.py", line 100, in
class Python3Checker(checkers.BaseChecker):
File "/home/user/workspace/.env/local/lib/python2.7/site-packages/pylint/checkers/python3.py", line 501, in Python3Checker
'sys.version_info < (3, 0)',
AttributeError: 'module' object has no attribute 'extract_node'
If you can live without the last version until it reach pipy and you have django-djenkins this is working :Python 2.7.12
pylint<1.7
django-jenkins==0.110.0
(Astroid is a dependency but if you want to be explicit it's astroid==1.4.9)—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
I received this error with pylint==1.7.1. Downgrading to pylint==1.5.2 fixed the problem.
Following @rogalski advice I tested with :
pylint 1.7.1,
astroid 1.5.2
Python 2.7.12
django-jenkins 0.110.0
I get the following trace :
Traceback (most recent call last):
File "/home/user/workspace/.env/bin/pylint", line 11, in <module>
sys.exit(run_pylint())
File "/home/user/workspace/.env/local/lib/python2.7/site-packages/pylint/__init__.py", line 13, in run_pylint
Run(sys.argv[1:])
File "/home/user/workspace/.env/local/lib/python2.7/site-packages/pylint/lint.py", line 1275, in __init__
args = linter.load_command_line_configuration(args)
File "/home/user/workspace/.env/local/lib/python2.7/site-packages/pylint/config.py", line 679, in load_command_line_configuration
(options, args) = self.cmdline_parser.parse_args(args=args)
File "/usr/lib/python2.7/optparse.py", line 1400, in parse_args
stop = self._process_args(largs, rargs, values)
File "/usr/lib/python2.7/optparse.py", line 1440, in _process_args
self._process_long_opt(rargs, values)
File "/usr/lib/python2.7/optparse.py", line 1515, in _process_long_opt
option.process(opt, value, values, self)
File "/home/user/workspace/.env/local/lib/python2.7/site-packages/pylint/config.py", line 308, in process
self.action, self.dest, opt, value, values, parser)
File "/usr/lib/python2.7/optparse.py", line 809, in take_action
self.callback(self, opt, value, parser, *args, **kwargs)
File "/home/user/workspace/.env/local/lib/python2.7/site-packages/pylint/config.py", line 556, in cb_set_provider_option
self.global_set_option(opt, value)
File "/home/user/workspace/.env/local/lib/python2.7/site-packages/pylint/config.py", line 560, in global_set_option
self._all_options[opt].set_option(opt, value)
File "/home/user/workspace/.env/local/lib/python2.7/site-packages/pylint/lint.py", line 514, in set_option
self._load_reporter()
File "/home/user/workspace/.env/local/lib/python2.7/site-packages/pylint/lint.py", line 478, in _load_reporter
modutils.get_module_part(qname))
File "/home/user/workspace/.env/local/lib/python2.7/site-packages/astroid/modutils.py", line 437, in get_module_part
context_file=context_file)
File "/home/user/workspace/.env/local/lib/python2.7/site-packages/astroid/modutils.py", line 338, in file_from_modpath
return file_info_from_modpath(modpath, path, context_file).location
File "/home/user/workspace/.env/local/lib/python2.7/site-packages/astroid/modutils.py", line 383, in file_info_from_modpath
return _spec_from_modpath(modpath, path, context)
File "/home/user/workspace/.env/local/lib/python2.7/site-packages/astroid/modutils.py", line 603, in _spec_from_modpath
found_spec = spec.find_spec(modpath, path)
File "/home/user/workspace/.env/local/lib/python2.7/site-packages/astroid/interpreter/_import/spec.py", line 279, in find_spec
submodule_path or path)
File "/home/user/workspace/.env/local/lib/python2.7/site-packages/astroid/interpreter/_import/spec.py", line 246, in _find_spec_with_path
raise ImportError('No module named %s' % '.'.join(module_parts))
ImportError: No module named html
@Pierre-Sassoulas somewhere pylint is invoked with option: output-format=html
@PCManticore I'm not sure what was underlying reason to remove html reporter, but maybe its removal should be reverted?
I had astroid==1.5.2 and enum34==1.0.4, upgraded to astroid==1.5.3 forced the update to enum34==1.1.6 and now is working
For me upgrading enum34 to 1.1.6 fixed the issue
Upgrading astroid and enum34 did not fix the problem for me.
Can you create minimal complete reproduction where we have this RuntimeError with new version of enum34?
Thanks in advance.
Dnia 17.06.2017 o godz. 05:51 Chris Spencer notifications@github.com napisał(a):
Upgrading astroid and enum34 did not fix the problem for me.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
I still get this with:
pylint==1.8.1
astroid==1.60
enum34==1.1.6
Steps to reproduce (on Ubuntu 16.04):
conda create -n test python=2.7
source activate test
pip install -U pylint
pylint
Output:
Traceback (most recent call last):
File "/home/px046/anaconda2/envs/robot/bin/pylint", line 11, in <module>
sys.exit(run_pylint())
File "/home/px046/anaconda2/envs/robot/lib/python2.7/site-packages/pylint/__init__.py", line 16, in run_pylint
Run(sys.argv[1:])
File "/home/px046/anaconda2/envs/robot/lib/python2.7/site-packages/pylint/lint.py", line 1266, in __init__
linter.load_default_plugins()
File "/home/px046/anaconda2/envs/robot/lib/python2.7/site-packages/pylint/lint.py", line 479, in load_default_plugins
checkers.initialize(self)
File "/home/px046/anaconda2/envs/robot/lib/python2.7/site-packages/pylint/checkers/__init__.py", line 119, in initialize
register_plugins(linter, __path__[0])
File "/home/px046/anaconda2/envs/robot/lib/python2.7/site-packages/pylint/utils.py", line 1033, in register_plugins
module = modutils.load_module_from_file(join(directory, filename))
File "/home/px046/anaconda2/lib/python2.7/site-packages/astroid/modutils.py", line 272, in load_module_from_file
return load_module_from_modpath(modpath, path, use_sys)
File "/home/px046/anaconda2/lib/python2.7/site-packages/astroid/modutils.py", line 233, in load_module_from_modpath
module = imp.load_module(curname, mp_file, mp_filename, mp_desc)
File "/home/px046/anaconda2/envs/robot/lib/python2.7/site-packages/pylint/checkers/python3.py", line 124, in <module>
class Python3Checker(checkers.BaseChecker):
File "/home/px046/anaconda2/envs/robot/lib/python2.7/site-packages/pylint/checkers/python3.py", line 566, in Python3Checker
'sys.version_info < (3, 0)',
File "/home/px046/anaconda2/lib/python2.7/site-packages/astroid/node_classes.py", line 837, in repr_tree
_repr_tree(self, result, set())
File "/home/px046/anaconda2/lib/python2.7/site-packages/singledispatch.py", line 210, in wrapper
return dispatch(args[0].__class__)(*args, **kw)
File "/home/px046/anaconda2/lib/python2.7/site-packages/astroid/node_classes.py", line 826, in _repr_node
depth)
File "/home/px046/anaconda2/lib/python2.7/site-packages/singledispatch.py", line 210, in wrapper
return dispatch(args[0].__class__)(*args, **kw)
File "/home/px046/anaconda2/lib/python2.7/site-packages/astroid/node_classes.py", line 826, in _repr_node
depth)
File "/home/px046/anaconda2/lib/python2.7/site-packages/singledispatch.py", line 210, in wrapper
return dispatch(args[0].__class__)(*args, **kw)
File "/home/px046/anaconda2/lib/python2.7/site-packages/singledispatch.py", line 191, in dispatch
impl = _find_impl(cls, registry)
File "/home/px046/anaconda2/lib/python2.7/site-packages/singledispatch.py", line 142, in _find_impl
mro = _compose_mro(cls, registry.keys())
File "/home/px046/anaconda2/lib/python2.7/site-packages/singledispatch.py", line 130, in _compose_mro
return _c3_mro(cls, abcs=mro)
File "/home/px046/anaconda2/lib/python2.7/site-packages/singledispatch.py", line 84, in _c3_mro
other_c3_mros = [_c3_mro(base, abcs=abcs) for base in other_bases]
File "/home/px046/anaconda2/lib/python2.7/site-packages/singledispatch.py", line 88, in _c3_mro
[explicit_bases] + [abstract_bases] + [other_bases]
File "/home/px046/anaconda2/lib/python2.7/site-packages/singledispatch.py", line 39, in _c3_merge
raise RuntimeError("Inconsistent hierarchy")
RuntimeError: Inconsistent hierarchy
I went through this entire thread multiple times and still could not overcome the Inconsistent hierarchy error. I tried every single alternative offered to no avail. I'm posting here only to offer yet another alternative. wettenhj above mentioned that the conditional if not candidate in the file singledispatch.py was evaluating to true when container was not None (there are other false values besides None, of course). Changing the source code to if candidate == None is a more explicit way of testing what the conditional actually cares about. Making this change immediately cleared up the problem for me.
@Omegastick please try with version of astroid as
5.x.x https://github.com/PyCQA/pylint/issues/1388#issuecomment-303365503
@p00j4 As far as I can see, the latest release of Astroid is 1.6.0. Is there another repository with major release 5 somewhere that I can't find?
This worked on python 3.6+
pylint 1.8.1,
astroid 1.6.0
Python 3.6.3
@jsmedmar Didnt work for me with your setup :-(
Installing pylint1.5.2 instead of 1.8.2 fixed the problem for me.
When running pylint -V I get the same 'RuntimeError: Inconsistent hierarchy' error
pip list tells me I am using:
astroid (1.6.1)
enum34 (1.1.6)
pylint (1.8.2)
pip (9.0.1)
I installed pylint using pip install pylint.
I also see that I satisfies all the requirements of pylint:
Requirement already satisfied: singledispatch; python_version < "3.4" in /usr/local/lib/python2.7/dist-packages (from pylint)
Requirement already satisfied: isort>=4.2.5 in /usr/local/lib/python2.7/dist-packages (from pylint)
Requirement already satisfied: configparser; python_version == "2.7" in /usr/local/lib/python2.7/dist-packages (from pylint)
Requirement already satisfied: backports.functools-lru-cache; python_version == "2.7" in /usr/local/lib/python2.7/dist-packages (from pylint)
Requirement already satisfied: mccabe in /usr/local/lib/python2.7/dist-packages (from pylint)
Requirement already satisfied: astroid<2.0,>=1.6 in /usr/local/lib/python2.7/dist-packages (from pylint)
Requirement already satisfied: six in /usr/lib/python2.7/dist-packages (from pylint)
Requirement already satisfied: futures in /usr/lib/python2.7/dist-packages (from isort>=4.2.5->pylint)
Requirement already satisfied: enum34>=1.1.3; python_version < "3.4" in ./.local/lib/python2.7/site-packages (from astroid<2.0,>=1.6->pylint)
Requirement already satisfied: wrapt in /usr/local/lib/python2.7/dist-packages (from astroid<2.0,>=1.6->pylint)
Requirement already satisfied: lazy-object-proxy in /usr/local/lib/python2.7/dist-packages (from astroid<2.0,>=1.6->pylint)
Installing collected packages: pylint
Successfully installed pylint-1.8.2
Tried many install / uninstalls with no luck...
Any help would be appreciated!
Full error stack:
pylint -V
Traceback (most recent call last):
File "/usr/local/bin/pylint", line 11, in <module>
sys.exit(run_pylint())
File "/usr/local/lib/python2.7/dist-packages/pylint/__init__.py", line 16, in run_pylint
Run(sys.argv[1:])
File "/usr/local/lib/python2.7/dist-packages/pylint/lint.py", line 1266, in __init__
linter.load_default_plugins()
File "/usr/local/lib/python2.7/dist-packages/pylint/lint.py", line 479, in load_default_plugins
checkers.initialize(self)
File "/usr/local/lib/python2.7/dist-packages/pylint/checkers/__init__.py", line 119, in initialize
register_plugins(linter, __path__[0])
File "/usr/local/lib/python2.7/dist-packages/pylint/utils.py", line 1033, in register_plugins
module = modutils.load_module_from_file(join(directory, filename))
File "/usr/local/lib/python2.7/dist-packages/astroid/modutils.py", line 272, in load_module_from_file
return load_module_from_modpath(modpath, path, use_sys)
File "/usr/local/lib/python2.7/dist-packages/astroid/modutils.py", line 233, in load_module_from_modpath
module = imp.load_module(curname, mp_file, mp_filename, mp_desc)
File "/usr/local/lib/python2.7/dist-packages/pylint/checkers/python3.py", line 124, in <module>
class Python3Checker(checkers.BaseChecker):
File "/usr/local/lib/python2.7/dist-packages/pylint/checkers/python3.py", line 566, in Python3Checker
'sys.version_info < (3, 0)',
File "/usr/local/lib/python2.7/dist-packages/astroid/node_classes.py", line 837, in repr_tree
_repr_tree(self, result, set())
File "/usr/local/lib/python2.7/dist-packages/singledispatch.py", line 210, in wrapper
return dispatch(args[0].__class__)(*args, **kw)
File "/usr/local/lib/python2.7/dist-packages/astroid/node_classes.py", line 826, in _repr_node
depth)
File "/usr/local/lib/python2.7/dist-packages/singledispatch.py", line 210, in wrapper
return dispatch(args[0].__class__)(*args, **kw)
File "/usr/local/lib/python2.7/dist-packages/astroid/node_classes.py", line 826, in _repr_node
depth)
File "/usr/local/lib/python2.7/dist-packages/singledispatch.py", line 210, in wrapper
return dispatch(args[0].__class__)(*args, **kw)
File "/usr/local/lib/python2.7/dist-packages/singledispatch.py", line 191, in dispatch
impl = _find_impl(cls, registry)
File "/usr/local/lib/python2.7/dist-packages/singledispatch.py", line 142, in _find_impl
mro = _compose_mro(cls, registry.keys())
File "/usr/local/lib/python2.7/dist-packages/singledispatch.py", line 130, in _compose_mro
return _c3_mro(cls, abcs=mro)
File "/usr/local/lib/python2.7/dist-packages/singledispatch.py", line 84, in _c3_mro
other_c3_mros = [_c3_mro(base, abcs=abcs) for base in other_bases]
File "/usr/local/lib/python2.7/dist-packages/singledispatch.py", line 88, in _c3_mro
[explicit_bases] + [abstract_bases] + [other_bases]
File "/usr/local/lib/python2.7/dist-packages/singledispatch.py", line 39, in _c3_merge
raise RuntimeError("Inconsistent hierarchy")
This problem seems to be more related to singledispatch rather than enum as we assumed with our earlier fix.
Even with this, we definitely need some way to reproduce this bug, a Docker container where this problem occurs will be ideal, as I can't reproduce this bug on my machine with the given requirements.
Solved this issue i just use python 2.7 and worked for me earlier i was working on 3.5
Installing an older version of pylint removed the Inconsistent hierarchy error. I believe 1.9.2 was what I had installed before going to 1.7.1. I picked 1.7.1 just because we have a similar machine with that version that did not have this issue.
$ pylint --version
No config file found, using default configuration
pylint 1.7.1,
astroid 1.6.5
Python 2.7.5 (default, Aug 4 2017, 00:39:18)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-16)]
My python path was picking up an old version of enum. Fixing that fixed this issue for me.
@jeffgabhart Thanks for confirming that this is an enum bug.
I have the same issue with Python 3.7.4, astroid 2.3.3 and pylint 2.4.4.
python --versionPython 3.7.4
python -m venv .venv-testsource .venv-test/bin/activatepip install pylint[...]
pip freezeastroid==2.3.3
isort==4.3.21
lazy-object-proxy==1.4.3
mccabe==0.6.1
pylint==2.4.4
six==1.13.0
typed-ast==1.4.0
wrapt==1.11.2
pylint --output-format=html src/main.pyTraceback (most recent call last):
File "/usr/lib/python3.7/site-packages/pylint/lint.py", line 657, in _load_reporter
reporter_class = self._load_reporter_class()
File "/usr/lib/python3.7/site-packages/pylint/lint.py", line 667, in _load_reporter_class
reporter_class = getattr(module, class_name)
AttributeError: module 'html' has no attribute 'html'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/bin/pylint", line 10, in <module>
sys.exit(run_pylint())
File "/usr/lib/python3.7/site-packages/pylint/__init__.py", line 20, in run_pylint
Run(sys.argv[1:])
File "/usr/lib/python3.7/site-packages/pylint/lint.py", line 1594, in __init__
args = linter.load_command_line_configuration(args)
File "/usr/lib/python3.7/site-packages/pylint/config.py", line 778, in load_command_line_configuration
(options, args) = self.cmdline_parser.parse_args(args=args)
File "/usr/lib/python3.7/optparse.py", line 1387, in parse_args
stop = self._process_args(largs, rargs, values)
File "/usr/lib/python3.7/optparse.py", line 1427, in _process_args
self._process_long_opt(rargs, values)
File "/usr/lib/python3.7/optparse.py", line 1501, in _process_long_opt
option.process(opt, value, values, self)
File "/usr/lib/python3.7/site-packages/pylint/config.py", line 356, in process
return self.take_action(self.action, self.dest, opt, value, values, parser)
File "/usr/lib/python3.7/optparse.py", line 805, in take_action
self.callback(self, opt, value, parser, *args, **kwargs)
File "/usr/lib/python3.7/site-packages/pylint/config.py", line 642, in cb_set_provider_option
self.global_set_option(opt, value)
File "/usr/lib/python3.7/site-packages/pylint/config.py", line 646, in global_set_option
self._all_options[opt].set_option(opt, value)
File "/usr/lib/python3.7/site-packages/pylint/lint.py", line 702, in set_option
self._load_reporter()
File "/usr/lib/python3.7/site-packages/pylint/lint.py", line 659, in _load_reporter
raise exceptions.InvalidReporterError(name)
pylint.exceptions.InvalidReporterError: html
By the way, what the point with enum34? This module is not installed as a pylint dependency (but even if I install it manually, this doesn't fix the problem).
Most helpful comment
@p00j4, you can just
pip install -U enum34to upgrade enum34 to the latest version, which is easier than git cloning the latest astroid.You said "i'm trying to understand what clues taken you in digging it & make out the enum34>=1.1.3".
I had Pylint working fine on my Mac laptop but giving "Inconsistent Hierarchy" on a CentOS 7 VM, so first I checked that the versions of pylint, astroid and singledispatch were the same on both systems, which they were, so I suspected that the version of another Python module dependency was different.
Then I added some logging near the exception:
which resulted in:
which gave the clue that there was a problem with the "Enum" class from the "enum" module.