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

Python is not installed #16684

Closed
TogrulKazimov opened this issue Jul 14, 2021 · 15 comments
Closed

Python is not installed #16684

TogrulKazimov opened this issue Jul 14, 2021 · 15 comments

Comments

@TogrulKazimov
Copy link

Issue Type: Performance Issue

It is already been 3 months that I cannot use VS code as Python IDE. Both Python and Jupyter extensions keep saying the same issue. 'Python is not installed. Please download and install Python in order to execute cells in this notebook.'

Jupyter output is like that:
Info 2021-07-14 17:36:26: Finished executing cell NotebookImport#0
Error 2021-07-14 17:36:26: DataScience Error [i [Error]: Failed to find a kernelspec to use for ipykernel launch
at E.createNotebookInstance (c:\Users\Togrul.vscode\extensions\ms-toolsai.jupyter-2021.8.1013163132\out\client\extension.js:90:440163)
at runMicrotasks ()
at processTicksAndRejections (internal/process/task_queues.js:93:5)] {
category: 'kernelspecnotfound',
notebookMetadata: {
language_info: {
codemirror_mode: [Object],
file_extension: '.py',
mimetype: 'text/x-python',
name: 'python',
nbconvert_exporter: 'python',
pygments_lexer: 'ipython3',
version: 3
},
orig_nbformat: 4
}
}
And a screenshot of the problem:
image

Extension version: 2021.8.1013163132
VS Code version: Code 1.58.1 (2aeda6b18e13c4f4f9edf6667158a6b8d408874b, 2021-07-13T06:58:28.115Z)
OS version: Windows_NT x64 10.0.19041
Restricted Mode: No

System Info
Item Value
CPUs Intel(R) Core(TM) i5-4210U CPU @ 1.70GHz (4 x 1696)
GPU Status 2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: enabled_on
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 5.91GB (1.87GB free)
Process Argv --crash-reporter-id e4816a9b-156d-4ca1-9430-5b5944115f67
Screen Reader no
VM 0%
Process Info
CPU %	Mem MB	   PID	Process
    0	   104	 10128	code main
    0	    24	  3040	   crashpad-handler
    0	    39	  3164	   utility
   10	    82	  4232	   shared-process
    0	    59	 14320	     ptyHost
    0	   121	  6264	   gpu-process
    0	   113	  7752	   window (● Untitled-1.ipynb - Visual Studio - Visual Studio Code)
    0	   135	  5932	     extensionHost
    0	    65	  3844	       "C:\Users\Togrul\AppData\Local\Programs\Microsoft VS Code\Code.exe" "c:\Users\Togrul\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\json-language-features\server\dist\node\jsonServerMain" --node-ipc --clientProcessId=5932
    0	    12	  8772	     watcherService 
    0	    11	 13392	       console-window-host (Windows internal process)
    0	    63	 13112	     searchService
    3	    78	 11020	   window (Issue Reporter)
    0	    69	 11960	   window (undefined)
    0	   113	 14088	   window (undefined)
Workspace Info
|  Window (● Untitled-1.ipynb - Visual Studio - Visual Studio Code)
|    Folder (Visual Studio): 10101 files
|      File types: xhtml(4510) jpg(2554) ini(586) py(573) ipynb(292) html(230)
|                  csv(121) xlsx(112) png(70) txt(63)
|      Conf files: settings.json(2) launch.json(1)
|      Launch Configs: python;
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383:30185418
pythonvspyt678:30270856
pythonvspyt602:30300191
vspor879:30202332
vspor708:30202333
vspor363:30204092
vstes627:30244334
pythonvspyt639:30300192
pythontb:30283811
pythonvspyt551cf:30311713
vspre833:30321513
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
pythondataviewer:30285071
vscus158:30321503
pythonvsuse255cf:30335482
vscod805:30301674
pythonvspyt200:30331937
vscextlangct:30333562
binariesv615:30325510
vsccppwt:30329788
bridge0708:30335490

@rchiodo
Copy link

rchiodo commented Jul 14, 2021

Thanks for the bug. Where is your python installation? Additionally if you could include the contents of the 'Python' and 'Jupyter' output tab that would be helpful.

@rchiodo rchiodo transferred this issue from microsoft/vscode-jupyter Jul 14, 2021
@rchiodo rchiodo transferred this issue from microsoft/vscode-python Jul 14, 2021
@rchiodo rchiodo removed their assignment Jul 14, 2021
@TogrulKazimov
Copy link
Author

Thanks for the bug. Where is your python installation? Additionally if you could include the contents of the 'Python' and 'Jupyter' output tab that would be helpful.

@rchiodo, I have already indicated the output of Jupyter in the content of issue, Python extension output is below:
"Error 2021-07-14 20:51:21: Invalid Python Path 'c:\Users\Togrul\AppData\Local\Programs\Python\Python38\python.exe'"

Also Python installed in c:\Users\Togrul\AppData\Local\Programs\Python\Python38\python.exe' folder. I have Python 38, 39, 39-32 versions. Path for all of them is the same kind.

This below is the output of Jupyter:
Error 2021-07-14 20:53:40: DataScience Error [i [Error]: Failed to find a kernelspec to use for ipykernel launch
at E.createNotebookInstance (c:\Users\Togrul.vscode\extensions\ms-toolsai.jupyter-2021.8.1013163132\out\client\extension.js:90:440163)
at runMicrotasks ()
at processTicksAndRejections (internal/process/task_queues.js:93:5)] {
category: 'kernelspecnotfound',
notebookMetadata: {
language_info: {
codemirror_mode: [Object],
file_extension: '.py',
mimetype: 'text/x-python',
name: 'python',
nbconvert_exporter: 'python',
pygments_lexer: 'ipython3',
version: 3
},
orig_nbformat: 4
}
}

@rchiodo
Copy link

rchiodo commented Jul 14, 2021

That wouldn't be the entire output. Can you copy the entire contents of both output panes? That error message is a result of the failure that prevents anything from running. There should be a bunch of output above that which hopefully indicates why.

@TogrulKazimov
Copy link
Author

That wouldn't be the entire output. Can you copy the entire contents of both output panes? That error message is a result of the failure that prevents anything from running. There should be a bunch of output above that which hopefully indicates why.

image
am I looking to the right place?

@rchiodo
Copy link

rchiodo commented Jul 14, 2021

Yeah that's the correct spot. That output is from the python extension. It looks like it thinks your python.exe is invalid (which would explain the message you get from the jupyter extension).

Can you set this setting:

image

And try again? I'm transferring this to the python extension repo as it looks like the fault is there. They'll want to see the output pane after you set that setting.

Thanks

@rchiodo rchiodo transferred this issue from microsoft/vscode-jupyter Jul 14, 2021
@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Jul 14, 2021
@TogrulKazimov
Copy link
Author

Yeah that's the correct spot. That output is from the python extension. It looks like it thinks your python.exe is invalid (which would explain the message you get from the jupyter extension).

Can you set this setting:

image

And try again? I'm transferring this to the python extension repo as it looks like the fault is there. They'll want to see the output pane after you set that setting.

Thanks

Nothing has changed actually.
image

@karthiknadig karthiknadig changed the title Pyhton is not installed Python is not installed Jul 14, 2021
@karthiknadig
Copy link
Member

@TogrulKazimov Can you try running this from command line (outside of VS Code):

c:\Users\Togrul\AppData\Local\Programs\Python\Python38\python.exe -c "import sys;print(sys.executable)"

If that works then you should see the same path as the python.exe. then try running this:

c:\Users\Togrul\AppData\Local\Programs\Python\Python38\python.exe c:\Users\Togrul\.vscode\extensions\ms-python.python-2021.6.944021595\pythonFiles\interpreterInfo.py

Make sure the path the interpreterInfo.py is correct. Run that command and see what you get. If things are right you should get a JSON with some details about the interpreter. Please provide the complete text.

@TogrulKazimov
Copy link
Author

@TogrulKazimov Can you try running this from command line (outside of VS Code):

c:\Users\Togrul\AppData\Local\Programs\Python\Python38\python.exe -c "import sys;print(sys.executable)"

If that works then you should see the same path as the python.exe. then try running this:

c:\Users\Togrul\AppData\Local\Programs\Python\Python38\python.exe c:\Users\Togrul\.vscode\extensions\ms-python.python-2021.6.944021595\pythonFiles\interpreterInfo.py

Make sure the path the interpreterInfo.py is correct. Run that command and see what you get. If things are right you should get a JSON with some details about the interpreter. Please provide the complete text.

I think everything is okay, with this path:
python.python-2021.6.944021595\pythonFiles\interpreterInfo.py
{"versionInfo": [3, 8, 10, "final", 0], "sysPrefix": "c:\Users\Togrul\AppData\Local\Programs\Python\Python38", "sysVersion": "3.8.10 (tags/v3.8.10:3d8993a, May 3 2021, 11:48:03) [MSC v.1928 64 bit (AMD64)]", "is64Bit": true}
image

@karthiknadig
Copy link
Member

@TogrulKazimov Can you share your environment variables?

@TogrulKazimov
Copy link
Author

@TogrulKazimov Can you share your environment variables?
How can I?

@karthiknadig
Copy link
Member

Just run the command set from your command line.
image

@TogrulKazimov
Copy link
Author

C:\Users\Togrul>set
ALLUSERSPROFILE=C:\ProgramData
APPDATA=C:\Users\Togrul\AppData\Roaming
btp=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem
CommonProgramFiles=C:\Program Files\Common Files
CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
CommonProgramW6432=C:\Program Files\Common Files
COMPUTERNAME=DESKTOP-6T66PK4
ComSpec=C:\Windows\system32
DriverData=C:\Windows\System32\Drivers\DriverData
FPS_BROWSER_APP_PROFILE_STRING=Internet Explorer
FPS_BROWSER_USER_PROFILE_STRING=Default
HOMEDRIVE=C:
HOMEPATH=\Users\Togrul
LOCALAPPDATA=C:\Users\Togrul\AppData\Local
LOGONSERVER=\DESKTOP-6T66PK4
MFilesVersion=21.6.10322.8
NUMBER_OF_PROCESSORS=4
OneDrive=C:\Users\Togrul\OneDrive
OneDriveConsumer=C:\Users\Togrul\OneDrive
OS=Windows_NT
Path=C:\Users\Togrul\AppData\Local\Programs\Python\Python38\Scripts;C:\Users\Togrul\AppData\Local\Programs\Python\Python38;C:\Users\Togrul\AppData\Roaming\Python\Python38\Scripts;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Windows\System32;C:\Program Files (x86)\Tesseract-OCR;C:\Program Files\CMake\bin;C:\Users\Togrul\AppData\Roaming\Python\Python39\Scripts;C:\Windows\system32\config\systemprofile\AppData\Local\Microsoft\WindowsApps;C:\Users\Togrul\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\Togrul\AppData\Local\Programs\Python\Python39-32\Scripts;C:\Users\Togrul\AppData\Local\Programs\Python\Python39-32;C:\Users\Togrul\AppData\Local\Programs\Python\Python38\Scripts;C:\Users\Togrul\AppData\Local\Programs\Python\Python38;C:\Users\Togrul\AppData\Local\Programs\Python\Python39\Scripts;C:\Users\Togrul\AppData\Local\Programs\Python\Python39;C:\Program Files\Python39\Scripts;C:\Users\Togrul\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Python39;C:\Users\Togrul\AppData\Roaming\Python\Python39\Scripts;C:\Users\Togrul\AppData\Local\Programs\Microsoft VS Code\bin;
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
PROCESSOR_ARCHITECTURE=AMD64
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 69 Stepping 1, GenuineIntel
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=4501
ProgramData=C:\ProgramData
ProgramFiles=C:\Program Files
ProgramFiles(x86)=C:\Program Files (x86)
ProgramW6432=C:\Program Files
PROMPT=$P$G
PSModulePath=C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules
PUBLIC=C:\Users\Public
PyCharm Community Edition=C:\Program Files\JetBrains\PyCharm Community Edition 2020.3.4\bin;
SESSIONNAME=Console
SystemDrive=C:
SystemRoot=C:\Windows
TEMP=C:\Users\Togrul\AppData\Local\Temp
TESSDATA_PREFIX=C:\Program Files (x86)\Tesseract-OCR
TMP=C:\Users\Togrul\AppData\Local\Temp
USERDOMAIN=DESKTOP-6T66PK4
USERDOMAIN_ROAMINGPROFILE=DESKTOP-6T66PK4
USERNAME=Togrul
USERPROFILE=C:\Users\Togrul
windir=C:\Windows

@karthiknadig
Copy link
Member

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

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.

@karthiknadig
Copy link
Member

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.

@TogrulKazimov
Copy link
Author

Thanks, @karthiknadig, it looks like the problem is solved. I think that is not me who changed that path, maybe the system changed it automatically.
I highly appreciate your contribution. I had to try 4-5 IDEs in place of VS code, none of them is as useful as VS Code. The problem occurred 4-5 months ago, till now I could not solve it.
Before closing the issue I need a bit of time to ensure that everything works fine, I do not want to open a new issue. By the end of the day, I will close the issue.

@karthiknadig karthiknadig removed the triage-needed Needs assignment to the proper sub-team label Jul 22, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants