microsoft / vscode-python

Python extension for Visual Studio Code
https://aka.ms/pvsc-marketplace
MIT License
4.29k stars 1.17k forks source link

Error getting response from REPL server: Connection is closed #24017

Open rebornix opened 2 weeks ago

rebornix commented 2 weeks ago

Type: Bug

Behaviour

Python REPL doesn't work with following code. Once it's broken, it doesn't run any code

import pandas as pd

url = "/Users/penlv/Code/Test/notebook-test-data/pandas_ai/chipotle.tsv"

chipo = pd.read_csv(url, sep="\t")
chipo.head()

print(chipo.head())

Steps to reproduce:

Run above code (with your own csv/tsv file)

Diagnostic data

2024-08-28 11:32:41.459 [error] Error getting response from REPL server: [k [Error]: Connection is closed. at pe (/Users/penlv/.vscode-insiders/extensions/ms-python.python-2024.13.2024082701-darwin-arm64/out/client/extension.js:2:2074294) at Object.sendRequest (/Users/penlv/.vscode-insiders/extensions/ms-python.python-2024.13.2024082701-darwin-arm64/out/client/extension.js:2:2076652) at m.execute (/Users/penlv/.vscode-insiders/extensions/ms-python.python-2024.13.2024082701-darwin-arm64/out/client/extension.js:2:797706) at u.value (/Users/penlv/.vscode-insiders/extensions/ms-python.python-2024.13.2024082701-darwin-arm64/out/client/extension.js:2:823226) at i.executeHandler (/Users/penlv/.vscode-insiders/extensions/ms-python.python-2024.13.2024082701-darwin-arm64/out/client/extension.js:2:802734) at a.$executeCells (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:161:240529) at y.S (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:158:5968) at y.Q (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:158:5734) at y.M (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:158:4767) at y.L (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:158:3602) at i.value (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:158:2297) at r.B (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:90:732) at r.fire (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:90:949) at a.fire (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:115:14463) at i.value (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:184:8635) at r.B (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:90:732) at r.fire (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:90:949) at a.fire (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:115:14463) at MessagePortMain. (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:184:6761) at MessagePortMain.emit (node:events:519:28) at MessagePortMain._internalPort.emit (node:electron/js2c/utility_init:2:2619)] { code: 1

``` XXX ```

Extension version: 2024.13.2024082701 VS Code version: Code - Insiders 1.93.0-insider (Universal) (d1388fd24fc0acf17ae1f759e85c1acf559ed759, 2024-08-28T05:14:36.262Z) OS version: Darwin arm64 23.6.0 Modes:

User Settings

``` languageServer: "Pylance" ```

Installed Extensions |Extension Name|Extension Id|Version| |---|---|---| |EditorConfig for VS Code|EditorConfig.EditorConfig|0.16.4| |ESLint|dbaeumer.vscode-eslint|3.0.13| |Flame Chart Visualizer for JavaScript Profiles|ms-vscode.vscode-js-profile-flame|1.0.9| |GitHub Issue Notebooks|ms-vscode.vscode-github-issue-notebooks|0.0.130| |GitHub Theme|GitHub.github-vscode-theme|6.3.4| |JavaScript Debugger|ms-vscode.js-debug|1.92.0| |JavaScript Debugger Companion Extension|ms-vscode.js-debug-companion|1.1.3| |Mocha Test Explorer|hbenl.vscode-mocha-test-adapter|2.14.1| |Nord|arcticicestudio.nord-visual-studio-code|0.19.0| |PR Pinger|jrieken.vscode-pr-pinger|0.0.6| |Pylance|ms-python.vscode-pylance|2024.8.2| |Python|ms-python.python|2024.13.2024082701| |Python Debugger|ms-python.debugpy|2024.10.0| |Table Visualizer for JavaScript Profiles|ms-vscode.vscode-js-profile-table|1.0.9| |Test Adapter Converter|ms-vscode.test-adapter-converter|0.1.9| |Test Explorer UI|hbenl.vscode-test-explorer|2.21.1|
anthonykim1 commented 2 weeks ago

ext version: v2024.13.2024082701

I cannot repro this(tried with my own csv and given code, although it would def produce file not found error for second screenshot; didn't seem to crash REPL entirely):

Screenshot 2024-08-28 at 2 43 42 PM Screenshot 2024-08-28 at 2 44 13 PM

Are you somehow switching the interpreter/kernel in the middle?

Can you run

import sys
print(sys.executable)

inside the REPL and see what you get?

rebornix commented 2 weeks ago

@anthonykim1 I don't seem to reproduce after a few window reloads. I successfully reproduced though while talking to @karthiknadig after the standup. I'll see how I can force a reproduce.