Is there a way to use VSCode on a remote deep learning rig?


(WG) #1

Right now I’m using nano or vim to edit my python code running on a remote machine, but what I’d like to do is use VS Code.

Is this possible?

If so, what is your experience and overall recommendations about how to proceed?


(kanishkd4@gmail.com) #2

Hi, you can use Remote VScode and rmate to edit code

I haven’t extensively used vscode for ssh to give recommendations but another really convenient way can be to use jupyter notebok for python code and convert it to a .py script! (got this idea from the latest fastai development)


#3

The important thing to consider when using Remote VScode for remote debugging is that your locally created source code and all of it’s library dependencies have to be also available on the remote server (ideally as exaclty the same code, otherwise setting breakpoints will not stop at the right place). This makes dependency management a bit of a pain if you have to pull in extra git repos such as fast.ai. The best approach I found so far was using sync-rsync from https://marketplace.visualstudio.com/items?itemName=vscode-ext.sync-rsync .

Since rsync is highly efficient in detecting changes between your local and remote environment, you can also use it to copy large local source directories over to the remote server. Only at the initial run all files are copied over. At future runs, only changed files.


(WG) #4

I dont want to create anything locally, I only want to use VSCode to edit/add files on my remote server Im sshd into


#5

I’m not aware of any plugin that lets you edit files remotely in VSCode while still providing typical IDE features such as code navigation. This requires VSCode to basically build up a full-text index of all files. It cannot do this remotely, unless you opt for something such as SSHFS, which I would not recommend due to its high latency. The only other option I’m aware of is to copy the files locally. Rsync syncs in both directions, so you can support your use-case as well, basically building up a “cache” of your remote files on your local computer. The additional benefit is that if the connection to the server is interrupted, you can still continue working. That’s very handy while working on the go