I'm having a problem with running pylint from inside vim (which you need to do if you are using the syntastic plugin).
For example :!pylint --version
crashes with this traceback:
Traceback (most recent call last):
File "/home/seanh/.virtualenvs/ckan/bin/pylint", line 5, in <module>
from pkg_resources import load_entry_point
File "/home/seanh/.virtualenvs/ckan/lib/python2.7/site-packages/pkg_resources.py", line 2736, in <module>
add_activation_listener(lambda dist: dist.activate())
File "/home/seanh/.virtualenvs/ckan/lib/python2.7/site-packages/pkg_resources.py", line 698, in subscribe
callback(dist)
File "/home/seanh/.virtualenvs/ckan/lib/python2.7/site-packages/pkg_resources.py", line 2736, in <lambda>
add_activation_listener(lambda dist: dist.activate())
File "/home/seanh/.virtualenvs/ckan/lib/python2.7/site-packages/pkg_resources.py", line 2274, in activate
list(map(declare_namespace, self._get_metadata('namespace_packages.txt')))
File "/home/seanh/.virtualenvs/ckan/lib/python2.7/site-packages/pkg_resources.py", line 1870, in declare_namespace
path = sys.modules[parent].__path__
KeyError: 'repoze.who'
I've also seen the same error prospector running inside Vim.
But I cannot reproduce the error from outside of Vim. In a shell. If I activate my Python virtual environment in a shell then run pylint --version
I get:
$ pylint --version
Warning: option include-ids is deprecated and ignored.
Warning: option symbols is deprecated and ignored.
pylint 1.3.1,
astroid 1.2.1, common 0.62.1
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
[GCC 4.8.2]
If I then run vim
in the same shell and do :!pylint --version
in Vim I get the traceback above. Quit Vim and run pylint --version
in the shell again and it's fine.
There must be something different between the environment that vim runs the command in and my shell environment, that is triggering the crash. But I don't know how to investigate this, hence this question with the vim tag.
repoze.who
is also implicated here. If I destroy my virtualenv and create a new virtualenv with nothing but pylint and other syntax checkers installed in it, then everything works fine both inside and outside of vim. But if I then pip install repoze.who==1.0.19
in the virtualenv then the pylint crash above reappears when running :!pylint --version
in vim (but not when running it in my shell).
Vim version 7.4 installed from package on Ubuntu 14.04.
This seems to be a problem with repoze.who 1.0.19. pip install -U repoze.who==2.2
in the virtualenv gets rid of the problem. Weirdly you can then do pip install -U repoze.who==1.0.19
and downgrade it, and the pylint crash is still gone. I never got to the bottom of what exactly is causing it, but I suspect it may be something to do with this item from the repoze.who 2.0a1 changelog: Remove ez_setup.py and dependency on it in setup.py (support distribute).