Run Selection/Line in Python Terminal not working in python 3.12

Hi team,
I downloaded cursor few days back. Previously I used VS Code.
When I select a portion of my code and try to click “Run Selection/Line in Python Terminal”, nothing is sent to the terminal. Absolutely nothing. It works perfectly fine in VS Code.

I tried copying VS Code Settings, still it didn’t work. Even the short cuts didn’t work.

Then I tried to select “Run Selected Text” from Menu/Terminal. It worked for the code without the indentation ( starts from column 0). But it gave IndentationError: unexpected indent as soon as the selected code had Indentation.

Changing from cmd terminal to powershell terminal didn’t help either.

I subscribed to Pro version but I am not able to use it fully.

Can anyone help please ? I am using Cursor Version 3.3.30 (user_setup)

Thanks

Hey, thanks for the report. The second symptom, IndentationError: unexpected indent when sending indented code, is known behavior in the new interactive REPL that shipped in Python 3.13+. It handles pasted multi-line input differently. A workaround is to set the PYTHON_BASIC_REPL=1 environment variable, which forces the classic REPL.

Since you’re on Windows, add this to Cursor settings settings.json:

"terminal.integrated.env.windows": {
    "PYTHON_BASIC_REPL": "1"
}

Or set it system-wide via System Properties → Environment Variables. After that, restart Cursor, or at least recreate the terminal, then test again.

To confirm the variable is available in the Cursor terminal:

echo $env:PYTHON_BASIC_REPL    # PowerShell
echo %PYTHON_BASIC_REPL%       # cmd

It should print 1.

A couple of quick checks:

  • The title says Python 3.12, but this symptom is typical for 3.13+. Please verify the actual version with python --version in the terminal, and also check which interpreter is selected via Command Palette → Python: Select Interpreter.
  • Check the Python extension version in Cursor via Extensions sidebar → Python → version.

For the first symptom, where nothing gets sent to the terminal at all, it could be a keybinding conflict or the extension not activating. After applying the workaround above, let me know if that symptom is still happening and we’ll dig deeper.

Related thread with the same fix: Send line in Python3.14 for more than one line not working

Hi Dean Rie,
Thanks for responding. I did all of points you mentioned and it’s still the same.

Cursor

image

I don’t see the dropdown of the selected python interpreter (though I selected multiple times) as I see it in VS Code. Something is wrong here ?

Thanks

Cursor

I don’t see the python version (bottom right of Cursor) as I see in VS Code

VS Code

image

Few days back I copied all settings from VS Code to Cursor; it still didn’t solve the issue.

Thank you for checking

Cursor

image

I think there are 2 issues here:

a) IndentationError: unexpected indent : Change in REPL settings didn’t fix the issue.
In Terminal/Run Selected text, I still get the error if I select an indented code block and try to run the block.

b) Right click/Run Python/Run Selection/Line in Python Terminal: Nothing happens still now.

@deanrie Can help on this please ?

Hey, thanks, the env var is set correctly. But there’s an important detail. You’re on Python 3.12.12, and PYTHON_BASIC_REPL only affects the new PyREPL that was added in Python 3.13+. On 3.12, the classic REPL is already the default, so this env var won’t change anything for you. Sorry I suggested it, I was looking in the wrong direction.

Now to the actual issue. You have two symptoms, and they share the same root cause.

  1. The IndentationError from Run Selected Text in the Terminal menu is a raw paste from VS Code, with no preprocessing. The Python REPL complains about indented code at the top level. That’s normal interpreter behavior, not a bug.
  2. Run Selection/Line in Python Terminal does nothing. This command normally does a smart dedent before sending the code. If it worked, symptom 1 wouldn’t happen. This command is provided by the Microsoft Python extension ms-python.python.

So we need to fix Run Selection/Line in Python Terminal.

One more note about extensions. The Python extension from Anysphere you have installed, identifier anysphere.cursorpyright, is Cursor Pyright. It’s a type checker and language server, a fork of Pylance. It only affects type hints and autocomplete, it’s not related to running code. In your screenshot on the left, you also have Python from ms-python. That one should register the Run Selection/Line command.

To figure out why it’s not working, please send:

  1. Ctrl+Shift+P then Developer: Show Running Extensions. Find ms-python.python and share a screenshot. The status Activated or Failed and the activation time matter.
  2. View > Output, then in the dropdown on the right select Python. Screenshot the logs.
  3. Ctrl+Shift+P then start typing Python: Run Selection. Is that command even listed?

Hi Dean,
Thank you. Please see below the screenshots.

1.Ctrl+Shift+P then Developer: Show Running Extensions. Find ms-python.python and share a screenshot. The status Activated or Failed and the activation time matter.

I don’t find ms-python.python here.

3. Ctrl+Shift+P then start typing Python: Run Selection :

I don’t see it listed.

Thanks for the screenshots. A few important points.

That Python 1.0.10 extension in Running Extensions is built into Cursor, so you don’t need to remove it. It registers the python.venvPath setting, so the Microsoft ms-python.python extension, in your case Python 2025.6.1, shows the warning Cannot register 'python.venvPath'. This property is already registered. That warning by itself shouldn’t break Run Selection/Line in Python Terminal, but the fact that the command isn’t in the Command Palette and the selected interpreter isn’t shown in the status bar suggests that ms-python.python didn’t fully activate.

To figure out why, we need to check its logs. Please do this:

  • Open ViewOutput or press Ctrl+Shift+U.
  • Open the dropdown in the top right and send a screenshot of the full expanded list. I want to see if there’s a Python entry at all.
  • If Python is there, select it and send a screenshot of the output.
  • Also open Extensions with Ctrl+Shift+X, search for @installed python, and send a screenshot of the list. We need to see all Python-related extensions you have installed to rule out another conflict.
  • And just in case, go to HelpAbout and send the exact Cursor version.

Once we have the logs, we can figure out why ms-python isn’t bringing up its commands.