question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Virtual environments not listed with Python: Select Interpreter

See original GitHub issue

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>
[...]

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:14 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
DonJayamannecommented, Apr 10, 2018

@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

0reactions
jorgepinoncommented, Apr 21, 2018

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Visual Studio Code does not detect Virtual Environments
In VSCode open your command palette — Ctrl+Shift+P by default. Look for Python: Select Interpreter. In Select Interpreter choose Enter ...
Read more >
Using Python environments in VS Code
The Python: Select Interpreter command displays a list of available global environments, conda environments, and virtual environments. (See the Where the ...
Read more >
What to do if Visual Studio Code can't find your virtual ...
Next, bringing up the Command Palette (by clicking View — Command Palette in the menu or by pressing CMD-Shift-P on Mac) and select...
Read more >
Manage Python environments and interpreters - Visual Studio ...
In the Python environment window, select the environment, and then select the Configure tab. · After making changes, select the Apply command.
Read more >
venv — Creation of virtual environments — Python 3.11.1 ...
This module does not work or is not available on WebAssembly platforms ... When a Python interpreter is running from a virtual environment,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found