Skip to content

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

Closed

Description

@wolf99

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 (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

  1. brettcannon commented on Apr 5, 2018

    @brettcannon
    Member

    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).

  2. DonJayamanne commented on Apr 5, 2018

    @DonJayamanne

    Also, please let us know how you have started VS Code? (did you lunch it from the bash terminal?)

  3. wolf99 commented on Apr 5, 2018

    @wolf99
    Author

    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

  4. bbukaty commented on Apr 8, 2018

    @bbukaty

    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.

  5. DonJayamanne commented on Apr 8, 2018

    @DonJayamanne

    Closing in favor of #67

  6. added
    feature-requestRequest for new features or functionality
    and removed
    info-neededIssue requires more information from poster
    bugIssue identified by VS Code Team member as probable bug
    on Apr 8, 2018
  7. 16 remaining items

  8. wolf99 commented on Apr 9, 2018

    @wolf99
    Author

    To add MSYS2 provided programs to the PATH I just added C:\msys64\usr\bin to my system Path variable IIRC.

  9. DonJayamanne commented on Apr 9, 2018

    @DonJayamanne

    wolf99 (@wolf99) Blake Bukaty (@bbukaty) Brett Cannon (@brettcannon)
    I can replicate this at my end with msys2 setup.

    • Install msys2
    • Install python pacman -S python
    • Add C:\msys64\usr\bin and C:\msys64\mingw64\bin
  10. DonJayamanne commented on Apr 9, 2018

    @DonJayamanne

    wolf99 (@wolf99) Blake Bukaty (@bbukaty)

    • 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

  11. bbukaty commented on Apr 10, 2018

    @bbukaty

    Using the alpha version above, when I do Python: Select Interpreter, I get the error: command 'python.setInterpreter' not found
    image

  12. DonJayamanne commented on Apr 10, 2018

    @DonJayamanne

    Please uninstall and reinstall the extension. Finally check the error in the console window.

  13. bbukaty commented on Apr 10, 2018

    @bbukaty

    I uninstalled and reinstalled.
    When I open vscode, I get this error:
    image

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

  14. DonJayamanne commented on Apr 10, 2018

    @DonJayamanne

    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)

  15. DonJayamanne commented on Apr 10, 2018

    @DonJayamanne

    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

  16. added a commit that references this issue on Apr 10, 2018
    058aa8d
  17. bbukaty commented on Apr 11, 2018

    @bbukaty

    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.

  18. DonJayamanne commented on Apr 11, 2018

    @DonJayamanne

    Let me know if I should make a separate post or something about this.

    Yes, please do so.

  19. wolf99 commented on Apr 11, 2018

    @wolf99
    Author

    Haven't tried it yet but thanks for the quick fixes on this Don Jayamanne (@DonJayamanne) (and the testing Blake Bukaty (@bbukaty)), much appreciated!

  20. 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 buginfo-neededIssue requires more information from posterwindows

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions