Skip to content

Python interpreter list showing each python.org install twice #15302

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

Closed
tonybaloney opened this issue Feb 3, 2021 · 10 comments
Closed

Python interpreter list showing each python.org install twice #15302

tonybaloney opened this issue Feb 3, 2021 · 10 comments
Assignees
Labels
area-environments Features relating to handling interpreter environments bug Issue identified by VS Code Team member as probable bug important Issue identified as high-priority regression Bug didn't exist in a previous release

Comments

@tonybaloney
Copy link

Environment data

  • VS Code version: 1.52.1
  • Extension version (available under the Extensions sidebar): v2021.1.502429796
  • OS and version: macOS 11.2
  • Python version (& distribution if applicable, e.g. Anaconda): Lots

Expected behaviour

The environment selection window will show my python versions (all from the default macOS installer at Python.org) each once only

Actual behaviour

Each version is shown twice:

Screen Shot 2021-02-03 at 9 16 09 am

Those two 3.8 interpreters are symlinks to the same file:

 ls -lah /Library/Frameworks/Python.framework/Versions/3.8/bin/python3
lrwxr-xr-x  1 root  admin     9B  5 May  2020 /Library/Frameworks/Python.framework/Versions/3.8/bin/python3 -> python3.8

ls -lah /usr/local/bin/python3.8
lrwxr-xr-x  1 root  wheel    71B  5 May  2020 /usr/local/bin/python3.8 -> ../../../Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8

These symlinks are default for the python.org installer for macOS.

Logs

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

Error 2021-02-03 11:26:44: Failed to get interpreter information for '/usr/local/bin/python3-32' [Error: Command failed: "/usr/local/bin/python3-32" "/Users/anthonyshaw/.vscode/extensions/ms-python.python-2021.1.502429796/pythonFiles/pyvsc-run-isolated.py" "/Users/anthonyshaw/.vscode/extensions/ms-python.python-2021.1.502429796/pythonFiles/interpreterInfo.py"
/bin/sh: /usr/local/bin/python3-32: Bad CPU type in executable

	at ChildProcess.exithandler (child_process.js:304:12)
	at ChildProcess.emit (events.js:223:5)
	at maybeClose (internal/child_process.js:1021:16)
	at Socket.<anonymous> (internal/child_process.js:430:11)
	at Socket.emit (events.js:223:5)
	at Pipe.<anonymous> (net.js:664:12)] {
  killed: false,
  code: 126,
  signal: null,
  cmd: '"/usr/local/bin/python3-32" "/Users/anthonyshaw/.vscode/extensions/ms-python.python-2021.1.502429796/pythonFiles/pyvsc-run-isolated.py" "/Users/anthonyshaw/.vscode/extensions/ms-python.python-2021.1.502429796/pythonFiles/interpreterInfo.py"'
}
Error 2021-02-03 11:26:44: Failed to get interpreter information for '/usr/local/bin/python2-32' [Error: Command failed: "/usr/local/bin/python2-32" "/Users/anthonyshaw/.vscode/extensions/ms-python.python-2021.1.502429796/pythonFiles/pyvsc-run-isolated.py" "/Users/anthonyshaw/.vscode/extensions/ms-python.python-2021.1.502429796/pythonFiles/interpreterInfo.py"
/bin/sh: /usr/local/bin/python2-32: Bad CPU type in executable

	at ChildProcess.exithandler (child_process.js:304:12)
	at ChildProcess.emit (events.js:223:5)
	at maybeClose (internal/child_process.js:1021:16)
	at Socket.<anonymous> (internal/child_process.js:430:11)
	at Socket.emit (events.js:223:5)
	at Pipe.<anonymous> (net.js:664:12)] {
  killed: false,
  code: 126,
  signal: null,
  cmd: '"/usr/local/bin/python2-32" "/Users/anthonyshaw/.vscode/extensions/ms-python.python-2021.1.502429796/pythonFiles/pyvsc-run-isolated.py" "/Users/anthonyshaw/.vscode/extensions/ms-python.python-2021.1.502429796/pythonFiles/interpreterInfo.py"'
}
Error 2021-02-03 11:26:44: Failed to get interpreter information for '/usr/local/bin/python3-32' [Error: Command failed: "/usr/local/bin/python3-32" "/Users/anthonyshaw/.vscode/extensions/ms-python.python-2021.1.502429796/pythonFiles/pyvsc-run-isolated.py" "/Users/anthonyshaw/.vscode/extensions/ms-python.python-2021.1.502429796/pythonFiles/interpreterInfo.py"
/bin/sh: /usr/local/bin/python3-32: Bad CPU type in executable

	at ChildProcess.exithandler (child_process.js:304:12)
	at ChildProcess.emit (events.js:223:5)
	at maybeClose (internal/child_process.js:1021:16)
	at Socket.<anonymous> (internal/child_process.js:430:11)
	at Socket.emit (events.js:223:5)
	at Pipe.<anonymous> (net.js:664:12)] {
  killed: false,
  code: 126,
  signal: null,
  cmd: '"/usr/local/bin/python3-32" "/Users/anthonyshaw/.vscode/extensions/ms-python.python-2021.1.502429796/pythonFiles/pyvsc-run-isolated.py" "/Users/anthonyshaw/.vscode/extensions/ms-python.python-2021.1.502429796/pythonFiles/interpreterInfo.py"'
}
Error 2021-02-03 11:26:44: Failed to get interpreter information for '/usr/local/bin/python2-32' [Error: Command failed: "/usr/local/bin/python2-32" "/Users/anthonyshaw/.vscode/extensions/ms-python.python-2021.1.502429796/pythonFiles/pyvsc-run-isolated.py" "/Users/anthonyshaw/.vscode/extensions/ms-python.python-2021.1.502429796/pythonFiles/interpreterInfo.py"
/bin/sh: /usr/local/bin/python2-32: Bad CPU type in executable

	at ChildProcess.exithandler (child_process.js:304:12)
	at ChildProcess.emit (events.js:223:5)
	at maybeClose (internal/child_process.js:1021:16)
	at Socket.<anonymous> (internal/child_process.js:430:11)
	at Socket.emit (events.js:223:5)
	at Pipe.<anonymous> (net.js:664:12)] {
  killed: false,
  code: 126,
  signal: null,
  cmd: '"/usr/local/bin/python2-32" "/Users/anthonyshaw/.vscode/extensions/ms-python.python-2021.1.502429796/pythonFiles/pyvsc-run-isolated.py" "/Users/anthonyshaw/.vscode/extensions/ms-python.python-2021.1.502429796/pythonFiles/interpreterInfo.py"'
}
Error 2021-02-03 11:26:44: Failed to get interpreter information for '/Library/Frameworks/Python.framework/Versions/2.7/bin/python2-32' [Error: Command failed: "/Library/Frameworks/Python.framework/Versions/2.7/bin/python2-32" "/Users/anthonyshaw/.vscode/extensions/ms-python.python-2021.1.502429796/pythonFiles/pyvsc-run-isolated.py" "/Users/anthonyshaw/.vscode/extensions/ms-python.python-2021.1.502429796/pythonFiles/interpreterInfo.py"
/bin/sh: /Library/Frameworks/Python.framework/Versions/2.7/bin/python2-32: Bad CPU type in executable

	at ChildProcess.exithandler (child_process.js:304:12)
	at ChildProcess.emit (events.js:223:5)
	at maybeClose (internal/child_process.js:1021:16)
	at Socket.<anonymous> (internal/child_process.js:430:11)
	at Socket.emit (events.js:223:5)
	at Pipe.<anonymous> (net.js:664:12)] {
  killed: false,
  code: 126,
  signal: null,
  cmd: '"/Library/Frameworks/Python.framework/Versions/2.7/bin/python2-32" "/Users/anthonyshaw/.vscode/extensions/ms-python.python-2021.1.502429796/pythonFiles/pyvsc-run-isolated.py" "/Users/anthonyshaw/.vscode/extensions/ms-python.python-2021.1.502429796/pythonFiles/interpreterInfo.py"'
}
Error 2021-02-03 11:26:44: Failed to get interpreter information for '/Library/Frameworks/Python.framework/Versions/3.5/bin/python3-32' [Error: Command failed: "/Library/Frameworks/Python.framework/Versions/3.5/bin/python3-32" "/Users/anthonyshaw/.vscode/extensions/ms-python.python-2021.1.502429796/pythonFiles/pyvsc-run-isolated.py" "/Users/anthonyshaw/.vscode/extensions/ms-python.python-2021.1.502429796/pythonFiles/interpreterInfo.py"
/bin/sh: /Library/Frameworks/Python.framework/Versions/3.5/bin/python3-32: Bad CPU type in executable

	at ChildProcess.exithandler (child_process.js:304:12)
	at ChildProcess.emit (events.js:223:5)
	at maybeClose (internal/child_process.js:1021:16)
	at Socket.<anonymous> (internal/child_process.js:430:11)
	at Socket.emit (events.js:223:5)
	at Pipe.<anonymous> (net.js:664:12)] {
  killed: false,
  code: 126,
  signal: null,
  cmd: '"/Library/Frameworks/Python.framework/Versions/3.5/bin/python3-32" "/Users/anthonyshaw/.vscode/extensions/ms-python.python-2021.1.502429796/pythonFiles/pyvsc-run-isolated.py" "/Users/anthonyshaw/.vscode/extensions/ms-python.python-2021.1.502429796/pythonFiles/interpreterInfo.py"'
}
Error 2021-02-03 11:26:44: Failed to get interpreter information for '/Library/Frameworks/Python.framework/Versions/3.5/bin/python3' [Error: Command failed: "/Library/Frameworks/Python.framework/Versions/3.5/bin/python3" "/Users/anthonyshaw/.vscode/extensions/ms-python.python-2021.1.502429796/pythonFiles/pyvsc-run-isolated.py" "/Users/anthonyshaw/.vscode/extensions/ms-python.python-2021.1.502429796/pythonFiles/interpreterInfo.py"
dyld: Library not loaded: /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
  Referenced from: /Library/Frameworks/Python.framework/Versions/3.5/Resources/Python.app/Contents/MacOS/Python
  Reason: image not found

	at ChildProcess.exithandler (child_process.js:304:12)
	at ChildProcess.emit (events.js:223:5)
	at maybeClose (internal/child_process.js:1021:16)
	at Socket.<anonymous> (internal/child_process.js:430:11)
	at Socket.emit (events.js:223:5)
	at Pipe.<anonymous> (net.js:664:12)] {
  killed: false,
  code: null,
  signal: 'SIGABRT',
  cmd: '"/Library/Frameworks/Python.framework/Versions/3.5/bin/python3" "/Users/anthonyshaw/.vscode/extensions/ms-python.python-2021.1.502429796/pythonFiles/pyvsc-run-isolated.py" "/Users/anthonyshaw/.vscode/extensions/ms-python.python-2021.1.502429796/pythonFiles/interpreterInfo.py"'
}
Error 2021-02-03 11:26:44: Failed to get interpreter information for '/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5' [Error: Command failed: "/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5" "/Users/anthonyshaw/.vscode/extensions/ms-python.python-2021.1.502429796/pythonFiles/pyvsc-run-isolated.py" "/Users/anthonyshaw/.vscode/extensions/ms-python.python-2021.1.502429796/pythonFiles/interpreterInfo.py"
dyld: Library not loaded: /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
  Referenced from: /Library/Frameworks/Python.framework/Versions/3.5/Resources/Python.app/Contents/MacOS/Python
  Reason: image not found

	at ChildProcess.exithandler (child_process.js:304:12)
	at ChildProcess.emit (events.js:223:5)
	at maybeClose (internal/child_process.js:1021:16)
	at Socket.<anonymous> (internal/child_process.js:430:11)
	at Socket.emit (events.js:223:5)
	at Pipe.<anonymous> (net.js:664:12)] {
  killed: false,
  code: null,
  signal: 'SIGABRT',
  cmd: '"/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5" "/Users/anthonyshaw/.vscode/extensions/ms-python.python-2021.1.502429796/pythonFiles/pyvsc-run-isolated.py" "/Users/anthonyshaw/.vscode/extensions/ms-python.python-2021.1.502429796/pythonFiles/interpreterInfo.py"'
}
Error 2021-02-03 11:26:44: Failed to get interpreter information for '/usr/local/bin/python3.5' [Error: Command failed: "/usr/local/bin/python3.5" "/Users/anthonyshaw/.vscode/extensions/ms-python.python-2021.1.502429796/pythonFiles/pyvsc-run-isolated.py" "/Users/anthonyshaw/.vscode/extensions/ms-python.python-2021.1.502429796/pythonFiles/interpreterInfo.py"
dyld: Library not loaded: /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
  Referenced from: /Library/Frameworks/Python.framework/Versions/3.5/Resources/Python.app/Contents/MacOS/Python
  Reason: image not found

	at ChildProcess.exithandler (child_process.js:304:12)
	at ChildProcess.emit (events.js:223:5)
	at maybeClose (internal/child_process.js:1021:16)
	at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)] {
  killed: false,
  code: null,
  signal: 'SIGABRT',
  cmd: '"/usr/local/bin/python3.5" "/Users/anthonyshaw/.vscode/extensions/ms-python.python-2021.1.502429796/pythonFiles/pyvsc-run-isolated.py" "/Users/anthonyshaw/.vscode/extensions/ms-python.python-2021.1.502429796/pythonFiles/interpreterInfo.py"'
}
Error 2021-02-03 11:26:44: Failed to get interpreter information for '/usr/local/bin/python3.5' [Error: Command failed: "/usr/local/bin/python3.5" "/Users/anthonyshaw/.vscode/extensions/ms-python.python-2021.1.502429796/pythonFiles/pyvsc-run-isolated.py" "/Users/anthonyshaw/.vscode/extensions/ms-python.python-2021.1.502429796/pythonFiles/interpreterInfo.py"
dyld: Library not loaded: /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
  Referenced from: /Library/Frameworks/Python.framework/Versions/3.5/Resources/Python.app/Contents/MacOS/Python
  Reason: image not found

	at ChildProcess.exithandler (child_process.js:304:12)
	at ChildProcess.emit (events.js:223:5)
	at maybeClose (internal/child_process.js:1021:16)
	at Socket.<anonymous> (internal/child_process.js:430:11)
	at Socket.emit (events.js:223:5)
	at Pipe.<anonymous> (net.js:664:12)] {
  killed: false,
  code: null,
  signal: 'SIGABRT',
  cmd: '"/usr/local/bin/python3.5" "/Users/anthonyshaw/.vscode/extensions/ms-python.python-2021.1.502429796/pythonFiles/pyvsc-run-isolated.py" "/Users/anthonyshaw/.vscode/extensions/ms-python.python-2021.1.502429796/pythonFiles/interpreterInfo.py"'
}
Starting Pylance language server.
Python interpreter path: /Library/Frameworks/Python.framework/Versions/3.9/bin/python3
> conda --version

@tonybaloney tonybaloney added triage-needed Needs assignment to the proper sub-team bug Issue identified by VS Code Team member as probable bug labels Feb 3, 2021
@karthiknadig karthiknadig added area-environments Features relating to handling interpreter environments triage labels Feb 3, 2021
@ghost ghost removed the triage-needed Needs assignment to the proper sub-team label Feb 3, 2021
@kimadeline
Copy link

Thank you for reporting this @tonybaloney!

We're reworking how we discover interpreters in the extension (#12020), and so far I can't repro this while using our shiny new algorithm:

ls -lah /usr/local/bin/python3.9
lrwxr-xr-x  1 root  wheel    71B  3 Feb 15:22 /usr/local/bin/python3.9 -> ../../../Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9

image

We'll just have to make sure it stays that way once we roll it out 🙂

@kimadeline kimadeline removed their assignment Feb 3, 2021
@kimadeline kimadeline added needs PR and removed triage labels Feb 3, 2021
@tonybaloney
Copy link
Author

@kimadeline thanks for the quick response.

I've just enabled the pythonDiscoveryModule from the experimental features in the weekly build, it does resolve this bug.. however it does show each interpreter twice still (for a different reason).

It's showing both the relative and absolute paths to the same interpreters

Screen Shot 2021-02-04 at 11 12 28 am

@kimadeline
Copy link

Huh, that I couldn't repro though. What happens if you enable both pythonDiscoveryModule and pythonDiscoveryModuleWithoutWatcher experiments?

@tonybaloney
Copy link
Author

here's my global settings:

{
    "window.zoomLevel": 1,
    "git.autofetch": true,
    "C_Cpp.updateChannel": "Insiders",

    "scm.alwaysShowActions": true,
    "scm.alwaysShowRepositories": true,

    "python.analysis.memory.keepLibraryAst": true,
    "python.linting.banditEnabled": true,
    "python.linting.banditPath": "/Library/Frameworks/Python.framework/Versions/2.7/bin/bandit",
    "python.languageServer": "Pylance",
    "python.analysis.typeCheckingMode": "basic",
    "python.experiments.optInto": [
        "pythonDiscoveryModule"
    ],
    "python.insidersChannel": "weekly",
    "python.pythonPath": "/Library/Frameworks/Python.framework/Versions/3.9/bin/python3",

    "workbench.colorTheme": "Material Theme Lighter",
    "workbench.startupEditor": "readme",
    "materialTheme.accent": "Cyan",

    "terminal.external.osxExec": "iTerm.app",
    "terminal.integrated.fontFamily": "MesloLGS NF",
    "terminal.integrated.rendererType": "canvas",

    "editor.fontFamily": "Anonymice Nerd Font Mono",
    "editor.fontSize": 14,

    "window.dialogStyle": "custom",
    "window.titleBarStyle": "native",
    "window.nativeTabs": true,
    "cmake.configureOnOpen": true,
    "git.confirmSync": false,
    "files.associations": {
        "*.asm": "masm",
        "*.S": "asm"
    },
    "codeQL.telemetry.enableTelemetry": false,
    "testMate.cpp.log.logSentry": "enable",
}

@kimadeline
Copy link

Can you try adding pythonDiscoveryModuleWithoutWatcher in the "python.experiments.optInto" array?

@kimadeline
Copy link

Hi @tonybaloney, does this problem still happen with the latest Insiders build of the extension?

@tonybaloney
Copy link
Author

tonybaloney commented Feb 17, 2021

Yes, it does
Screen Shot 2021-02-18 at 8 56 27 am
Screen Shot 2021-02-18 at 8 56 19 am
Screen Shot 2021-02-18 at 8 56 12 am
this is what I get for the latest insiders build

@tonybaloney
Copy link
Author

I just tried the "pythonDiscoveryModuleWithoutWatcher" experiment, but it highlighted it as an invalid option

@kimadeline
Copy link

Ah yes, sorry, we removed pythonDiscoveryModuleWithoutWatcher recently.

It seems that you're also seeing #15312, with one of the duplicate paths shown being one relative to your home folder (../../../Library/Frameworks/blah), and the other one being the absolute one (/Library/Frameworks/blah). Maybe fixing #15312 will fix this as well, if not, we'll have to dig a little bit deeper.

Thank you for the update!

@brettcannon brettcannon added the regression Bug didn't exist in a previous release label Feb 22, 2021
@karrtikr karrtikr self-assigned this Feb 24, 2021
@karrtikr karrtikr added the important Issue identified as high-priority label Feb 24, 2021
@karrtikr
Copy link

karrtikr commented Feb 24, 2021

@tonybaloney We just released a fix for #15312 in the insiders build of the extension that should solve this when in pythonDiscoveryModule experiment. Please try it out and let us know how it goes.

@luabud luabud closed this as completed Feb 24, 2021
@ghost ghost removed the needs PR label Feb 24, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-environments Features relating to handling interpreter environments bug Issue identified by VS Code Team member as probable bug important Issue identified as high-priority regression Bug didn't exist in a previous release
Projects
None yet
Development

No branches or pull requests

6 participants