[python] Error message "Linter pylint is not installed"

I want to run Python code in Microsoft Visual Studio Code but it gives an error:

Linter pylint is not installed

I installed:

  • The Visual Studio Code Python extension
  • Python 3
  • Anaconda

How can I install Pylint?

This question is related to python visual-studio-code pylint

The answer is


Try doing this if you're running Visual Studio Code on a Windows machine and getting this error (I'm using Windows 10).

Go to the settings and change the Python path to the location of YOUR python installation.

I.e.,

Change: "python.pythonPath": "python"

To: "python.pythonPath": "C:\\Python36\\python.exe"

And then: Save and reload Visual Studio Code.

Now when you get the prompt telling you that "Linter pylint is not installed", just select the option to 'install pylint'.

Since you've now provided the correct path to your Python installation, the Pylint installation will be successfully completed in the Windows PowerShell Terminal.


I had the same problem. Open the cmd and type:

python -m pip install pylint

If you're working in a virtual environment (virtualenv), you'll definitely need to update the python.lintint.pylintPath setting (and probably the python.pythonPath setting, as well, if you haven't already) if you want linting to work, like this:

// File "settings.json" (workspace-specific one is probably best)
{
    // ...
    "python.linting.pylintPath": "C:/myproject/venv/Scripts/pylint.exe",
    "python.pythonPath": "C:/myproject/venv/Scripts/python.exe",
    // ...
}

That's for Windows, but other OSs are similar. The .exe extension was necessary for it to work for me on Windows, even though it's not required when actually running it in the console.

If you just want to disable it, then use the python.linting.pylintEnabled": false setting as mentioned in Ben Delaney's answer.


If you're using pipenv then you just have to

pipenv install pylint

to install Pylint to your virtual environment

pipenv shell

to activate the environment and thus make Pylint available. Then start code in that environment

code .

Boom! you're good to code ;-)


I had this issue as well and found the error's log regarding permissions or something.

So, I ran Visual Studio Code with administrator privileges and ran "pip install pylint" in the terminal. Then the error seemed to be fixed.

(I run Visual Studio Code on Windows 10.)


The following fix works for me. In a Ubuntu 16.04 (Xenial Xerus) terminal, type:

$ pip3 install pylint
$ sudo apt install python3-pip

If your Python 3 is installed in the /usr/bin/python3.6 folder, run the following command, and it should work fine. Last, make sure your Visual Studio Code is running the Python 3 interpreter, not Python 2.7 which is default in Ubuntu.

$ /usr/bin/python3.6 -m pip install -U pylint

If you are using MacPorts, you may need to activate package pylint and autopep8 after you've installed them, i.e.:

sudo port select pylint pylint36
sudo port select autopep8 autopep8-36

If you're reading this in (or after) 2020 and are still having issues with Pylint in Visual Studio Code for Windows 10, here is a quick solution that worked for me:

Make sure Python is installed for Windows, and note the installation path.

From an elevated command prompt, go to the installation directory for Python:

cd C:\Users\[username]\Programs\Python\Python[version]\

Install Pylint:

python -m pip install pylint

Pylint is now installed in the 'Python\Python[version]\Scripts\' directory, note/copy the path for later.

Open settings in Visual Studio Code: Ctrl + ','

Type in python.defaultInterpreterPath in the search field, and paste in the path to the Windows installation path for Python:

(e.g. C:\Users\[username]\AppData\Local\Programs\Python\Python[version]\python.exe)

Do the same for python.pythonPath, using the same path as above.

Lastly, search for python.linting.pylintpath and paste the path to pylint.exe.

Restart Visual Studio Code

That got rid of the warnings for me, and successfully enabled pylinting.


I also had this problem. If you also have Visual Studio installed with the Python extension, the system will want to use Studio's version of Python. Set the Environment Path to the version in Studio's Shared folder. For me, that was:

C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36_64\

After that, run

python -m pip install pylint

from a command prompt with Administrator rights.


Check the path Pylint has been installed to, by typing which pylint on your terminal.

You will get something like: /usr/local/bin/pylint

Copy it.

Go to your Visual Studio Code settings in the preferences tab and find the line that goes

"python.linting.pylintPath": "pylint"

Edit the line to be

"python.linting.pylintPath": "/usr/local/bin/pylint",

replacing the value "pylint" with the path you got from typing which pylint.

Save your changes and reload Visual Studio Code.


A similar issue happened to me after I a completely reinstalled Python. Opening the settings.json by Ctrl+ ? Shift+P:

                             

and I saw that I had set the default linter to

"python.linting.pylintPath": "pylint_django"

so opening a terminal (e.g., Ctrl + ?Shift + ~) and the installing

pip install pylint_django

solved the problem.


I would like to add my trials and my solution following rob3c's answer.

PS: My solution only concerns Windows users.

The problem:

I tried the following settings without success:

// settings.json
"python.linting.pylintPath": ${workspaceFolder}\\_tools\\python3\\Scripts\\pylint

and

"python.linting.pylintPath": ${workspaceFolder}\\_tools\\python3\\Scripts\\pylint.exe

I always had the following error message:

Linter 'pylint' is not installed. Please install it or select another linter".
Error: spawn c:\WS\myproject\_tools\python3\Scripts\pylint ENOENT

Even with a pylint file in my folder:

dir c:\WS\myproject\_tools\python3\Scripts\
...
05.07.2017  09:34 AM                52 pylint    # ! no pylint.exe !
...

As my toolchain is based on MSYS, the Pylint installed is without pylint.exe.

The content of _tools\python3\Scripts\pylint file:

#!python
from pylint import run_pylint
run_pylint()

The solution

My workaround was to create a batch file .vscode\pylint.bat with the following contents:

%PYTHON3_EXE% _prefix\python3\Scripts\pylint %*

(%PYTHON3_EXE% is an environment variable to the Python 3 interpreter C:\Python34\python.exe)

And to configure .vscode\settings.json as follows:

// settings.json
"python.linting.pylintPath": "${workspaceFolder}\\.vscode\\pylint.bat",

Result

Log from OUTPUT --> Python:

##########Linting Output - pylint##########

c:\WS\myproject> C:\Python34\python.exe _tools\python3\Scripts\pylint
--rcfile c:\WS\framework\pylintrc
--msg-template='{line},{column},{category},{msg_id}:{msg}'
--reports=n
--output-format=text
c:\WS\myproject\myScriptToLint.py
Using config file c:\WS\myproject\pylintrc

------------------------------------

Your code has been rated at 10.00/10

? Visual Studio Code uses the Pylint version from my toolchain!


I had this issue this weekend. It seems to have happened because I opened my project in my venv, but I also opened a second instance outside of the venv. I never closed either instance - I just shut my PC down and let Windows do the work. When I went back and called up Visual Studio Code from within my venv, both the project, and the other non-venv window opened. That's when I started seeing this error.

To fix it, I had to remove the \.vscode folder from the workspace directory.


This solved the issue for me:

pip install pylint -U

I.e., upgrade the pylint package.


Examples related to python

programming a servo thru a barometer Is there a way to view two blocks of code from the same file simultaneously in Sublime Text? python variable NameError Why my regexp for hyphenated words doesn't work? Comparing a variable with a string python not working when redirecting from bash script is it possible to add colors to python output? Get Public URL for File - Google Cloud Storage - App Engine (Python) Real time face detection OpenCV, Python xlrd.biffh.XLRDError: Excel xlsx file; not supported Could not load dynamic library 'cudart64_101.dll' on tensorflow CPU-only installation

Examples related to visual-studio-code

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined raised when starting react app Visual Studio Code PHP Intelephense Keep Showing Not Necessary Error Cannot edit in read-only editor VS Code How to setup virtual environment for Python in VS Code? Pylint "unresolved import" error in Visual Studio Code Why do I keep getting Delete 'cr' [prettier/prettier]? How to set up devices for VS Code for a Flutter emulator VSCode single to double quote automatic replace js 'types' can only be used in a .ts file - Visual Studio Code using @ts-check How can I clear the terminal in Visual Studio Code?

Examples related to pylint

Pylint "unresolved import" error in Visual Studio Code Error message "Linter pylint is not installed" Is it possible to ignore one single specific line with Pylint? How do I disable "missing docstring" warnings at a file-level in Pylint? How do I disable a Pylint warning? PyLint "Unable to import" error - how to set PYTHONPATH? Pylint, PyChecker or PyFlakes? Python: avoiding pylint warnings about too many arguments