pylance-release icon indicating copy to clipboard operation
pylance-release copied to clipboard

Activating IntelliCode for Python failed.

Open YUMEYA opened this issue 3 years ago • 8 comments

Original issue: intellicode/issues/325 IntelliCode team members believe this is an issue of Pylance, hence I transfered it here.

Environment data

  • Language Server version: 2022.2.0
  • OS and version: PC running Windows 11, Server running Ubuntu 20.04.3 LTS
  • Python version (and distribution if applicable, e.g. Anaconda): Python 3.10.1
  • python.analysis.indexing: null
  • python.analysis.typeCheckingMode: off
  • VS Code is running on PC, connect to server via Remote Development SSH extension.
  • Python 3.10.1 and virtualenv are installed and managed by Pyenv, the dependencies of my project are managed by Poetry, witch is installed via Pipx.

Expected behaviour

  1. Install Python and Pylance extensions on sever, open a .py file and both of them are successfully loaded.
  2. Install IntelliCode extension, after downloading model the extension should be loaded successfully as well.

Actual behaviour

  1. Install Python and Pylance extensions on sever, open a .py file and both of them are successfully loaded.
  2. Install IntelliCode extension, after downloading model an error message pops up:

Sorry, something went wrong activating IntelliCode support for Python. Please check the "Python" and "VS IntelliCode" output windows for details.

Logs

Python Language Server Log

python_language_server(before activating IntelliCode extension).log python_language_server(after activating IntelliCode extension).log

Code Snippet / Additional information

This is the log in Output-Python:

用户属于 'pythonaa' 实验组
用户属于 'pythonTensorboardExperiment' 实验组
用户属于 'pythonSurveyNotification' 实验组
用户属于 'PythonPyTorchProfiler' 实验组
用户属于 'pythonDeprecatePythonPath' 实验组
> conda info --json
> poetry env list --full-path
cwd: .
> ~/.pyenv/versions/3.10.1/envs/d2manifest-venv/bin/python ~/.vscode-server/extensions/ms-python.python-2022.0.1786462952/pythonFiles/get_output_via_markers.py ~/.vscode-server/extensions/ms-python.python-2022.0.1786462952/pythonFiles/interpreterInfo.py
> ~/.pyenv/versions/3.10.1/bin/python ~/.vscode-server/extensions/ms-python.python-2022.0.1786462952/pythonFiles/get_output_via_markers.py ~/.vscode-server/extensions/ms-python.python-2022.0.1786462952/pythonFiles/interpreterInfo.py
Python 解释器路径: ~/.pyenv/versions/3.10.1/envs/d2manifest-venv/bin/python
> ~/.pyenv/versions/3.10.1/envs/qqbot-venv/bin/python ~/.vscode-server/extensions/ms-python.python-2022.0.1786462952/pythonFiles/get_output_via_markers.py ~/.vscode-server/extensions/ms-python.python-2022.0.1786462952/pythonFiles/interpreterInfo.py
> /usr/bin/python ~/.vscode-server/extensions/ms-python.python-2022.0.1786462952/pythonFiles/get_output_via_markers.py ~/.vscode-server/extensions/ms-python.python-2022.0.1786462952/pythonFiles/interpreterInfo.py
> . ~/.pyenv/versions/3.10.1/envs/d2manifest-venv/bin/activate && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python ~/.vscode-server/extensions/ms-python.python-2022.0.1786462952/pythonFiles/printEnvVariables.py
> poetry config virtualenvs.path
cwd: .
正在启动 Pylance 语言服务器。
> ~/.pyenv/versions/3.10.1/envs/d2manifest-venv/bin/python ~/.vscode-server/extensions/ms-python.python-2022.0.1786462952/pythonFiles/linter.py -m flake8 ./src/destiny2_manifest_api/app/__init__.py
cwd: .
##########Linting Output - flake8##########

This is the log in Output-VS IntelliCode:

Language server is set to "Default". Pylance is used as current language server.
Acquiring model
Acquiring model 'intellisense-members-lstm-pylance' for python
Querying IntelliCode service for available models.
vs-intellicode-python was passed a model: {}.
Cached model is up to date.
Activating Python extension
Language server extension command failed. Exception: Error: Connection got disposed.
	at Object.dispose (/root/.vscode-server/extensions/ms-python.python-2022.0.1786462952/out/client/extension.js:67:144918)
	at Object.dispose (/root/.vscode-server/extensions/ms-python.python-2022.0.1786462952/out/client/extension.js:24:153999)
	at S.handleConnectionClosed (/root/.vscode-server/extensions/ms-python.python-2022.0.1786462952/out/client/extension.js:24:154211)
	at S.handleConnectionClosed (/root/.vscode-server/extensions/ms-python.python-2022.0.1786462952/out/client/extension.js:32:10900)
	at t (/root/.vscode-server/extensions/ms-python.python-2022.0.1786462952/out/client/extension.js:24:152304)
	at invoke (/root/.vscode-server/extensions/ms-python.python-2022.0.1786462952/out/client/extension.js:24:278068)
	at o.fire (/root/.vscode-server/extensions/ms-python.python-2022.0.1786462952/out/client/extension.js:24:278829)
	at X (/root/.vscode-server/extensions/ms-python.python-2022.0.1786462952/out/client/extension.js:67:134280)
	at invoke (/root/.vscode-server/extensions/ms-python.python-2022.0.1786462952/out/client/extension.js:24:278068)
	at o.fire (/root/.vscode-server/extensions/ms-python.python-2022.0.1786462952/out/client/extension.js:24:278829)
	at d.fireClose (/root/.vscode-server/extensions/ms-python.python-2022.0.1786462952/out/client/extension.js:67:124349)
	at ChildProcess.<anonymous> (/root/.vscode-server/extensions/ms-python.python-2022.0.1786462952/out/client/extension.js:24:273798)
	at ChildProcess.emit (events.js:327:22)
	at maybeClose (internal/child_process.js:1048:16)
	at Socket.<anonymous> (internal/child_process.js:439:11)
	at Socket.emit (events.js:315:20)
	at Pipe.<anonymous> (net.js:673:12)
Error while activating Python: {}

According to @markw-t and @luabud 's advice, I tried the "Python: Restart Language Server" command, this is the log after restarting: python_language_server(after restarting).log But the logs of IntelliCode stays the same, I think it's still in failed state.

YUMEYA avatar Feb 07 '22 13:02 YUMEYA

@luabud please let us know if our initial view on this was incorrect and we can reactivate the IntellICode bug.

markw-t avatar Feb 07 '22 14:02 markw-t

It seems that after the reload of the language server, the Python extension activated properly and Pylance seems to work as well. But then if the IntelliCode output didn't change, it seems that we're failing somewhere to pass a model for IntelliCode:

Querying IntelliCode service for available models.
vs-intellicode-python was passed a model: {}.

luabud avatar Mar 03 '22 17:03 luabud

@joyceerhl, is this related to https://github.com/microsoft/vscode/issues/143834?

judej avatar Mar 07 '22 18:03 judej

Unlikely--that issue was fixed in the 1.65 stable release. Also perhaps you meant to @-mention @jrieken instead of me?

joyceerhl avatar Mar 07 '22 19:03 joyceerhl

@YUMEYA, Tried this on VS 1.65.2 and Pylance v2022.3.3 and I was not able to reproduce it. Please let me know if you are still seeing this?

judej avatar Mar 30 '22 22:03 judej

@judej Yes, I'm still seeing this error on VS Code 1.66.0 + Python 2022.4.0 + Pylance 2022.3.4 + IntelliCode 1.2.18

Python Language Server Log: python_language_server(before activating IntelliCode extension).log python_language_server(after activating IntelliCode extension).log

VS IntelliCode Log:

Language server is set to "Default". Pylance is used as current language server.
Acquiring model
Acquiring model 'intellisense-members-lstm-pylance' for python
Querying IntelliCode service for available models.
vs-intellicode-python was passed a model: {}.
Cached model is up to date.
Activating Python extension
Language server extension command failed. Exception: Error: Connection got disposed.
	at Object.dispose (/root/.vscode-server/extensions/ms-python.python-2022.4.0/out/client/extension.js:47:145778)
	at Object.dispose (/root/.vscode-server/extensions/ms-python.python-2022.4.0/out/client/extension.js:24:155505)
	at S.handleConnectionClosed (/root/.vscode-server/extensions/ms-python.python-2022.4.0/out/client/extension.js:24:155717)
	at S.handleConnectionClosed (/root/.vscode-server/extensions/ms-python.python-2022.4.0/out/client/extension.js:32:10610)
	at t (/root/.vscode-server/extensions/ms-python.python-2022.4.0/out/client/extension.js:24:153810)
	at invoke (/root/.vscode-server/extensions/ms-python.python-2022.4.0/out/client/extension.js:24:281641)
	at o.fire (/root/.vscode-server/extensions/ms-python.python-2022.4.0/out/client/extension.js:24:282402)
	at X (/root/.vscode-server/extensions/ms-python.python-2022.4.0/out/client/extension.js:47:135140)
	at invoke (/root/.vscode-server/extensions/ms-python.python-2022.4.0/out/client/extension.js:24:281641)
	at o.fire (/root/.vscode-server/extensions/ms-python.python-2022.4.0/out/client/extension.js:24:282402)
	at d.fireClose (/root/.vscode-server/extensions/ms-python.python-2022.4.0/out/client/extension.js:47:125209)
	at ChildProcess.<anonymous> (/root/.vscode-server/extensions/ms-python.python-2022.4.0/out/client/extension.js:24:277371)
	at ChildProcess.emit (node:events:402:35)
	at maybeClose (node:internal/child_process:1064:16)
	at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
Error while activating Python: {}

YUMEYA avatar Apr 05 '22 02:04 YUMEYA

@judej Has this problem been solved yet? I run into the same problem. What could I do to help?

RookieTars avatar May 01 '22 03:05 RookieTars

I have the same problem

$ code --version
1.68.1
30d9c6cd9483b2cc586687151bcbcd635f373630
x64
$ python --version                                                                                                                            
Python 3.10.5
$ lsb_release --all                                                                                                                                   
LSB Version:	n/a
Distributor ID:	ManjaroLinux
Description:	Manjaro Linux
Release:	21.3.2
Codename:	Ruah

using ms-python.python-2022.9.11821004.vsix downloaded on the Microsoft Marketplace by clicking on Resources -> Download Extension.

mioxyz avatar Jul 05 '22 19:07 mioxyz

This seems to be working fine for me now.

Image

(Intellicode puts the * on the completions)

If somebody else can repro this still, please comment below. Closing for now.

rchiodo avatar Oct 12 '22 23:10 rchiodo

If you can repro, we need the "Python Language Server" and "VS Intellicode" output from the 'Output panel'

Image

rchiodo avatar Oct 12 '22 23:10 rchiodo