Home > Mobile >  Install pip3 and flake8 in conda venv on VS Code
Install pip3 and flake8 in conda venv on VS Code

Time:02-19

Goal: get flake8 linting working

I setup a new conda venv. I try to select Flake8 as my linter in Command Palette.

Update: I've installed pip and flake8. However, VS Code prompts:

  • Linter flake8 is not installed
  • There is no pip installer in the selected environment

Ubuntu Bash Terminal:

(sdg) me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/foo/bar$ sudo apt-get install python3-pip
Reading package lists... Done
Building dependency tree       
Reading state information... Done
python3-pip is already the newest version (20.0.2-5ubuntu1.6).
0 upgraded, 0 newly installed, 0 to remove and 124 not upgraded.

(sdg) me@PF2DCSXD:/mnt/c/Users/me/Documents/GitHub/foo/bar$ pip install flake8
Requirement already satisfied: flake8 in /home/me/.local/lib/python3.8/site-packages (4.0.1)
Requirement already satisfied: pyflakes<2.5.0,>=2.4.0 in /home/me/.local/lib/python3.8/site-packages (from flake8) (2.4.0)
Requirement already satisfied: pycodestyle<2.9.0,>=2.8.0 in /home/me/.local/lib/python3.8/site-packages (from flake8) (2.8.0)
Requirement already satisfied: mccabe<0.7.0,>=0.6.0 in /home/me/.local/lib/python3.8/site-packages (from flake8) (0.6.1)
WARNING: You are using pip version 21.3.1; however, version 22.0.3 is available.
You should consider upgrading via the '/home/me/miniconda3/envs/sdg/bin/python -m pip install --upgrade pip' command.

.vscode/settings.json:

{
    "python.linting.flake8Enabled": true,
    "python.linting.enabled": true
}

I've been following along to these solutions with no luck

Install Pip

Use Flake8

CodePudding user response:

I suggest you create a conda environment properly:

conda create -n "myenv" python

then, activate the environment:

conda activate myenv

finally, install flake:

pip install flake8
  • Related