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

Add a diagnostic to validate COMSPEC env variable #18791

Closed
jose-jordan opened this issue Mar 27, 2022 · 24 comments
Closed

Add a diagnostic to validate COMSPEC env variable #18791

jose-jordan opened this issue Mar 27, 2022 · 24 comments
Assignees
Labels
area-environments Features relating to handling interpreter environments feature-request Request for new features or functionality

Comments

@jose-jordan
Copy link

jose-jordan commented Mar 27, 2022

Perhaps it'll be sufficient to make sure it carries:

  • A path that exists.
  • It's a file and not a folder.

Note according to https://postgrespro.com/list/thread-id/1529515 it may also end with a semicolon, so some investigate research may also be required to double check the possibilities.

@jose-jordan jose-jordan added triage-needed Needs assignment to the proper sub-team feature-request Request for new features or functionality labels Mar 27, 2022
@karthiknadig
Copy link
Member

Thanks for the bug report, but unfortunately, we need some more information from you in order to triage this issue appropriately. Please follow instructions here to create a new bug with all the critical details we need for diagnosis.

@jose-jordan
Copy link
Author

image

@karthiknadig
Copy link
Member

@jose-jordan please use the bug reporting feature in VS Code to report bugs. Also, please include the logs from Output > Python . We don't have any information here to figure out what is going on I you don't provide the information we need.

@jose-jordan
Copy link
Author

jose-jordan commented Mar 30, 2022

This is from output>python.

Experiment 'pythonaacf' is active
Experiment 'pythonTensorboardExperiment' is active
Experiment 'PythonPyTorchProfiler' is active
Experiment 'pythonDeprecatePythonPath' is active
Experiment 'pythonInterpreterInfoPinned' is active
> conda info --json
> ~\AppData\Local\Programs\Python\Python38-32\python.exe ~\.vscode\extensions\ms-python.python-2022.2.1924087327\pythonFiles\get_output_via_markers.py ~\.vscode\extensions\ms-python.python-2022.2.1924087327\pythonFiles\interpreterInfo.py
[ERROR 2022-2-30 10:22:36.855]: [Error: spawn C:\Users\PyCharm 2018.3.7 ENOENT
	at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
	at onErrorNT (internal/child_process.js:465:16)
	at processTicksAndRejections (internal/process/task_queues.js:80:21)] {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'spawn C:\\Users\\PyCharm 2018.3.7',
  path: 'C:\\Users\\PyCharm 2018.3.7',
  spawnargs: [
    '-c',
    'C:\\Users\\bawa\\AppData\\Local\\Programs\\Python\\Python38-32\\python.exe c:\\Users\\bawa\\.vscode\\extensions\\ms-python.python-2022.2.1924087327\\pythonFiles\\get_output_via_markers.py c:\\Users\\bawa\\.vscode\\extensions\\ms-python.python-2022.2.1924087327\\pythonFiles\\interpreterInfo.py'
  ],
  cmd: 'C:\\Users\\bawa\\AppData\\Local\\Programs\\Python\\Python38-32\\python.exe c:\\Users\\bawa\\.vscode\\extensions\\ms-python.python-2022.2.1924087327\\pythonFiles\\get_output_via_markers.py c:\\Users\\bawa\\.vscode\\extensions\\ms-python.python-2022.2.1924087327\\pythonFiles\\interpreterInfo.py'
}
[ERROR 2022-2-30 10:22:38.310]: No python is installed or a refresh has not already been triggered
> python -c "import sys;print(sys.executable)"
[ERROR 2022-2-30 10:22:38.348]: [Error: spawn C:\Users\PyCharm 2018.3.7 ENOENT
	at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
	at onErrorNT (internal/child_process.js:465:16)
	at processTicksAndRejections (internal/process/task_queues.js:80:21)] {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'spawn C:\\Users\\PyCharm 2018.3.7',
  path: 'C:\\Users\\PyCharm 2018.3.7',
  spawnargs: [ '-c', 'python -c "import sys;print(sys.executable)"' ],
  cmd: 'python -c "import sys;print(sys.executable)"'
}
> python -c "import sys;print(sys.executable)"
[ERROR 2022-2-30 10:22:38.351]: [Error: spawn C:\Users\PyCharm 2018.3.7 ENOENT
	at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
	at onErrorNT (internal/child_process.js:465:16)
	at processTicksAndRejections (internal/process/task_queues.js:80:21)] {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'spawn C:\\Users\\PyCharm 2018.3.7',
  path: 'C:\\Users\\PyCharm 2018.3.7',
  spawnargs: [ '-c', 'python -c "import sys;print(sys.executable)"' ],
  cmd: 'python -c "import sys;print(sys.executable)"'
}
> python -c "import sys;print(sys.executable)"
[ERROR 2022-2-30 10:22:38.354]: [Error: spawn C:\Users\PyCharm 2018.3.7 ENOENT
	at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
	at onErrorNT (internal/child_process.js:465:16)
	at processTicksAndRejections (internal/process/task_queues.js:80:21)] {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'spawn C:\\Users\\PyCharm 2018.3.7',
  path: 'C:\\Users\\PyCharm 2018.3.7',
  spawnargs: [ '-c', 'python -c "import sys;print(sys.executable)"' ],
  cmd: 'python -c "import sys;print(sys.executable)"'
}
> python -c "import sys;print(sys.executable)"
[ERROR 2022-2-30 10:22:38.358]: [Error: spawn C:\Users\PyCharm 2018.3.7 ENOENT
	at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
	at onErrorNT (internal/child_process.js:465:16)
	at processTicksAndRejections (internal/process/task_queues.js:80:21)] {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'spawn C:\\Users\\PyCharm 2018.3.7',
  path: 'C:\\Users\\PyCharm 2018.3.7',
  spawnargs: [ '-c', 'python -c "import sys;print(sys.executable)"' ],
  cmd: 'python -c "import sys;print(sys.executable)"'
}
> python -c "import sys;print(sys.executable)"
[ERROR 2022-2-30 10:22:38.361]: [Error: spawn C:\Users\PyCharm 2018.3.7 ENOENT
	at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
	at onErrorNT (internal/child_process.js:465:16)
	at processTicksAndRejections (internal/process/task_queues.js:80:21)] {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'spawn C:\\Users\\PyCharm 2018.3.7',
  path: 'C:\\Users\\PyCharm 2018.3.7',
  spawnargs: [ '-c', 'python -c "import sys;print(sys.executable)"' ],
  cmd: 'python -c "import sys;print(sys.executable)"'
}
> python -c "import sys;print(sys.executable)"
[ERROR 2022-2-30 10:22:38.364]: [Error: spawn C:\Users\PyCharm 2018.3.7 ENOENT
	at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
	at onErrorNT (internal/child_process.js:465:16)
	at processTicksAndRejections (internal/process/task_queues.js:80:21)] {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'spawn C:\\Users\\PyCharm 2018.3.7',
  path: 'C:\\Users\\PyCharm 2018.3.7',
  spawnargs: [ '-c', 'python -c "import sys;print(sys.executable)"' ],
  cmd: 'python -c "import sys;print(sys.executable)"'
}
> python -c "import sys;print(sys.executable)"
[ERROR 2022-2-30 10:22:38.376]: [Error: spawn C:\Users\PyCharm 2018.3.7 ENOENT
	at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
	at onErrorNT (internal/child_process.js:465:16)
	at processTicksAndRejections (internal/process/task_queues.js:80:21)] {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'spawn C:\\Users\\PyCharm 2018.3.7',
  path: 'C:\\Users\\PyCharm 2018.3.7',
  spawnargs: [ '-c', 'python -c "import sys;print(sys.executable)"' ],
  cmd: 'python -c "import sys;print(sys.executable)"'
}
Starting Pylance language server.
[ERROR 2022-2-30 10:22:39.811]: No python is installed or a refresh has not already been triggered
Diagnostic Code: NoPythonInterpretersDiagnostic, Message: Python is not installed. Please download and install Python before using the extension.
> python -c "import sys;print(sys.executable)"
[ERROR 2022-2-30 10:22:39.896]: [Error: spawn C:\Users\PyCharm 2018.3.7 ENOENT
	at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
	at onErrorNT (internal/child_process.js:465:16)
	at processTicksAndRejections (internal/process/task_queues.js:80:21)] {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'spawn C:\\Users\\PyCharm 2018.3.7',
  path: 'C:\\Users\\PyCharm 2018.3.7',
  spawnargs: [ '-c', 'python -c "import sys;print(sys.executable)"' ],
  cmd: 'python -c "import sys;print(sys.executable)"'
}
> python -c "import sys;print(sys.executable)"
[ERROR 2022-2-30 10:22:39.903]: [Error: spawn C:\Users\PyCharm 2018.3.7 ENOENT
	at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
	at onErrorNT (internal/child_process.js:465:16)
	at processTicksAndRejections (internal/process/task_queues.js:80:21)] {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'spawn C:\\Users\\PyCharm 2018.3.7',
  path: 'C:\\Users\\PyCharm 2018.3.7',
  spawnargs: [ '-c', 'python -c "import sys;print(sys.executable)"' ],
  cmd: 'python -c "import sys;print(sys.executable)"'
}
> python -c "import sys;print(sys.executable)"
[ERROR 2022-2-30 10:22:43.913]: [Error: spawn C:\Users\PyCharm 2018.3.7 ENOENT
	at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
	at onErrorNT (internal/child_process.js:465:16)
	at processTicksAndRejections (internal/process/task_queues.js:80:21)] {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'spawn C:\\Users\\PyCharm 2018.3.7',
  path: 'C:\\Users\\PyCharm 2018.3.7',
  spawnargs: [ '-c', 'python -c "import sys;print(sys.executable)"' ],
  cmd: 'python -c "import sys;print(sys.executable)"'
}
> python -c "import sys;print(sys.executable)"
[ERROR 2022-2-30 10:22:48.650]: [Error: spawn C:\Users\PyCharm 2018.3.7 ENOENT
	at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
	at onErrorNT (internal/child_process.js:465:16)
	at processTicksAndRejections (internal/process/task_queues.js:80:21)] {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'spawn C:\\Users\\PyCharm 2018.3.7',
  path: 'C:\\Users\\PyCharm 2018.3.7',
  spawnargs: [ '-c', 'python -c "import sys;print(sys.executable)"' ],
  cmd: 'python -c "import sys;print(sys.executable)"'
}
[ERROR 2022-2-30 10:22:59.130]: No python is installed or a refresh has not already been triggered
> python -c "import sys;print(sys.executable)"
[ERROR 2022-2-30 10:22:59.163]: [Error: spawn C:\Users\PyCharm 2018.3.7 ENOENT
	at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
	at onErrorNT (internal/child_process.js:465:16)
	at processTicksAndRejections (internal/process/task_queues.js:80:21)] {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'spawn C:\\Users\\PyCharm 2018.3.7',
  path: 'C:\\Users\\PyCharm 2018.3.7',
  spawnargs: [ '-c', 'python -c "import sys;print(sys.executable)"' ],
  cmd: 'python -c "import sys;print(sys.executable)"'
}
> python -c "import sys;print(sys.executable)"
[ERROR 2022-2-30 10:22:59.167]: [Error: spawn C:\Users\PyCharm 2018.3.7 ENOENT
	at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
	at onErrorNT (internal/child_process.js:465:16)
	at processTicksAndRejections (internal/process/task_queues.js:80:21)] {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'spawn C:\\Users\\PyCharm 2018.3.7',
  path: 'C:\\Users\\PyCharm 2018.3.7',
  spawnargs: [ '-c', 'python -c "import sys;print(sys.executable)"' ],
  cmd: 'python -c "import sys;print(sys.executable)"'
}
> python -c "import sys;print(sys.executable)"
[ERROR 2022-2-30 10:22:59.169]: [Error: spawn C:\Users\PyCharm 2018.3.7 ENOENT
	at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
	at onErrorNT (internal/child_process.js:465:16)
	at processTicksAndRejections (internal/process/task_queues.js:80:21)] {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'spawn C:\\Users\\PyCharm 2018.3.7',
  path: 'C:\\Users\\PyCharm 2018.3.7',
  spawnargs: [ '-c', 'python -c "import sys;print(sys.executable)"' ],
  cmd: 'python -c "import sys;print(sys.executable)"'
}
> python -c "import sys;print(sys.executable)"
[ERROR 2022-2-30 10:22:59.174]: [Error: spawn C:\Users\PyCharm 2018.3.7 ENOENT
	at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
	at onErrorNT (internal/child_process.js:465:16)
	at processTicksAndRejections (internal/process/task_queues.js:80:21)] {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'spawn C:\\Users\\PyCharm 2018.3.7',
  path: 'C:\\Users\\PyCharm 2018.3.7',
  spawnargs: [ '-c', 'python -c "import sys;print(sys.executable)"' ],
  cmd: 'python -c "import sys;print(sys.executable)"'
}
> python -c "import sys;print(sys.executable)"
[ERROR 2022-2-30 10:23:7.200]: [Error: spawn C:\Users\PyCharm 2018.3.7 ENOENT
	at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
	at onErrorNT (internal/child_process.js:465:16)
	at processTicksAndRejections (internal/process/task_queues.js:80:21)] {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'spawn C:\\Users\\PyCharm 2018.3.7',
  path: 'C:\\Users\\PyCharm 2018.3.7',
  spawnargs: [ '-c', 'python -c "import sys;print(sys.executable)"' ],
  cmd: 'python -c "import sys;print(sys.executable)"'
}

@jose-jordan
Copy link
Author

and this is form help>toggle developer tools.
image

@karthiknadig karthiknadig reopened this Mar 30, 2022
@karthiknadig karthiknadig self-assigned this Mar 30, 2022
@karthiknadig karthiknadig added triage bug Issue identified by VS Code Team member as probable bug area-environments Features relating to handling interpreter environments and removed feature-request Request for new features or functionality triage-needed Needs assignment to the proper sub-team labels Mar 30, 2022
@karthiknadig
Copy link
Member

@jose-jordan Can you share the full path of where you have python installed? Also, can you run these commands from your command prompt and share the results:

> set COMSPEC
> set PATH

@karthiknadig karthiknadig added the info-needed Issue requires more information from poster label Mar 30, 2022
@karrtikr
Copy link

Can you run the following in command prompt and send the output?

python -c "import sys;print(sys.executable)"

@jose-jordan
Copy link
Author

image

@karrtikr
Copy link

Can you also run set COMSPEC as asked earlier?

@jose-jordan
Copy link
Author

image

@karrtikr karrtikr added investigating We are looking into the cause of the issue and removed info-needed Issue requires more information from poster triage labels Mar 31, 2022
@karrtikr
Copy link

karrtikr commented Mar 31, 2022

COMSPEC is set to an incorrect value, search for "Edit environment variables" in the start menu, then click here:
image

Look for Comspec in System variables:
image

And change it to contain C:\windows\system32\cmd.exe instead.

Let me know if it helps!

@karrtikr karrtikr reopened this Mar 31, 2022
@karrtikr karrtikr added the info-needed Issue requires more information from poster label Mar 31, 2022
@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Mar 31, 2022
@karrtikr karrtikr changed the title python is not installed error in vs code. python is not installed error in vs code (when COMSPEC env variable isn't set appropriately) Mar 31, 2022
@karrtikr karrtikr removed the triage-needed Needs assignment to the proper sub-team label Mar 31, 2022
@karthiknadig
Copy link
Member

karthiknadig commented Mar 31, 2022

@jose-jordan Typicaly ComSpec is supposed to be set to this value:
image

@karrtikr Might be a good idea to add a diagnostic to validate that the ComSpec is pointing to a valid cmd.exe or some file that exists.

@jose-jordan
Copy link
Author

sir i try it and give answer give me some time please.thanks for help

@jose-jordan
Copy link
Author

image

@karrtikr karrtikr added feature-request Request for new features or functionality needs PR and removed bug Issue identified by VS Code Team member as probable bug investigating We are looking into the cause of the issue labels Mar 31, 2022
@karrtikr karrtikr assigned karrtikr and unassigned karthiknadig and karrtikr Mar 31, 2022
@karrtikr karrtikr changed the title python is not installed error in vs code (when COMSPEC env variable isn't set appropriately) Add a diagnostic to validate COMSPEC env variable Mar 31, 2022
@jose-jordan
Copy link
Author

image

@jose-jordan
Copy link
Author

image

@jose-jordan
Copy link
Author

image

@karrtikr
Copy link

karrtikr commented Mar 31, 2022

Seems like it worked for you. The other issue you face is not related to the Python extension, I recommend you to delete the setting workbench.editorAssociations and re-set it using the settings UI. Run Open User settings command.

@jose-jordan
Copy link
Author

image

@jose-jordan
Copy link
Author

[{
"resource": "/C:/Users/bawa/AppData/Roaming/Code/User/settings.json",
"owner": "generated_diagnostic_collection_name#1",
"code": "2",
"severity": 4,
"message": "This is deprecated, the new recommended way to configure your default shell is by creating a terminal profile in #terminal.integrated.profiles.windows# and setting its profile name as the default in #terminal.integrated.defaultProfile.windows#. This will currently take priority over the new profiles settings but that will change in the future.",
"startLineNumber": 5,
"startColumn": 5,
"endLineNumber": 5,
"endColumn": 81
}]

@karrtikr
Copy link

Please just follow the instructions in the Problems window, remove that setting to start with.

@karrtikr karrtikr removed the info-needed Issue requires more information from poster label Mar 31, 2022
@karthiknadig
Copy link
Member

The COMSPEC diagnostic is duplicate of #16692

@jose-jordan
Copy link
Author

sir is there any option to get help for solving my problems in vs code.i want to run vs code but in https://github.com/microsoft/vscode, there is no one come to help me like you.please help me sir

@karrtikr
Copy link

karrtikr commented Apr 3, 2022

You can ask your questions on stack overflow here: https://stackoverflow.com/questions/tagged/visual-studio-code

Or you can also ask them here: https://github.com/microsoft/vscode-python/discussions

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 4, 2022
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 feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

3 participants