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.

spawn /usr/bin/python2 ENOENT when trying to select interpreter

See original GitHub issue

spawn /usr/bin/python2 ENOENT

Environment data

  • VS Code version: 1.21.1
  • Extension version (available under the Extensions sidebar): 2018.3.1
  • OS and version: Windows 7 (7601)
  • Python version (& distribution if applicable, e.g. Anaconda): python.org 3.6.5
  • Type of virtual environment used (N/A | venv | virtualenv | conda | …): NA
  • Relevant/affected Python packages and their versions: python 3 (as above)

Actual behavior

Step 3 of the prerequisites states:

From within VS Code, select a version of Python using the Python: Select Interpreter command on the Command Palette (Ctrl+Shift+P), or by using the Select Python Environment option on the Status Bar if available

The command presents a list of available interpreters that VS Code can find automatically. If you don’t see the desired interpreter, see Configuring Python environments.

The readme also mentions this under optional steps:

Step 5. Select your preferred Python interpreter/version/environment using the Select Interpreter command.

  • By default we use the one that’s on your path.
  • If you have a workspace open you can also click in the status bar to change the interpreter.

However, when attempting to select an interpreter, VsCode reports the error:

spawn /usr/bin/python2 ENOENT and nothing further happens.

Expected behavior

The interpreter is selected (or at least a more helpful error message is displayed)

Steps to reproduce:

  1. Install vscode,
  2. Install python,
  3. Ensure python is on path
  4. Install extension,
  5. Attempt to select interpreter.

Python install path is known by vscode as selecting Python: Start REPL, works as expected.

Logs

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

##########Linting Output - pylint##########
No config file found, using default configuration

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

log.ts:171   ERR spawn /usr/bin/python2 ENOENT: Error: spawn /usr/bin/python2 ENOENT
	at exports._errnoException (util.js:1050:11)
	at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
	at onErrorNT (internal/child_process.js:367:16)
	at _combinedTickCallback (internal/process/next_tick.js:80:11)
	at process._tickCallback (internal/process/next_tick.js:104:9)
console.ts:136 [Extension Host] rejected promise not handled within 1 second
t.log @ console.ts:136
t._logExtensionHostMessage @ extensionHost.ts:400
(anonymous) @ extensionHost.ts:213
emitTwo @ events.js:106
emit @ events.js:194
process.nextTick @ internal/child_process.js:766
_combinedTickCallback @ internal/process/next_tick.js:73
_tickCallback @ internal/process/next_tick.js:104
notificationsAlerts.ts:39 spawn /usr/bin/python2 ENOENT
e.onDidNotificationChange @ notificationsAlerts.ts:39
(anonymous) @ notificationsAlerts.ts:28
e.fire @ event.ts:142
e.notify @ notifications.ts:127
e.error @ notificationService.ts:58
t.onError @ commandsHandler.ts:326
(anonymous) @ commandsHandler.ts:311
done @ winjs.base.raw.js:1391
v @ winjs.base.raw.js:1237
enter @ winjs.base.raw.js:914
_run @ winjs.base.raw.js:1081
_error @ winjs.base.raw.js:1054
e.resolveErr @ lazyPromise.ts:78
e._receiveReplyErr @ rpcProtocol.ts:154
e._receiveOneMessage @ rpcProtocol.ts:99
(anonymous) @ rpcProtocol.ts:33
(anonymous) @ rpcProtocol.ts:213
e.fire @ event.ts:142
(anonymous) @ ipc.net.ts:81
emitOne @ events.js:96
emit @ events.js:191
readableAddChunk @ _stream_readable.js:178
Readable.push @ _stream_readable.js:136
onread @ net.js:560

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:27 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
bbukatycommented, Apr 11, 2018

Yep, that new version works. As mentioned above the debugger now runs through the shell specified in the setting terminal.integrated.shell.windows, but I’d like to leave that set to bash, which is now causing issues. Is there a way to separate which shell the debugger uses from the shell used in the integrated terminal? Let me know if I should make a separate post or something about this.

Regardless, thanks for the quick fix on this issue.

1reaction
DonJayamannecommented, Apr 10, 2018

@bbukaty Here’s a new version of the extension, please test and let me know how this goes. https://pvsc.blob.core.windows.net/extension-builds/python-2018.4.0-alpha-dev2.vsix Thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: spawn ENOTDIR, when selecting python interpreter in ...
The problem was in the version of the python extension I was using(2020.1.57204). what I did was installed a slightly older version ...
Read more >
Bug listing with status UNCONFIRMED as at 2022/12/24 17 ...
Bug:128538 - "sys-apps/coreutils: /bin/hostname should be installed from coreutils not sys-apps/net-tools" status:UNCONFIRMED resolution: severity:enhancement ...
Read more >
Configure a Python interpreter | PyCharm Documentation
It is the most convenient and quickest way to switch the Python interpreter. Just click it and select the target interpreter:.
Read more >
Configure Interpreter - PyDev
Choose the interpreter you have installed in your computer (such as python.exe, jython.jar or ipy.exe). Note that the Auto Config will try to...
Read more >
Advanced Visual Studio Code for Python Developers
If you're just getting started with VS Code, you might want to check out Jon ... If you already have 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