10

Here is how the thing doesn't work:

The project source code is located on a remote machine. The Python virtual environment is installed in the project's root directory (using venv).

I sshfs the project folder and start local VSCode. It detects the virtual environment, but doesn't see pylint or other packages installed in it.

Python 3.6.7 VS Code - latest version OSs - Debian 9 remote, Linux Mint 19 local Both sshfs connection and venv installation are performed under the same account.

Is there some special way a virtual environment should be set up to be usable remotely?

2 Answers2

9

There were problems with sshfs in early VSCode versions, but recent distrib has Remote Development extension that lets you develop your code via ssh.

Since you have activated your virtual environment, just get venv python path with which python command and copy it to the Select Interpreter menu.

ilia
  • 620
  • 4
  • 9
4

Activate your python environment:

source venv/bin/activate 

Find which python path you are using:

which python

Usually it is in :

venv/bin/python

Go to the bottom of VS Code, and click on the version number :

enter image description here

Click on Enter interpreter path... : enter image description here

Enter the path you found above with the which python command.

george mano
  • 5,948
  • 6
  • 33
  • 43