Vscode-python: "Python was not found but can be installed from the Microsoft Store"

Created on 25 May 2020  路  4Comments  路  Source: microsoft/vscode-python

Hello!
I am new to python and have recently moved from Spyder to VS and i am trying to get used to it, however I am having problems to properly install VS.
I have installed VS, python extension , anaconda extension, selected a conda environment and tried to run a sample code, what is weird is that the code do run in the pyrhon interactive, however not in the output terminal. However I do not get the prints as i expect.
Do you have any clue of what could i try?

image

I have checked some similar issues and I am not sure, if it might be related to the settings.json
image

This is the version of VS for windows i am using
Version: 1.45.1 (user setup)

Thanks

info needed type-bug

Most helpful comment

Hi @DTKx 馃憢

You're running code-runner extension to run the python file, not the python extension. You've selected the interpreter in the python extension, but code-runner extension doesn't know data from the python extension, unless you configure it. Please check the code runner docs on how to do that. If you're still having problems, you can file an issue at https://github.com/formulahendry/vscode-code-runner

Or you can try the solution below

what is weird is that the code do run in the pyrhon interactive, however not in the output terminal

How did you run the code in output terminal? I am assuming you used the run icon on the top right, that comes from the code runner extension. If you uninstall the code runner extension, you'll start to see a green icon which comes from the extension, that'll run your files using the extension so there won't be any problems.

You can also open the command palette (CTRL+SHIFT+P) and use the extension command Run Python file in terminal to run files.

Hope that helps!

All 4 comments

To try to solve this, I have just tried to install the same python version from Anaconda 3.7.6, however the same error still appears.
"Python was not found but can be installed from the Microsoft Store:"

Hi @DTKx 馃憢

You're running code-runner extension to run the python file, not the python extension. You've selected the interpreter in the python extension, but code-runner extension doesn't know data from the python extension, unless you configure it. Please check the code runner docs on how to do that. If you're still having problems, you can file an issue at https://github.com/formulahendry/vscode-code-runner

Or you can try the solution below

what is weird is that the code do run in the pyrhon interactive, however not in the output terminal

How did you run the code in output terminal? I am assuming you used the run icon on the top right, that comes from the code runner extension. If you uninstall the code runner extension, you'll start to see a green icon which comes from the extension, that'll run your files using the extension so there won't be any problems.

You can also open the command palette (CTRL+SHIFT+P) and use the extension command Run Python file in terminal to run files.

Hope that helps!

Hello @karrtikr thaaaaaanks!
haha it fit like a glove, indeed the problem was the code runner path.
Now I just have some issues with my virtual environments, but thats for me.
Sorry for the dummy question!

Thaanks!

Glad it worked for you, happy coding in VSCode!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kimadeline picture kimadeline  路  4Comments

PyaePhyoKhant picture PyaePhyoKhant  路  5Comments

misharigot picture misharigot  路  4Comments

Kludex picture Kludex  路  5Comments

Shahaed picture Shahaed  路  5Comments