Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Virtual environments not listed with Python: Select Interpreter #1192

Closed
kbakk opened this issue Mar 26, 2018 · 14 comments · Fixed by #1353
Closed

Virtual environments not listed with Python: Select Interpreter #1192

kbakk opened this issue Mar 26, 2018 · 14 comments · Fixed by #1353
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug
Milestone

Comments

@kbakk
Copy link

kbakk commented Mar 26, 2018

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 (ViewOutput, 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>
[...]
@kbakk
Copy link
Author

kbakk commented Mar 26, 2018

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

@brettcannon brettcannon added bug Issue identified by VS Code Team member as probable bug needs verification labels Mar 26, 2018
@hruan
Copy link

hruan commented Mar 28, 2018

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

@brettcannon
Copy link
Member

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

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

@brettcannon brettcannon added info-needed Issue requires more information from poster and removed needs verification labels Apr 3, 2018
@hruan
Copy link

hruan commented Apr 4, 2018

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

@kbakk
Copy link
Author

kbakk commented Apr 4, 2018

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

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

@cloudyparts
Copy link

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

@brettcannon brettcannon added needs decision and removed info-needed Issue requires more information from poster labels Apr 4, 2018
@brettcannon
Copy link
Member

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

@gbonline
Copy link

gbonline commented Apr 9, 2018

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

@DonJayamanne
Copy link

@kbakk @gbonline @cloudyparts @hruan
Replicated at my end.

@DonJayamanne
Copy link

@kbakk @gbonline @cloudyparts @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

@kbakk
Copy link
Author

kbakk commented Apr 11, 2018

@DonJayamanne Installing the provided extension fixed the issue for me! Thank you!

@hruan
Copy link

hruan commented Apr 11, 2018

Works for me as well.

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

@DonJayamanne
Copy link

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

No, it's automatic

@jorgepinon
Copy link

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.

@lock lock bot locked as resolved and limited conversation to collaborators Jul 11, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug
Projects
None yet
7 participants