microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.87k stars 29.15k forks source link

Python: pip install should not use `--user` in a virtualenv #43347

Closed acdha closed 6 years ago

acdha commented 6 years ago

Issue Type

Bug

Description

The Python extension helpfully offers to install linters. Unfortunately it always includes --user in the command and that fails when using a virtualenv:

$ /Users/cadams/.virtualenvs/inventory-prototype-jspu0YL7/bin/python3.6 -m pip install -U pylint --user
Can not perform a '--user' install. User site-packages are not visible in this virtualenv.

VS Code Info

VS Code version: Code 1.20.0 (c63189deaa8e620f650cc28792b8f5f3363f2c5b, 2018-02-07T17:02:34.244Z) OS version: Darwin x64 17.4.0

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-4650U CPU @ 1.70GHz (4 x 1700)| |Load (avg)|2, 2, 2| |Memory (System)|8.00GB (0.03GB free)| |Process Argv|/Users/cadams/Applications/Visual Studio Code.app/Contents/MacOS/Electron .| |Screen Reader|no| |VM|0%|
Extensions (21) Extension|Author (truncated)|Version ---|---|--- xml|Dot|1.9.2 EditorConfig|Edi|0.12.0 beautify|Hoo|1.3.0 vscode-docker|Pet|0.0.24 django-html|bib|1.2.0 vscode-eslint|dba|1.4.5 prettier-vscode|esb|1.1.3 Python-autopep8|him|1.0.2 Go|luk|0.6.74 MagicPython|mag|1.0.12 vscode-apache|mrm|1.1.1 vscode-scss|mrm|0.6.2 vscode-stylefmt|mrm|2.5.0 python|ms-|2018.1.0 cpptools|ms-|0.14.6 rust|rus|0.3.2 preview-vscode|sea|1.4.2 stylelint|shi|0.32.0 rewrap|stk|1.7.0 vcl|tho|0.1.2 shellcheck|tim|0.3.0

Reproduces only with extensions

psych0der commented 6 years ago

Facing the same issue since 1.19

psych0der commented 6 years ago

Btw found the solution. There's a setting you have to toggle to remove --user flag while installation. Set "python.globalModuleInstallation": true in your user settings json.

vscodebot[bot] commented 6 years ago

This issue is caused by an extension, please file it with the repository (or contact) the extension has linked in its overview in VS Code or the marketplace for VS Code. See also our issue reporting guidelines.

Happy Coding!

JacksonKearl commented 4 years ago

From @guettli in https://github.com/microsoft/vscode/issues/108337:

Since the problem still exists, I created a corresponding issue in the vscode-python repo microsoft/vscode-python#14327