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

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?

2 Likes

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)

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.

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

1 Like

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

VSCode just integrated some nice features for running code from the editor on a remote Jupyter server (or a local one). Still need to have the code locally though.

Given that VSCode can run in a browser, it surely can’t be long until someone makes a front-end for Jupyter that embeds VSCode as the default editor. That would be sweet.

2 Likes

You might want to check out https://www.theia-ide.org/ for really running this remotely.

I tried following this installation guide: https://medium.com/@prtdomingo/editing-files-in-your-linux-virtual-machine-made-a-lot-easier-with-remote-vscode-6bb98d0639a4

But after starting the server:

jupyter@my-fastai-instance:~$ rmate tutorials
/usr/local/bin/rmate: connect: Connection refused
/usr/local/bin/rmate: line 390: /dev/tcp/localhost/52698: Connection refused
Unable to connect to TextMate on localhost:52698

Does this solution imply that it is a virtual machine residing on the same physical machine? Or what can be the case here?
Thanks

Haven’t try it yet, but this project seems very cool: https://coder.com/ (web VSCode)

If you want to check something similar, one I have tried in the past is c9: https://github.com/c9/core.

1 Like

I tried this out today - seems to work well. See my post here VS Code on remote server using https://coder.com/

1 Like

Now it is a great official solution for this https://code.visualstudio.com/blogs/2019/05/02/remote-development

1 Like

THIS!!!

Just installed the “Insiders” build and connected to my linux machine running in my house! WOW. The experience is identical to that you get with developing locally … just amazing.

Also, for folks use Anaconda environments … you can select your conda environment after installing the Python extension. See here for more info.

Once you do that, you’ll get full intellisense, code completion, ability to move/view your file system … the full “local” experience.

1 Like

Beautfiul …

Running VSCode on my Macbook Pro at work against my code sitting on my deep learning rig at home WITH tmux in the embedded terminal window.

Finally they launched the perfect extension. Check out VS Code Remote Development.