Repository navigation
spawn /usr/bin/python2 ENOENT when trying to select interpreter #1305
Description
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:
- Install vscode,
- Install python,
- Ensure python is on path
- Install extension,
- 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 (View→Output, 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
Activity
brettcannon commentedon Apr 5, 2018
Can you send us a screenshot of what interpreters are listed by the extension? Since you're on Windows 7 it shouldn't be trying to execute
/usr/bin/python2(especially if you only have Python 3 installed).DonJayamanne commentedon Apr 5, 2018
Also, please let us know how you have started VS Code? (did you lunch it from the
bashterminal?)wolf99 commentedon Apr 5, 2018
Brett Cannon (@brettcannon) I can grab a screenshot in the morning. I have Msys2 installed on the machine and configured such the programs it provides are available on the PATH - I shouldn't think this should affect vscode but it occurred to me to mention it as a possibility.
Don Jayamanne (@DonJayamanne) I started vscode as I generally do, via the normal Windows Menu icon as provided by vscode's installer
bbukaty commentedon Apr 8, 2018
Also having this problem, I think it might have something to do with the linux subsystem for win10, but I uninstalled it and the problem persisted.
DonJayamanne commentedon Apr 8, 2018
Closing in favor of #67
16 remaining items
wolf99 commentedon Apr 9, 2018
To add MSYS2 provided programs to the PATH I just added
C:\msys64\usr\binto my system Path variable IIRC.DonJayamanne commentedon Apr 9, 2018
wolf99 (@wolf99) Blake Bukaty (@bbukaty) Brett Cannon (@brettcannon)
I can replicate this at my end with msys2 setup.
pacman -S pythonC:\msys64\usr\binandC:\msys64\mingw64\binDonJayamanne commentedon Apr 9, 2018
wolf99 (@wolf99) Blake Bukaty (@bbukaty)
Install from VSIXfrom theCommand PaletteLet me know how this goes
bbukaty commentedon Apr 10, 2018
Using the alpha version above, when I do Python: Select Interpreter, I get the error: command 'python.setInterpreter' not found

DonJayamanne commentedon Apr 10, 2018
Please uninstall and reinstall the extension. Finally check the error in the
console window.bbukaty commentedon Apr 10, 2018
I uninstalled and reinstalled.

When I open vscode, I get this error:
and when I do select interpreter, I get the error pictured in my last post, with this output in the console:

DonJayamanne commentedon Apr 10, 2018
I'm sorry for not testing the build, looks like we're missing a dependency. I'll get this fixed asap and upload a new build of the extension (#1360)
DonJayamanne commentedon Apr 10, 2018
Blake Bukaty (@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
Check if interpreter file exists before displaying in a list (#1352)
bbukaty commentedon 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.
DonJayamanne commentedon Apr 11, 2018
Yes, please do so.
wolf99 commentedon Apr 11, 2018
Haven't tried it yet but thanks for the quick fixes on this Don Jayamanne (@DonJayamanne) (and the testing Blake Bukaty (@bbukaty)), much appreciated!