VSCode. Pylance doesn't work via SSH connection
Asked Answered
S

2

6

There is a problem: Pylance (IntelliSense) does not work on the remote server. At the same time it works locally. Pylance itself is installed both locally and on the server. Imports are just white and only "Loading..." pops up when I hover over it. "Go to definition" also doesn't work.

Have a such properties:

  • Python: 3.10.2;
  • Pylance: 2022.1.3;
  • Python extension: v2021.12.1559732655;
  • Remote - SSH: v0.70.0
  • VSCode: 1.63.2;
  • Local OS: Windows 10 Pro;
  • Remote OS: Ubuntu 20.04.3 LTS
  • Virtualenv as env;

I've already tried a bunch of options:

  • Installed other versions of Pylance;
  • Older versions of the Python extension itself;
  • Updated Python to the latest version from 3.8.10 to 3.10.2;
  • Changed the language server to Jedi and reverted to Pylance;
  • Reinstalled extensions, VSCode;
  • Recreated the environment with new python.
  • Added to the remote settings.json this settings: "python.insidersChannel": "daily", "python.languageServer": "Pylance".

"Python: Show output" gives this output:

Experiment 'pythonaacf' is active
Experiment 'pythonTensorboardExperiment' is active
Experiment 'pythonSurveyNotification' is active
Experiment 'PythonPyTorchProfiler' is active
Experiment 'pythonDeprecatePythonPath' is active
> conda info --json
> ~/jupyter_env/bin/python ~/.vscode-server/extensions/ms-python.python-2021.12.1559732655/pythonFiles/interpreterInfo.py
> ~/.anaconda_backup/bin/conda info --json
Python interpreter path: ./jupyter_env/bin/python
> conda --version
> /bin/python ~/.vscode-server/extensions/ms-python.python-2021.12.1559732655/pythonFiles/interpreterInfo.py
> /bin/python2 ~/.vscode-server/extensions/ms-python.python-2021.12.1559732655/pythonFiles/interpreterInfo.py
> /bin/python3 ~/.vscode-server/extensions/ms-python.python-2021.12.1559732655/pythonFiles/interpreterInfo.py
> /bin/python3.10 ~/.vscode-server/extensions/ms-python.python-2021.12.1559732655/pythonFiles/interpreterInfo.py
> /usr/bin/python2 ~/.vscode-server/extensions/ms-python.python-2021.12.1559732655/pythonFiles/interpreterInfo.py
> /usr/bin/python3 ~/.vscode-server/extensions/ms-python.python-2021.12.1559732655/pythonFiles/interpreterInfo.py
> ". /home/db/jupyter_env/bin/activate && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python /home/db/.vscode-server/extensions/ms-python.python-2021.12.1559732655/pythonFiles/printEnvVariables.py"
Starting Jedi language server.
> ~/jupyter_env/bin/python -m pylint --msg-template='{line},{column},{category},{symbol}:{msg} --reports=n --output-format=text ~/data/qualityControl/core/data_verification/dataQualityControl.py
cwd: ~/
##########Linting Output - pylint##########
************* Module core.data_verification.dataQualityControl
18,53,error,syntax-error:non-default argument follows default argument (<unknown>, line 18)
Shepp answered 26/1, 2022 at 11:44 Comment(1)
I have the same issue. It can find imports built into Python just not the ones in site-packages. Would post a pic of the issue but it will not allow me.Abeyance
S
3

Basically, the problem was that if a large workspace is selected in VSCode, it will try to index it all, and until it finishes, the highlighting won't turn on. In my case, I had several AWS buckets mounted and since there was about 100TB of data, the file indexing simply never finished. If I select a specific project folder, however, the problem disappears. So in case of such a problem, try to specify the working directory. Good luck!

Shepp answered 13/12, 2022 at 11:31 Comment(1)
Hello, Thank you for the answer! I have similar issue, and found your answer is similar to my case. Could you tell me how to specify the working directory in vscode? Thank you!Scriptwriter
A
2

This is fixed by setting the python.language.server to pylance

See GitHub issue 11

enter image description here

Abeyance answered 1/6, 2022 at 15:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.