Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remote-SSH Unable to Select Interpreter #14935

Closed
mitchellgordon95 opened this issue Dec 10, 2020 · 5 comments
Closed

Remote-SSH Unable to Select Interpreter #14935

mitchellgordon95 opened this issue Dec 10, 2020 · 5 comments
Assignees
Labels
area-environments Features relating to handling interpreter environments bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster

Comments

@mitchellgordon95
Copy link

Environment data

  • VS Code version: 1.51.1
  • Extension version (available under the Extensions sidebar): v2020.11.371526539
  • OS and version: OSX High Sierra 10.13.6 (Local) CentOS Linux v7 (Remote)
  • Python version (& distribution if applicable, e.g. Anaconda): Various (2.7, 3.6)
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): conda
  • Relevant/affected Python packages and their versions: N/A
  • Relevant/affected Python-related VS Code extensions and their versions: N/A
  • Value of the python.languageServer setting: Jedi/Pylance

Expected behaviour

  1. Enter a remote session over ssh (Remote-SSH: Connect to Host...).
  2. Open a python file using Cmd-O.
  3. Prompted to select an interpreter
  4. Select one of the python interpreters available (conda env, or /usr/bin/python)
  5. Yellow interpreter prompt disappears, auto-complete works as expected.

Actual behaviour

Yellow "Select Python Interpreter" prompt in bottom bar does not go away.
Auto complete does not work. (e.g. typing os.make does not suggest os.makedirs())

Logs

User belongs to experiment group 'ShowPlayIcon - start'
User belongs to experiment group 'DebugAdapterFactory - experiment'
User belongs to experiment group 'PtvsdWheels37 - experiment'
User belongs to experiment group 'UseTerminalToGetActivatedEnvVars - control'
User belongs to experiment group 'LocalZMQKernel - experiment'
User belongs to experiment group 'CollectLSRequestTiming - control'
User belongs to experiment group 'CollectNodeLSRequestTiming - experiment'
User belongs to experiment group 'EnableIPyWidgets - experiment'
User belongs to experiment group 'DeprecatePythonPath - experiment'
User belongs to experiment group 'RunByLine - experiment'
User belongs to experiment group 'CustomEditorSupport - control'
User belongs to experiment group 'pythonaa'
User belongs to experiment group 'pythonSendEntireLineToREPL'
> conda --version
> pyenv root
> python3.7 ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python3.6 ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python3 ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python2 ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> /opt/anaconda2/bin/python ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> /opt/anaconda2/bin/conda info --json
> /opt/anaconda2/bin/conda env list
> /opt/anaconda2/bin/conda env list
Error 2020-12-10 10:27:49: Failed to check if file needs to be fixed [EntryNotFound (FileSystemError): Unable to read file 'vscode-remote://ssh-remote+hlt4/home/hltcoe/mgordon/.config/Code/User/settings.json' (EntryNotFound (FileSystemError): Error: ENOENT: no such file or directory, open '/home/hltcoe/mgordon/.config/Code/User/settings.json')
	at _handleError (/home/hltcoe/mgordon/.vscode-server/bin/e5a624b788d92b8d34d1392e4c4d9789406efe8f/out/vs/server/remoteExtensionHostProcess.js:754:838)
	at processTicksAndRejections (internal/process/task_queues.js:94:5)
	at async y.readText (/home/hltcoe/mgordon/.vscode-server/extensions/ms-python.python-2020.11.371526539/out/client/extension.js:9:152841)
	at async p.doesFileNeedToBeFixed (/home/hltcoe/mgordon/.vscode-server/extensions/ms-python.python-2020.11.371526539/out/client/extension.js:39:469606)
	at async /home/hltcoe/mgordon/.vscode-server/extensions/ms-python.python-2020.11.371526539/out/client/extension.js:39:468733
	at async Promise.all (index 0)
	at async p.getFilesToBeFixed (/home/hltcoe/mgordon/.vscode-server/extensions/ms-python.python-2020.11.371526539/out/client/extension.js:39:468679)
	at async p.updateTestSettings (/home/hltcoe/mgordon/.vscode-server/extensions/ms-python.python-2020.11.371526539/out/client/extension.js:39:468306)] {
  code: 'FileNotFound',
  name: 'EntryNotFound (FileSystemError)'
}
Starting Jedi Python language engine.
Error 2020-12-10 10:27:56: Diagnostic Code: InvalidPythonInterpreterDiagnostic, Message: No Python interpreter is selected. You need to select a Python interpreter to enable features such as IntelliSense, linting, and debugging.
Diagnostic Code: InvalidPythonInterpreterDiagnostic, Message: No Python interpreter is selected. You need to select a Python interpreter to enable features such as IntelliSense, linting, and debugging.

Linter 'pylint' is not installed. Please install it or select another linter".
TypeError [ERR_INVALID_ARG_VALUE]: The argument 'file' cannot be empty. Received ''
> /usr/bin/python ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py pip --version

Linter 'pylint' is not installed. Please install it or select another linter".
TypeError [ERR_INVALID_ARG_VALUE]: The argument 'file' cannot be empty. Received '

Additional Comments

It seems two potentially weird things are happening here:

  1. Selecting an interpreter on a remote machine updates the local settings.json, not the remote settings.json

  2. The python extension attempts to read settings.json on the remote machine from ~/.config/.... This would be correct if I was running Linux locally, but is incorrect when I am running a remote session. (Should be ~/.vscode-server/...)

Local Machine Settings (OSX): ~/Library/Application\ Support/Code/User/settings.json
Remote Machine Settings (Linux): /home/hltcoe/.vscode-server/data/Machine/settings.json
Non-existent Remote Settings: /home/hltcoe/mgordon/.config/Code/User/settings.json

When selecting an interpreter in the GUI, my remote machine settings remain unchanged:

{
    "python.pythonPath": "/opt/anaconda2/bin/python"
}

However, it (correctly) updates my local machine settings to this:

{
    ...
    "python.defaultInterpreterPath": "/home/hltcoe/mgordon/.conda/envs/huggingface/bin/python"
}

But it is checking neither of these when attempting to read the python path setting. So my current conclusion is that the python extension is not aware it is operating in a remote environment, which requires special considerations when updating and retrieving settings.

Interestingly, if I create the settings file it expects at /home/hltcoe/mgordon/.config/Code/User/settings.json with the following contents:

{
    "python.defaultInterpreterPath": "/usr/bin/python"
}

I get a different error:

User belongs to experiment group 'ShowPlayIcon - start'
User belongs to experiment group 'DebugAdapterFactory - experiment'
User belongs to experiment group 'PtvsdWheels37 - experiment'
User belongs to experiment group 'UseTerminalToGetActivatedEnvVars - control'
User belongs to experiment group 'LocalZMQKernel - experiment'
User belongs to experiment group 'CollectLSRequestTiming - control'
User belongs to experiment group 'CollectNodeLSRequestTiming - experiment'
User belongs to experiment group 'EnableIPyWidgets - experiment'
User belongs to experiment group 'DeprecatePythonPath - experiment'
User belongs to experiment group 'RunByLine - experiment'
User belongs to experiment group 'CustomEditorSupport - control'
User belongs to experiment group 'pythonaa'
User belongs to experiment group 'pythonSendEntireLineToREPL'
> conda --version
> pyenv root
> python3.7 ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python3.6 ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python3 ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python2 ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> /usr/bin/python ~/.vscode-server/extensions/ms-python.python-2020.11.371526539/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> /opt/anaconda2/bin/conda info --json
> /opt/anaconda2/bin/conda env list
> /opt/anaconda2/bin/conda env list
Starting Jedi Python language engine.
Error 2020-12-10 11:13:13: Diagnostic Code: InvalidPythonInterpreterDiagnostic, Message: No Python interpreter is selected. You need to select a Python interpreter to enable features such as IntelliSense, linting, and debugging.
Diagnostic Code: InvalidPythonInterpreterDiagnostic, Message: No Python interpreter is selected. You need to select a Python interpreter to enable features such as IntelliSense, linting, and debugging.

Linter 'pylint' is not installed. Please install it or select another linter".
TypeError [ERR_INVALID_ARG_VALUE]: The argument 'file' cannot be empty. Received '

But that's maybe a separate issue.

@mitchellgordon95 mitchellgordon95 added triage-needed Needs assignment to the proper sub-team bug Issue identified by VS Code Team member as probable bug labels Dec 10, 2020
@mitchellgordon95
Copy link
Author

@karrtikr your advice would be welcome. 🙂

@ghost ghost removed the triage-needed Needs assignment to the proper sub-team label Dec 10, 2020
@karthiknadig karthiknadig added the area-environments Features relating to handling interpreter environments label Dec 10, 2020
@karrtikr
Copy link

karrtikr commented Dec 14, 2020

Thanks for the bug report! We investigate issues in order based on priority and severity, which includes the impact it has on your ability to use the extension to do productive work, and the number of people affected. If other users come forward and leave a comment demonstrating they are seeing/reproducing the problem then we will raise this issue's priority.

If you think your issue is more of a question or configuration problem rather than a bug, please ask on Stack Overflow with the visual-studio-code and python labels for help.

Thanks for your understanding and patience!

@karrtikr
Copy link

Hi @mitchellgordon95 👋 does the latest version of the extension fix the issue for you?

@karrtikr
Copy link

karrtikr commented Feb 22, 2021

Can you try adding

    "python.experiments.optOutFrom": ["DeprecatePythonPath - experiment"],

in your user and remote settings, and see if it fixes the issue for you?

@karrtikr karrtikr added the info-needed Issue requires more information from poster label Feb 22, 2021
@brettcannon
Copy link
Member

Because we have not heard back with the information we requested, we are closing this issue for now. If you are able to provide the info later on then we will be happy to re-open this issue to pick up where we left off.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-environments Features relating to handling interpreter environments bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

4 participants