しゃけのブログ

某大学院で研究している人の備忘録

VSCodeのRemote-ContainerでPython Tools serverがクラッシュする

The Python Tools server crashed 5 times in the last 3 minutes. The server will not be restarted.

Remote-Containerで起動した環境でPythonの補完機能を使いたかったのだが,上のエラーが毎回出てしまいます.

ネットの記事を見ると,extensionsのフォルダからms-python.python*を削除しなさい.ということが言われているが,これをRemote-Containerを起動するたびにやるのは面倒. (それにその方法では解決しなかった)

解決方法

github.com

File -> Preferences -> Settings -> Extensions -> Python -> "Python: Language Server".

の設定を開く.

タブが出てくるので,Pylanceを選択する.

f:id:shuckle-rbtech:20210805140228p:plain

そして,リモートのコンテナ上にms-python.pythonだけではなく,ms-python.vscode-pylanceがインストールされているかを確認します. 参考までに,devcontainer.jsonのextensionsを載せておきます.

 "extensions": [
        "ms-python.python",
        "ms-python.vscode-pylance",
    ]

この状態でRemote-Containerを起動するとちゃんと起動する.

結論

Thank you the discussions in the github issue!!!