Skip to content
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

Select Interpreter failed to find 64-bit python installation due to wrong IInterpreterLocatorService parameter. #414

Closed
MichaelSuen-thePointer opened this issue Dec 13, 2017 · 7 comments
Labels
bug Issue identified by VS Code Team member as probable bug
Milestone

Comments

@MichaelSuen-thePointer
Copy link

Environment data

VS Code version: 1.18.1
Python Extension version: 0.8.0
Python Version: python 3.6.3 64-bit & python 2.7.14 64-bit
OS and version: Windows 10.0.16299.64

Actual behavior

image

Expected behavior

image

Steps to reproduce:

Here is my exploration by debugging this extension myself:
The extension cannot find 64-bit python installation via WindowsRegistryService class which implements interface IInterpreterLocatorService
the code is here: windowsRegistryService.ts
In short, this class find python installation via predefined registry path, it does resolved the correct registry path: \Software\Python\PythonCore\2.7\InstallPath and \Software\Python\PythonCore\2.7\InstallPath, but due to the is64Bit member of the class set to false in constructor, it cannot find anything in the 32-bit(?) registry.
After manualy changing this.is64Bit member of WindowsRegistryService to true in the debugger, the class can correctly find both of the 2 python interpreters, and tagged it as 64-bit.

Looking at the constructor, the is64Bit parameter is injected by some other mechanism, which I cannot understand by looking at the code, can anyone explain it?

image

for now, the interpreter locator falls back to find python via PATH and returns only 1 python.exe

@MichaelSuen-thePointer
Copy link
Author

MichaelSuen-thePointer commented Dec 13, 2017

Edit: I found where the is64Bit is defined, it is registered at serviceRegistry.ts and defined at constants.ts

But the weird thing is, my OS is indeed 64-bit, but the injected value in WindowsRegistryService is false
image

image

Maybe it's because the VSCode is a 32-bit program? That's reasonable, but the is64Bit constant should not be used to find python executable, its no doubt that a 32-bit VSCode can run a 64-bit python interpreter.

@MichaelSuen-thePointer
Copy link
Author

Maybe this issue can be renamed:
Is64Bit constant shouldn't be used for finding python executable

@MichaelSuen-thePointer
Copy link
Author

Anyway, I'll try fix this thing myself.

@DonJayamanne
Copy link

@MichaelSuen-thePointer The value for the IS_64_BIT constant is set here.

Maybe it's because the VSCode is a 32-bit program

Please could you try installing the 64bit version of VS Code and checking whether this works?

@DonJayamanne DonJayamanne added awaiting 2-PR bug Issue identified by VS Code Team member as probable bug labels Dec 13, 2017
@DonJayamanne
Copy link

Further to the issue, looks like nodejs returns the wrong value for os.arch() see here nodejs/node-v0.x-archive#2862.
We might have to find an alternative, such as using npm arch.

However, a work around for now is to ensure the 64bit version of VS Code has been installed on a 64bit Windows.

@MichaelSuen-thePointer
Copy link
Author

@DonJayamanne Tried 64-bit VS Code, the result of os.arch() is correct now.

@MichaelSuen-thePointer
Copy link
Author

#419

@DonJayamanne DonJayamanne added this to the January 2018 milestone Dec 15, 2017
@lock lock bot locked as resolved and limited conversation to collaborators Jul 12, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug
Projects
None yet
Development

No branches or pull requests

3 participants