VSCode: There is no Pip installer available in the selected environment

ashgromnies picture ashgromnies · Jun 22, 2018 · Viewed 83.6k times · Source

I'm trying to run the autopep8 linter on a Python file in VSCode.

I've followed the instructions here: https://code.visualstudio.com/docs/python/environments and selected my interpreter (⇧⌘P): /usr/local/bin/python

I then try to format my code, and VSCode says autopep8 isn't installed, and can be installed via Pip. However, when I try to install via Pip, it says There is no Pip installer available in the selected environment.

I then tried launching a terminal in the current environment by selecting Python: Create Terminal from the Command Palette.

The terminal opens fine, pip is present, and I'm even able to pip install autopep8 in the terminal that opened in VSCode, but when I try running the Format Document command I get the same errors that autopep8 and pip aren't available in the environment.

Answer

sean.wu picture sean.wu · Oct 5, 2018

On Ubuntu16.04, I worked with Python3 in vscode and

apt-get install python3-pip

solves my problem.

That's because I discover that: Under my terminal, I type the pip -V. It displays it's for Python2, not for Python3.