# Fix VS Code Python Linting With Pylint Not Found in Path
VS Code shows no linting errors for your Python code, even though you know there are issues. The Python output panel reveals:
Linter 'pylint' is not installed. Please install it or select another linter.Or:
pylint: command not foundThe linter is either not installed in the active environment or VS Code cannot find it.
Step 1: Verify Pylint Is Installed
Check if pylint is installed in the current Python environment:
```bash # Check which Python VS Code is using # Look at the status bar: Python 3.11.x ('venv': venv)
# Then check that environment /path/to/venv/bin/python -m pylint --version ```
If pylint is not installed:
/path/to/venv/bin/python -m pip install pylintAlways install linting tools in the project's virtual environment, not globally. This ensures VS Code finds the correct version.
Step 2: Configure Linter Path in VS Code
If pylint is installed in a non-standard location, configure the path:
{
"python.linting.pylintPath": "/path/to/venv/bin/pylint"
}Or use the module execution approach (recommended):
{
"python.linting.pylintPath": "pylint"
}When set to just "pylint", VS Code runs it as a module using the selected Python interpreter:
python -m pylintThis automatically uses the pylint from the active environment.
Step 3: Enable Linting in Settings
Ensure linting is enabled:
{
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.linting.lintOnSave": true
}If python.linting.enabled is false, no linter runs regardless of installation.
Step 4: Check for Conflicting Linters
VS Code supports multiple linters, but running more than one can cause confusion:
{
"python.linting.pylintEnabled": true,
"python.linting.flake8Enabled": false,
"python.linting.mypyEnabled": false
}Disable all linters except the one you want to use. Having multiple enabled can cause duplicate error messages and performance issues.
Step 5: Pylint Configuration File
Pylint may fail silently if its configuration file has errors. Check for .pylintrc or pyproject.toml in your project:
pylint --generate-rcfile > .pylintrcTest pylint manually:
pylint your_file.pyIf this produces errors about the configuration file, fix or remove it:
rm .pylintrcStep 6: Using Ruff as an Alternative
Pylint is slow on large codebases. Consider using Ruff, which is 10-100x faster:
pip install ruffConfigure in VS Code:
{
"python.linting.pylintEnabled": false,
"[python]": {
"editor.codeActionsOnSave": {
"source.fixAll.ruff": "explicit",
"source.organizeImports.ruff": "explicit"
}
}
}Install the Ruff extension from the VS Code marketplace. Ruff replaces both Pylint (linting) and isort (import sorting) with a single tool.
Step 7: Linter Output for Debugging
Open the Python output panel:
View > Output > Select "Python" from dropdownThis shows the exact lint command VS Code runs and its output:
> pylint --msg-template='{line},{column},{category},{symbol}:{msg}' --reports=n --output-format=text src/main.py
cwd: /path/to/projectIf you see pylint: command not found, the linter is not in the PATH of the selected Python interpreter.
Step 8: Workspace vs User Settings
Check that pylint is enabled in the correct settings scope. User settings apply globally, workspace settings apply to the current project:
# Check workspace settings
cat .vscode/settings.json | grep lintWorkspace settings override user settings. If linting is disabled in .vscode/settings.json, it is disabled for the entire project regardless of user settings.
Step 9: Pylint Import Errors
Pylint may report import errors for valid imports:
E0401: Unable to import 'mypackage' (import-error)This happens when pylint cannot find the package in the Python path. Fix by configuring the Python path for pylint:
{
"python.linting.pylintArgs": [
"--init-hook",
"import sys; sys.path.append('./src')"
]
}Or use a .pylintrc file:
[MASTER]
init-hook='import sys; sys.path.append("./src")'This tells pylint where to find your project's modules.