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 Interp - Says Python not installed #20339

Closed
glocker1 opened this issue Dec 6, 2022 · 17 comments
Closed

Select Interp - Says Python not installed #20339

glocker1 opened this issue Dec 6, 2022 · 17 comments
Assignees
Labels
area-environments Features relating to handling interpreter environments info-needed Issue requires more information from poster triage-needed Needs assignment to the proper sub-team

Comments

@glocker1
Copy link

glocker1 commented Dec 6, 2022

Type: Bug

I've done everything in the other closed bug reports for this issue. Full unistall and reinstall of both python and VSC. Deleted the code folder to fully reset VSC. Used the default install paths for both. py -0 from the VSC terminal shows V 3.11.
1

If I manually browse to my python exe in the Select Interpreter GUI, VSC says an invalid interpreter has been selected.
2

My path and other environment variables look correct.:
env.txt

VS Code version: Code 1.73.1 (6261075646f055b99068d3688932416f2346dd3b, 2022-11-09T04:27:29.066Z)
OS version: Windows_NT x64 10.0.19044
Modes:
Sandboxed: No

Extensions (8)
Extension Author (truncated) Version
isort ms- 2022.8.0
python ms- 2022.18.2
vscode-pylance ms- 2022.11.40
jupyter ms- 2022.9.1303220346
jupyter-keymap ms- 1.0.0
jupyter-renderers ms- 1.0.12
vscode-jupyter-cell-tags ms- 0.1.6
vscode-jupyter-slideshow ms- 0.1.5
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
pythonvspyl392:30443607
vserr242cf:30382550
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vsdfh931cf:30280410
vshan820:30294714
vstes263:30335439
vscorecescf:30445987
pythondataviewer:30285071
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
cmake_vspar411:30581797
vsaa593cf:30376535
pythonvs932:30410667
cppdebug:30492333
vsclangdc:30486549
c4g48928:30535728
dsvsc012cf:30540253
azure-dev_surveyone:30548225
vsccc:30610678
pyindex848cf:30577861
nodejswelcome1cf:30587006
3biah626:30602489
gswce1:30612156
3d0df643:30613357
dbltrim-noruby:30604474
f6dab269:30613381
cc2-nonfim-prod:30622702

@VSCodeTriageBot VSCodeTriageBot added the triage-needed Needs assignment to the proper sub-team label Dec 6, 2022
@alexr00 alexr00 assigned rebornix and unassigned alexr00 Dec 6, 2022
@alexr00 alexr00 removed the triage-needed Needs assignment to the proper sub-team label Dec 6, 2022
@rebornix rebornix transferred this issue from microsoft/vscode Dec 6, 2022
@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Dec 6, 2022
@brettcannon
Copy link
Member

What happens when you try to run that path manually in the terminal? And can you check the Output panel for what the error is when we try to run that interpreter to get information about it?

@brettcannon brettcannon added the info-needed Issue requires more information from poster label Dec 7, 2022
@glocker1
Copy link
Author

glocker1 commented Dec 7, 2022

Manually from terminal has no issues.

3

The Output window is always blank.

If I delete the Code folder, start VSC from scratch, then browse to my python install, this is the pop-up I get:

4

This is my settings file:

6

I can see VSC saying "detecting python interpreters" in the bottom, left corner when I start VSC. I reviewed the various log files I could find and didn't see anything that seemed relevant to this issue.

@brettcannon
Copy link
Member

The Output window is always blank.

Did you by chance have the "Tasks" channel in the Output window selected? If so, then that would explain the empty output. Please try again and set the channel to "Python".

image

@glocker1
Copy link
Author

glocker1 commented Dec 8, 2022

Data from Output with Python channel selected.

output.txt

Data from Output with Python Language Server selected

language server.txt

@brettcannon
Copy link
Member

I see the issue in your logs from the Output channel:

> ~\AppData\Local\Programs\Python\Python311\python.exe ~\.vscode\extensions\ms-python.python-2022.21.13411007\pythonFiles\get_output_via_markers.py ~\.vscode\extensions\ms-python.python-2022.21.13411007\pythonFiles\interpreterInfo.py
[ERROR 2022-11-8 14:43:54.6]: [Error: spawn C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\QuickTime\QTSystem\;c:\windows\system32;c:\windows\system32\wbem;C:\Program Files (x86)\CCL-Forensics\Epilog;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Common Files\Apple\Mobile Device Support;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files (x86)\Common Files\Apple\Mobile Device Support;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files (x86)\Gpg4win\..\GnuPG\bin;C:\WINDOWS\system32\cmd.exe; ENOENT
	at ChildProcess._handle.onexit (node:internal/child_process:283:19)
	at onErrorNT (node:internal/child_process:478:16)
	at process.processTicksAndRejections (node:internal/process/task_queues:83:21)] {
  errno: -4058,
  code: 'ENOENT',

So when we ask Node to try and run the interpreter we are told it can't be found (the ENOENT error).

Can I ask why you hard-coded the path to your interpreter? If this a Microsoft Store install then there's quirky things where we have to use a different path that we will find automatically. And if this is an install from python.org, we will find it via your Registry.

@glocker1
Copy link
Author

glocker1 commented Dec 9, 2022

This is a python install from python.org.
On a clean reset or clean install of python, VSC tells me nothing is found and to install python as shown here

7

I browsed manually via, enter interpreter path, as a test trying to get VSC to see python.

I can uninstall both, delete whatever folders you want, install python into C:\python311, or anything else you want to try.

@brettcannon
Copy link
Member

We are probably not "finding" it for the same reason specifying it manually isn't working: when we try and run the binary, Node gives us a ENOENT error and so we skip it since it's unusable for us.

Are the permissions in any way odd on the binary or directory? I also noticed that when you tested this in a terminal you didn't use ~, so does that make a difference when you try to run the same command manually? I.e. can you run this exactly in the terminal?

~\AppData\Local\Programs\Python\Python311\python.exe ~\.vscode\extensions\ms-python.python-2022.21.13411007\pythonFiles\get_output_via_markers.py ~\.vscode\extensions\ms-python.python-2022.21.13411007\pythonFiles\interpreterInfo.py

@glocker1
Copy link
Author

glocker1 commented Dec 9, 2022

All the file/folder permissions look fine. The response from the terminal command is interesting.

8

PS correctly resolved the ~ for the python exe path, but the passed in extension path says "\dave\~\.vscode\". I'm guessing the ~ in the folder path is causing the file not found error?

If I take out the ~ in the command line args and replace with the full path, the command works

9

@brettcannon brettcannon removed the info-needed Issue requires more information from poster label Dec 12, 2022
@karrtikr
Copy link

@glocker1 Please try using Command prompt instead of Powershell and run the command, as we use that internally. Also, what is the value of ComSpec environment variable, run:

set ComSpec

Your issue is likely a dup of #16692.

@karrtikr karrtikr added info-needed Issue requires more information from poster area-environments Features relating to handling interpreter environments labels Dec 13, 2022
@glocker1
Copy link
Author

All the environment variables are attached to an earlier post but ComSpec is also shown in the below pic. I thought ~ only worked in PowerShell and not from a DOS prompt?

10

@karrtikr
Copy link

Your ComSpec environment variable is wrong. It should be ComSpec=C:\WINDOWS\system32\cmd.exe.

image

You have to fix it using the environment variable UI. In the start menu type 'environment`, you should get this option
image

Click on the following button:
image

You should see ComSpec in the System Environment variable section:
image

Fix that, then close and re-open all instances of VS Code.

@karrtikr
Copy link

Essentially the ENOENT (-4058) error with -c " " error usually means that Node exec tried to get default shell on Windows using ComSpec and since ComSpec was wrong it was failing while trying to shell execute python commands.

@glocker1
Copy link
Author

glocker1 commented Dec 13, 2022 via email

@karrtikr
Copy link

Yes, AFAIK the env variable is not supposed to be used that way.

@glocker1
Copy link
Author

Will fix when I get home. I saw that fix in another closed ticket but didn't realize it was supposed to be the only thing in ComSpec. Unknown how that machine got that way. I just checked 5 other machines at the office and they all have comspec set to just the cmd.exe path.

@glocker1
Copy link
Author

Of course that fixed the issue. Sorry about that, I hate wasting time on issues where a fix is already available.

Hopefully the older ticket and this ticket will help someone else realize that comspec should only have the path to the default shell

@karrtikr
Copy link

Awesome. With #16692 we can show a prompt to the user instead so they need not rely on searching through tickets. Closing this.

@karrtikr karrtikr closed this as not planned Won't fix, can't repro, duplicate, stale Dec 14, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 15, 2023
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 info-needed Issue requires more information from poster triage-needed Needs assignment to the proper sub-team
Projects
None yet
Development

No branches or pull requests

6 participants