11

There's a lot of questions around this, so it might be a duplicate, but I can't find a solution, so here goes..

I want to use pylint with atom. If I use the recommended pip install --user pylint it seems to work but atom can't find and neither can I; which pylint and whereis pylintreturn nothing. The same thing goes if I use pip3.

If I go against wisdom and use sudo pip install pylint it is found but now I get a different error with atom: unable to determine environment.

Any suggestions?

jorgen
  • 3,425
  • 4
  • 31
  • 53
  • Possible duplicate of [-bash: doc2dash: command not found in OS X Mavericks](https://stackoverflow.com/questions/22271232/bash-doc2dash-command-not-found-in-os-x-mavericks) – phd Dec 29 '17 at 14:55
  • See also https://stackoverflow.com/a/35524522/7976758 – phd Dec 29 '17 at 14:56
  • Is this the same as the linter-pylint plugin for Atom? – Natsfan Jan 05 '18 at 21:51
  • @jmh If you mean if this resolved my other question about getting linter-pylint to work then no – jorgen Jan 05 '18 at 23:19
  • Related: https://stackoverflow.com/questions/45956359/zsh-command-not-found-flake8-but-flake8-is-installed – jdhao Nov 27 '19 at 14:00

2 Answers2

14

I have met exactly the same issue as you. Pylint is installed via pip install --user pylint since pip is managed by the system administrator and I have no permission to install packages in the system Python package directory.

The reason pylint is not found is just that you haven't added the folder where pylint is installed to the system PATH. The output of pip show --files pylint has something like the following:

Location: /home/xxx/.local/lib/python3.6/site-packages
Requires: mccabe, astroid, isort
Required-by: 
Files:
  ../../../bin/epylint
  ../../../bin/pylint
  ../../../bin/pyreverse
  ../../../bin/symilar

So pylint is installed in $HOME/.local/bin, you should add this folder to PATH:

export PATH=$HOME/.local/bin:$PATH

After that, you should be able to use pylint normally.

Paolo Rovelli
  • 9,396
  • 2
  • 58
  • 37
jdhao
  • 24,001
  • 18
  • 134
  • 273
13

If which pylint does not find the executable but the package is installed, it is not in your PATH. Uninstall pylint you have installed with sudo and reinstall it as user, now run

$ PATH=$HOME/Library/Python/2.7/bin:$PATH which pylint

It should be found now. After you have verified pylint executable is accessible, edit your .bash_profile and add the two lines at the bottom:

PATH="${HOME}/Library/Python/2.7/bin:${PATH}"
export PATH
hoefling
  • 59,418
  • 12
  • 147
  • 194