How to stop autopep8 not installed messages in Code

I have also encountered this problem in my computer with Ubuntu 18.04. It turns out that the python extension need some settings. My solution is:

  1. Go to Python extension's extension setting.
  2. Find Python>Formatting:Autopep8 Path term
  3. Add the full path of the autopep8 that you have installed.

pip install pep8   
pip install --upgrade autopep8

or

"python.formatting.provider": "autopep8"

You will receive this prompt if

  1. You have "formatOnSave" turned on as a setting
  2. You selected autopep8 as your formatter
  3. The Python extension can't find autopep8

So the options are:

  1. Turn off formatting on save
  2. Make sure you successfully installed autopep8 into your environment or you specified the path to autopep8 in your settings

My guess is there's an installation failure because you are using a globally installed interpreter and you're not allowed to install where pip wants to put autopep8.


Adding this in for anyone who has this issue running WSL on Windows. You need to either need to be connected to Remote WSL in order to access pep8 in your WSL Python installation or install Python and pep8 on Windows since VS Code will be looking on Windows. No matter how magnificently installed autopep8 may be in WSL, VS Code won't find it.

So my full solution was:

  1. If you don't have Python installed in Windows, do that (dare I suggest you can even get it in the Microsoft Store!)
  2. Install autopep8 in your Windows Python instance. e.g., from Command Prompt:
    python3 -m pip install autopep8
    
  3. Follow the instructions in any of the other responses if you're still having issues.