Skip to content

Virtual environments not listed with Python: Select Interpreter #1192

Closed

Description

This seems to have stopped working in a recent version of either VS Code or the Python extension. I believe it worked about 1 month ago.

Environment data

  • VS Code version: 1.21.1
  • Extension version (available under the Extensions sidebar): 2018.2.1 (09 Mar 2018)
  • OS and version: MacOS High Sierra 10.13.3
  • Python version (& distribution if applicable, e.g. Anaconda): 2.7 (system) / 3.6 (Homebrew)
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): venv
  • Relevant/affected Python packages and their versions: N/A

Actual behavior

Python: Select Interpreter menu only shows 3 interpreters - /usr/bin/python2.7, /usr/local/bin/python3, /User/kristofferb/.venv/flask-rest-test/bin/python

The flask-rest-test entry is loaded (title is "Python 3.6.4 (venv)"), however this resides under another .venv folder I've previously used (not the one specified in python.venvPath). Why this works, is not clear to me, it might be because I've specified this manually in another project.

Expected behavior

All interpreters under the specified python.venvPath is made available, not just system (and one which is recently used)

Steps to reproduce:

  1. python -m venv ~/.venv2/test_vscode_venv
  2. mkdir test_vscode_venv; echo "import this" > test_vscode_venv/test.py; code test_vscode_venv
  3. change User Settings to {"python.venvPath": "~/.venv2/"}
  4. open Python: Select Interpreter menu - the interpreteres shown are those under Actual behavior

Logs

Output for Python in the Output panel (View→Output, change the drop-down the upper-right of the Output panel to Python)

Linter 'pylint' is not installed. Please install it or select another linter".
Error: Module 'pylint' not installed.

Output from Console under the Developer Tools panel (toggle Developer Tools on under Help)

console.ts:136 [Extension Host] Python Extension: Linter 'pylint' is not installed. Please install it or select another linter". Error: Module 'pylint' not installed.
	at PythonExecutionService.<anonymous> (/Users/kristofferb/.vscode/extensions/ms-python.python-2018.2.1/out/client/common/process/pythonProcess.js:92:27)
	at Generator.next (<anonymous>)
	at fulfilled (/Users/kristofferb/.vscode/extensions/ms-python.python-2018.2.1/out/client/common/process/pythonProcess.js:12:58)
	at <anonymous>
[...]
console.ts:136 [Extension Host] Python Extension: Linter 'pylint' is not installed. Please install it or select another linter". Error: Module 'pylint' not installed.
	at PythonExecutionService.<anonymous> (/Users/kristofferb/.vscode/extensions/ms-python.python-2018.2.1/out/client/common/process/pythonProcess.js:92:27)
	at Generator.next (<anonymous>)
	at fulfilled (/Users/kristofferb/.vscode/extensions/ms-python.python-2018.2.1/out/client/common/process/pythonProcess.js:12:58)
	at <anonymous>
[...]

Activity

  1. kbakk commented on Mar 26, 2018

    @kbakk
    Author

    Here is the tree structure (limited to three levels):

    .venv2
    └── test_vscode_venv
        ├── bin
        │   ├── activate
        │   ├── activate.csh
        │   ├── activate.fish
        │   ├── easy_install
        │   ├── easy_install-3.6
        │   ├── pip
        │   ├── pip3
        │   ├── pip3.6
        │   ├── python -> python3
        │   └── python3 -> /usr/local/bin/python3
        ├── include
        ├── lib
        │   └── python3.6
        ├── pip-selfcheck.json
        └── pyvenv.cfg
    
    5 directories, 12 files
    
  2. hruan commented on Mar 28, 2018

    @hruan

    I'm seeing this too. Adding few more details.

    • python.venvPath is set to ${env:HOME}/.venvs which contains more than one venv
    • Python: Select Interpreter command shows system wide Python interpreters and just one of the venvs
    • Issue remains after `Clear Editor History
    • Issue occurs in editor regardless if a Workspace is active or not
  3. brettcannon commented on Apr 3, 2018

    @brettcannon
    Member

    I can't reproduce with the development build of the extension:
    untitled

    Is everyone running the latest version of the extension? (I notice Kristoffer Bakkejord (@kbakk) is not for instance.)

  4. hruan commented on Apr 4, 2018

    @hruan

    I'm on version 2018.3.1. Running on VS Code 1.12.1 on OS X 10.13.3.

  5. kbakk commented on Apr 4, 2018

    @kbakk
    Author

    Have upgraded from 2018.2.1 -> 2018.3.1 since this was reported. Still seeing the issue.

    I notice that you use Windows, Brett Cannon (@brettcannon). Could this be limited to MacOS (as both me and Hang Ruan (@hruan) uses)?

  6. cloudyparts commented on Apr 4, 2018

    @cloudyparts

    I had the same issue. I disabled then reenabled the extension and this resolved the issue.

    1. disable extension, then reload vscode
    2. enable extension, then reload vscode
  7. brettcannon commented on Apr 5, 2018

    @brettcannon
    Member

    Kristoffer Bakkejord (@kbakk) it's certainly possible it's mac-only. Could you see if what patrick devlin (@cloudyparts) did somehow fixes it? Otherwise someone on our team who has a Mac will have a look.

  8. gbonline commented on Apr 9, 2018

    @gbonline

    I've the same issue, on Mac osx 10.11.6
    with virtualenv+wrapper, by setting the python.venvPath,
    when I used VScode in October for a project, everything worked as expected: all my venvs were listed
    after the VSCode updates, this behavior is broken.
    The disable/reload/enable extension process don't solve the issue

  9. DonJayamanne commented on Apr 10, 2018

    @DonJayamanne

    Kristoffer Bakkejord (@kbakk) Gbonline (@gbonline) patrick devlin (@cloudyparts) Hang Ruan (@hruan)

    • Please uninstall your python extension
    • Download the following development version of the Python extension python-2018.4.0-alpha-dev.vsix
    • Open VS Code and install the above extension using the command Install from VSIX from the Command Palette
    • Restart VS Code once installation has been completed (you'll get a prompt)
    • Test again, it should work

    Let me know how this goes

  10. added a commit that references this issue on Apr 10, 2018
    aa4f231
  11. kbakk commented on Apr 11, 2018

    @kbakk
    Author

    Don Jayamanne (@DonJayamanne) Installing the provided extension fixed the issue for me! Thank you!

  12. hruan commented on Apr 11, 2018

    @hruan

    Works for me as well.

    Will we need reinstall extension from Marketplace once, 2018.4 is released?

  13. DonJayamanne commented on Apr 11, 2018

    @DonJayamanne

    Will we need reinstall extension from Marketplace once, 2018.4 is released?

    No, it's automatic

  14. jorgepinon commented on Apr 21, 2018

    @jorgepinon

    In case anyone still has this issue, I tried the VSIX plugin above but the command palette still wasn't showing my pyenv-installed 3.4.3 version.

    However, running this in the command line
    pyenv global 3.4.3

    Made it appear in the Select Interpreter list.

  15. locked as resolved and limited conversation to collaborators on Jul 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugIssue identified by VS Code Team member as probable bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions