Pylance 在 VS Code 中在添加或删除 Jupyter 笔记本中的单元格时崩溃。

huangapple go评论116阅读模式
英文:

Pylance in VS Code crashes when adding or deleting cells in a Jupyter notebook

问题

I'm encountering an issue with the Pylance extension in VS Code when working on a Python notebook. Sometimes if I add or delete a cell, the language server crashes and throws the following error:

Error: Debug Failure. False expression: Chained file path undefined doesn't match cellFilePaths [REDACTED PATH].ipynb:pylance-notebook-cell:W5sZmlsZQ==.py
    at _0x225e6a ([REDACTED PATH]\server.bundle.js:1:1015920)
    at [REDACTED PATH]\server.bundle.js:1:1023143
    at _0x32da0b.<computed> ([REDACTED PATH]\server.bundle.js:1:1023175)
    at _0x382c6c._onDidChangeNotebookDocumentAsync ([REDACTED PATH]\server.bundle.js:1:1001957)

Here's my setup:

  • VS Code Version: June 2023 (version 1.80)
  • Pylance Extension Version: 2023.8.21
  • Operating System: Windows 10 and Linux

Steps to reproduce:

  • Open a Jupyter notebook in VS Code.
  • Add or delete a cell.
  • The Pylance language server crashes with the above error.

Has anyone encountered this issue before? Any guidance or solutions would be greatly appreciated.

Thank you in advance!

I've already tried several troubleshooting steps:

  • Reinstalled VS Code.
  • Reinstalled the Pylance extension.
  • Updated both VS Code and Pylance to their latest versions.

Despite these efforts, the issue persists.

My primary goal is to have Pylance running smoothly within Jupyter notebooks in VS Code. If anyone has encountered and resolved this problem, or has any suggestions, I'd be very appreciative.

英文:

I'm encountering an issue with the Pylance extension in VS Code when working on a Python notebook. Sometimes if I add or delete a cell, the language server crashes and throws the following error:

Error: Debug Failure. False expression: Chained file path undefined doesn&#39;t match cellFilePaths [REDACTED PATH].ipynb:pylance-notebook-cell:W5sZmlsZQ==.py
    at _0x225e6a ([REDACTED PATH]\server.bundle.js:1:1015920)
    at [REDACTED PATH]\server.bundle.js:1:1023143
    at _0x32da0b.&lt;computed&gt; ([REDACTED PATH]\server.bundle.js:1:1023175)
    at _0x382c6c._onDidChangeNotebookDocumentAsync ([REDACTED PATH]\server.bundle.js:1:1001957)

Here's my setup:

  • VS Code Version: June 2023 (version 1.80)
  • Pylance Extension Version: 2023.8.21
  • Operating System: Windows 10 and Linux

Steps to reproduce:

  • Open a Jupyter notebook in VS Code.
  • Add or delete a cell.
  • The Pylance language server crashes with the above error.

Has anyone encountered this issue before? Any guidance or solutions would be greatly appreciated.

Thank you in advance!

I've already tried several troubleshooting steps:

  • Reinstalled VS Code.
  • Reinstalled the Pylance extension.
  • Updated both VS Code and Pylance to their latest versions.

Despite these efforts, the issue persists.

My primary goal is to have Pylance running smoothly within Jupyter notebooks in VS Code. If anyone has encountered and resolved this problem, or has any suggestions, I'd be very appreciative.

答案1

得分: 2

这似乎是一个已知问题的实例:Pylance在Jupyter Notebook单元格删除时崩溃 #4685。该问题已知存在于Pylance扩展的版本v2023.8.10中。

该问题显然已经预发布版本2023.8.51中修复。尝试安装该版本(如果它仍然是预发布版本,请切换到预发布通道)。


旧信息:

显然,对于许多用户(但不是所有用户),在Pylance v2023.7.40中不会再现该问题,因此暂时降级可能是一个可行的解决方法。您可能需要进一步降级以获得修复。还可以参考 https://stackoverflow.com/q/42626065/11107541

根据维护者的说法,某些问题情况将通过拉取请求 #4733修复,该拉取请求将在即将发布的Pylance扩展预发布版本中发布,请尝试使用该版本。

您还可以尝试使用此设置 &quot;python.analysis.enableSyncServer&quot;: true,看看是否有任何不同 - 它会强制扩展一次处理一个LSP消息(需要重新启动VS Code才能生效)。如果您能确定可靠地重现问题的步骤,将对解决过程中的扩展维护者非常有用。

如果以上方法都不起作用,有一个用户发现,暂时解决问题的方法是使用命令面板中的Developer: Reload Window命令重新加载VS Code窗口(请注意,这可能需要重新运行单元格)。

供您参考和学习,我是通过搜索“github vscode issues jupyter crash "Chained file path undefined doesn't match cellFilePaths"”来找到上述问题票据的。

英文:

This seems to be an instance of this known issue: Pylance crashing on Jupyter Notebook Cell Deletion #4685. The issue is known to exist for v2023.8.10 of the Pylance extension.

The issue is apparently fixed in prerelease version 2023.8.51. Try installing that release (if it's still in pre-release, switch to the pre-release channel).


Older info:

Apparently for many (but not all) users, the issue does not reproduce in Pylance v2023.7.40, so downgrading might be a possible workaround for now. You may or may not need to downgrade further than that to get a fix. See also https://stackoverflow.com/q/42626065/11107541.

According to the maintainers, some of the issue-cases will be fixed by pull request #4733, which will be released in the upcoming pre-release version of the Pylance extension, so please give that version a try.

You can also try using this setting &quot;python.analysis.enableSyncServer&quot;: true to see if that makes any difference- it forces the extension to handle one LSP message at a time (you need to restart VS Code once for that setting to take effect). If you can determine a procedure to reliably reproduce the issue, it would be greatly useful to the maintainers of this extension in the resolution process.

If none of that works, one user found that they could work around the issue for the time being is to reload the VS Code window with the Developer: Reload Window command in the command palette (note that this may require re-running cells).

<sup>For your reference and learning purposes, I found the above issue ticket by googling "github vscode issues jupyter crash &quot;Chained file path undefined doesn&#39;t match cellFilePaths&quot;".</sup>

答案2

得分: 0

这是一个我也遇到过的已知问题。
我尝试了将版本降级到2023.7.40,但在添加/删除单元格时,Pylance仍然崩溃。

版本v2023.7.30解决了我的问题。

编辑:几天后,问题又出现了,而且仍然存在。看起来他们还没有解决,你可以在官方GitHub上查看更新状态:https://github.com/microsoft/pylance-release/issues/4685

我目前正在使用v2023.6.30版本,但我不确定它是否会解决这个问题。我认为现在最好的选择是关注GitHub问题并等待修复。

英文:

It is a known issue I faced as well.
I tried downgrading with version 2023.7.40 but Pylance still crashed when adding/deleting cells.

Version v2023.7.30 solved the issue for me.

EDIT: After a couple of days, the issue came back and is still persistent. Looks like they haven't solved it yet, you can check the updating status here on the official github: https://github.com/microsoft/pylance-release/issues/4685

I'm currently using the v2023.6.30 release but I'm not sure it will solve the issue. I think the best option right now, is to keep an eye on the github issue and wait to get it fixed

答案3

得分: 0

问题似乎在发布前4小时刚刚修复。请访问 https://github.com/microsoft/pylance-release/blob/main/CHANGELOG.md#2023851-30-August-2023-PreRelease

在 vscode 中前往您的 Pylance 扩展并切换到预发布版本。

英文:

Issue seems to have just been fixed as of 4 hours before posting. https://github.com/microsoft/pylance-release/blob/main/CHANGELOG.md#2023851-30-August-2023-PreRelease

Go to your pylance extension in vscode and switch to pre-release version.

huangapple
  • 本文由 发表于 2023年8月10日 17:08:13
  • 转载请务必保留本文链接:https://go.coder-hub.com/76874235.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定