Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VsCode Remote Debugging, change pythonpath to point to docker container's python interpreter

I currently have a tensorflow-gpu docker container fully built. I have a volume from my host's workspace ($PWD) to /workspace inside the docker container.

I can successfully remote debug the python scripts inside my workspace/docker's workspace folder, but as expected, my pylint and intellisense don't work inside vscode, as the pythonPath is set to my local python interpreter, and the pylint init-hooks are using my local python environment to figure out if it should squiggly line something.

How do I change my local vscode's pythonpath to point to the python interpreter on docker rather than on the host? I want pylint to be calibrated to the docker's environment rather than the local host's environment.

like image 702
Tristan Berry Avatar asked Nov 07 '18 06:11

Tristan Berry


People also ask

How do I change the Python interpreter path in VS Code?

To do so, open the Command Palette (Ctrl+Shift+P) and enter Preferences: Open User Settings. Then set python.condaPath , which is in the Python extension section of User Settings, with the appropriate path.

How does VSC choose Python interpreter?

You can also select a Python interpreter using the Python: Select Interpreter command from the Command Palette. To do so, press CMD + SHIFT + P , type Python, and choose Select Interpreter.


1 Answers

I followed up on Brett's answer and you can now do the following:

  1. Install the remote-containers extension.
  2. Click "shift+command(ctrl)+p" and type and select "remote-containers: open folder in remote docket container"

I hope this helps. More information is available here:

  • https://code.visualstudio.com/blogs/2019/05/02/remote-development
  • https://devblogs.microsoft.com/python/remote-python-development-in-visual-studio-code/
  • https://youtu.be/jKB_nIoC1gQ
like image 67
sinapan Avatar answered Oct 01 '22 23:10

sinapan