Skip to content

Lint on save not recognizing pylint and autopep8 on remote's path #5549

@kylrth

Description

@kylrth

On a remote machine (which I do not have sudo access to), I have autopep8 and pylint installed in for a single user only, in ~/.local/bin. I've added this to my .bash_profile:

PATH=$PATH:~/.local/bin

When I open a bash terminal, I can see these commands are available to me when I run which pylint && which autopep8:

/fslhome/newkid1/.local/bin/pylint
/fslhome/newkid1/.local/bin/autopep8

But the Python extension apparently cannot find these tools on the remote machine. Explicitly defining the path in the Remote-SSH settings solves this problem.

The most likely cause is that the Remote-SSH extension does not source .bash_profile. If this is the case, I can move this issue over to that extension, because this should be made clear in the docs.

Environment data

  • VS Code version: 1.34.0-insider
  • Extension version: 2019.4.12954
  • OS and version: Elementary OS 5.0 Juno (local), RHEL 7.0 (remote)
  • Python version: 3.6.5
  • Type of virtual environment used: N/A
  • Relevant/affected Python packages and their versions:
pylint 2.3.1
astroid 2.2.5
Python 3.6.5 (default, Jun  5 2018, 15:49:59) 
[GCC 7.3.0]
autopep8 1.4.4 (pycodestyle: 2.5.0)

Expected behaviour

pylint and autopep8 are run upon saving a Python file.

Actual behaviour

pylint and autopep8 are not found by the Python Extension.

Steps to reproduce:

  1. Connect to remote host using Remote-SSH extension.
  2. Install Python Extension on remote.
  3. Run pip3 install --user --upgrade autopep8 on remote.
  4. Run pip3 install --user --upgrade pylint on remote.
  5. Save a Python file to be linted.

Logs

Output from Python extension:

Formatting with autopep8 failed.
You could either install the 'autopep8' formatter, turn it off or use another formatter.
Error: Module 'autopep8' not installed.

Linter 'pylint' is not installed. Please install it or select another linter".
Error: Module 'pylint' not installed.

Output from Console under the Developer Tools panel:

7workbench.main.js:238 [Extension Host] Python Extension: Cached data exists getEnvironmentVariables, /home/username/workspace
2workbench.main.js:238 [Extension Host] Python Extension: Cached data exists getEnvironmentVariables, /home/username/workspace/script.py
workbench.main.js:2365 Formatter autopep8 is not installed. Install?
onDidNotificationChange @ workbench.main.js:2365
_register.model.onDidNotificationChange.e @ workbench.main.js:2364
fire @ workbench.main.js:77
notify @ workbench.main.js:2420
notify @ workbench.main.js:3616
r @ workbench.main.js:3213
_showMessage @ workbench.main.js:3212
$showMessage @ workbench.main.js:3212
_doInvokeHandler @ workbench.main.js:3252
_invokeHandler @ workbench.main.js:3252
_receiveRequest @ workbench.main.js:3251
_receiveOneMessage @ workbench.main.js:3249
_protocol.onMessage.e @ workbench.main.js:3248
fire @ workbench.main.js:77
a @ workbench.main.js:321
e @ workbench.main.js:321
fire @ workbench.main.js:77
_receiveMessage @ workbench.main.js:330
S._socketDisposables.push._socketReader.onMessage.e @ workbench.main.js:327
fire @ workbench.main.js:77
acceptChunk @ workbench.main.js:323
_register._socket.onData.e @ workbench.main.js:323
t @ workbench.main.js:332
emit @ events.js:182
addChunk @ _stream_readable.js:279
readableAddChunk @ _stream_readable.js:264
Readable.push @ _stream_readable.js:219
onread @ net.js:636
2workbench.main.js:238 [Extension Host] Python Extension: Cached data exists getEnvironmentVariables, /home/username/workspace/script.py
workbench.main.js:238 [Extension Host] Python Extension: Linter 'pylint' is not installed. Please install it or select another linter". Error: Module 'pylint' not installed.
	at p.execModule (/home/username/.vscode-remote/extensions/ms-python.python-2019.4.12954/out/client/extension.js:83:295088)
	at process._tickCallback (internal/process/next_tick.js:68:7)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions