Search code examples
pythoninstallationpippylint

which files get installed when `pip` installing `pylint`?


I ran pip install --user pylint and did not notice any error. However, pylint foo.py throws the error pylint: command not found.

Comparing with the GitHub repository it looks like I only have a subset on my computer (see below). At any rate, I don't have any file named pylint.

Is there anything I can install by hand if it didn't work straight out-of-the-box?

Here are the files that I have:

under /Users/erc/Library/Python/2.7/lib/python/site-packages/pylint:
__init__.py
__init__.pyc
__main__.py
__main__.pyc
__pkginfo__.py
__pkginfo__.pyc
checkers
config.py
config.pyc
epylint.py
epylint.pyc
exceptions.py
exceptions.pyc
extensions
graph.py
graph.pyc
interfaces.py
interfaces.pyc
lint.py
lint.pyc
pyreverse
reporters
test
testutils.py
testutils.pyc
utils.py
utils.pyc

(I am not listing the files within the subdirectories checkers, etc.)

and there is also another folder, /Users/erc/Library/Python/2.7/lib/python/site-packages/pylint-1.9.2.dist-info with
DESCRIPTION.rst
INSTALLER
METADATA
RECORD
WHEEL
entry_points.txt
metadata.json
top_level.txt


Solution

  • It could be more helpful if errors/output from your pip run was shared, I guess there are more details in pip logs. Usually something like this is a good hint where you can find the errors:

    Command "python setup.py egg_info" failed with error code 1 in /some/path
    

    I'd first check if pylint is actually installed

    pip list | grep pylint
    

    If not, then follow the errors from pip install. But if pylint is available yet running pylint is the problem (command not found), it's because the command line entry point is not installed properly. Then it may be run like this:

    python -m pylint --help
    

    On a side note, generally using virtual environments are a nice way to install packages/software on user accessible paths, and to install executable programs (as opposed to library packages) to local user accessible paths, I suggest using something like pipsi instead of pip, which handles creating/activating the virtualenv automatically.

    Update

    As discussed on the comments, since your current installation is OK and it's just the command line entry point missing, you could add a Python file (with exec permissions) somewhere in your path for each of the entry points, like this:

    #!/usr/bin/env python
    from pylint import run_pylint
    if __name__ == '__main__':
        run_pylint()