Forums

SSH not working with Visual Studio Code

I'm getting a lot of errors trying to connect by SSH to my account to develop using Visual Studio Code:

[00:08:28.800] remote-ssh@0.47.2
[00:08:28.800] win32 x64
[00:08:28.803] SSH Resolver called for "ssh-remote+ssh.pythonanywhere.com", attempt 1
[00:08:28.803] SSH Resolver called for host: ssh.pythonanywhere.com
[00:08:28.803] Setting up SSH remote "ssh.pythonanywhere.com"
[00:08:28.827] Using commit id "86405ea23e3937316009fc27c9361deee66ffbf5" and quality "stable" for server
[00:08:28.829] Testing ssh with ssh -V
[00:08:28.889] ssh exited with code: 0
[00:08:28.889] Got stderr from ssh: OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5
[00:08:28.893] Running script with connection command: ssh -T -D 49944 ssh.pythonanywhere.com bash
[00:08:28.894] Install and start server if needed
[00:08:28.897] Terminal shell path: C:\WINDOWS\System32\cmd.exe
[00:08:28.964] > 
> 
> ]0;C:\WINDOWS\System32\cmd.exe
[00:08:28.964] Got some output, clearing connection timeout
[00:08:28.970] > 
> 
[00:08:29.727] > <<<<<<:>~ PythonAnywhere SSH. Help @ https://help.pythonanywhere.com/pages/SSHAc
> cess
> 
[00:08:29.871] > warning: agent returned different signature type ssh-rsa (expected rsa-sha2-512)
[00:08:31.329] > 583217fe4d56: running
> 
[00:08:31.384] > Acquiring lock on /home/me/.vscode-server/bin/86405ea23e3937316009fc27c9361d
> eee66ffbf5/vscode-remote-lock.86405ea23e3937316009fc27c9361deee66ffbf5
> 
[00:08:31.390] > Found existing installation at /home/me/.vscode-server/bin/86405ea23e3937316
> 009fc27c9361deee66ffbf5...
> Error, do this: mount -t proc proc /proc
> VIRTUALENVWRAPPER_PROJECT_FILENAME=.project
> VIRTUALENVWRAPPER_SCRIPT=/usr/local/bin/virtualenvwrapper.sh
> SHELL=/bin/bash
> SSH_CLIENT=5.70.22.184 49946 22
> USER=me
> USERNAME=me
> WORKON_HOME=/home/me/.virtualenvs
> VSCODE_AGENT_FOLDER=/home/me/.vscode-server
> PATH=/home/me/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/
> sbin:/bin:/usr/games:/usr/local/games
> MAIL=/var/mail/me
> VIRTUALENVWRAPPER_HOOK_DIR=/home/me/.virtualenvs
> PWD=/home/me
> LANG=en_US.UTF-8
> HISTCONTROL=ignoreboth
> HOME=/home/me
[00:08:31.395] > 
> SHLVL=2
> LOGNAME=me
> SSH_CONNECTION=5.70.22.184 49946 10.0.0.15 22
> VIRTUALENVWRAPPER_WORKON_CD=1
> _=/usr/bin/printenv
> Starting server...
> Waiting for server log...
[00:08:31.407] > 
> 
[00:08:31.899] > Waiting for server log...
> 
[00:08:32.403] > Waiting for server log...
> 
[00:08:32.905] > Waiting for server log...
> 
[00:08:33.428] > Waiting for server log...
> 
[00:08:33.912] > Waiting for server log...
> 
[00:08:34.415] > Waiting for server log...
> 
[00:08:34.916] >  
> *
> * Reminder: You may only use this software with Visual Studio family products,  
> * as described in the license (https://go.microsoft.com/fwlink/?linkid=2077057) 
> *
> 
[00:08:34.924] > 
> Server did not start successfully. Full server log >>>
> node: ../deps/uv/src/unix/core.c:544: uv__close_nocheckstdio: Assertion `fd > -1
> ' failed.
> Aborted
> <<< End of server log
> 583217fe4d56##32##
[00:08:34.936] > 
> 
[00:08:35.223] "install" terminal command done
[00:08:35.223] Install terminal quit with output: 583217fe4d56##32##
[00:08:35.223] Received install output: 583217fe4d56##32##
[00:08:35.224] Resolver error: The VS Code Server failed to start
[00:08:35.225] TELEMETRY: {"eventName":"resolver","properties":{"outcome":"failure","reason":"ExitCode","askedPw":"0","askedPassphrase":"0","asked2fa":"0","askedHostKey":"0","gotUnrecognizedPrompt":"0","remoteInConfigFile":"1"},"measures":{"resolveAttempts":1,"exitCode":32,"retries":1}}
[00:08:35.226] ------

Googling a similar error microsoft directed them to: https://code.visualstudio.com/docs/remote/linux

Any help would be much appreciated. Thanks

It sounds like VS Code is trying to run a Node program on PythonAnywhere; do you happen to know which version of Node it's using? The most recent version isn't compatible with our virtualization system.

Unfortunately, I don't know the answer to this question. If it is a compatibility problem I guess I'll have to wait and hope it gets fixed at some point.

I think I'm running into a similar problem. The logs I get are similar to the ones posted above, the error looks to start with this statement:

> Error, do this: mount -t proc proc /proc

And then near the end of the log I get this:

[20:44:15.434] > node: ../deps/uv/src/unix/core.c:544: uv__close_nocheckstdio: Assertion `fd > -1' failed.

The vs code extension downloads and installs remote server side components in the ~/.vscode-server/ path. This includes node.

Using this version of node and running node -v, I get

v12.4.0

and when I try to just run node to get the node shell, i get this:

node: ../deps/uv/src/unix/core.c:544: uv__close_nocheckstdio: Assertion `fd > -1' failed.

Does this help identify the source of the errors?

Can you describe what the vscode stuff is supposed to do after connecting to PythonAnywhere?

I don't know the details on what is happening on the server side. Here's a brief overview from the VS Code docs

The Visual Studio Code Remote - SSH extension allows you to open a remote folder on any remote machine, virtual machine, or container with a running SSH server and take full advantage of VS Code's feature set. Once connected to a server, you can interact with files and folders anywhere on the remote filesystem.

No source code needs to be on your local machine to gain these benefits since the extension runs commands and other extensions directly on the remote machine.

During the initial setup, when the VS Code client first makes a connection to the remote server, it downloads and installs the remote server components of the VS code extension. This is installed on the remote computer in the ~/.vscode-server path. It seems like that part worked ok.

Later, when the VS Code client makes a connection parts of the server side component are executed and will interact with the client to provide remote file access, remote debugging, etc. This is where I'm getting the errors posted above, and the full trace log is similar to what @niko86 posted above.

Details of the system requirements for the server side can be found in the VS Code Remote Development with Linux docs

Do you mean that you can sync files, but you are unable to get VS Code to run and debug files then? I can confirm on the standard setup, you wouldn't be able to run node > v10.16

That is correct, I can connect via SSH and sync files (outside of VS Code). In order to use VS Code locally on my Win10 machine to edit and debug files on PythonAnywhere, I believe it's using server side code and it appears to be using node 12.4.0.

This isn't critical to me right now, but it is something that would be nice to have, and I think others would benefit from this feature as well.

Would you like us to update your account so that you're using our new virtualization system, which should support the latest Node? It's in beta, so there might be problems with it, but we're not aware of any problems right now and we're rolling out the beta as broadly as possible so that we can track them down if there are any.

Yes that sounds good to me, I would be ok with moving to the beta platform. Thanks!

Ah, sorry! I've just realised that it wouldn't help. The new virtualization system will make it possible to run the most recent Node on PythonAnywhere in all cases, except in Jupyter notebooks and over SSH connections. And of course it's over an SSH connection that you need to run it for VS Code.

Sorry for the false hope! I'll flag this as a forum thread to post to when the new system works over SSH too.

Ok, thanks for the efforts and I'll look forward to trying this out in the future.

Sure, we'll post back here when it's ready.

I am interested in solving this as well. Thanks.

OK -- we'll post back here when it's ready.

Pinging here that I'm experiencing a similar issue.

Noted

I would also like to see this resolved. :)

Thanks for letting us know! We're moving forward slowly but surely with this -- the first step is to upgrade everyone to the new virtualization system for everything apart from SSH and Jupyter, and then we can fix those last two.

Interested in seeing a fix for this in the future :) just upgraded my account specifically for this feature

okay, thanks for the note- we will let you know when ssh can also run the latest node/VS code.

Interested in seeing a fix for this in the future :) just upgraded my account specifically for this feature +1

noted!

Also just ran into this, would love to see this implemented; vscode would be a great way to work with your environment.

sure, noted.

Note-ice me sempai

sure, we we will let you know when we have added that feature!

interested_people += 1

Ok. Noted.

Im also interested :)

Hey @all, I've been able to use the "Pony SSH" extension to connect to PythonAnywhere and edit/create/delete/etc.. files in my account. So while the standard one still doesn't seem to work, I'm using VS Code successfully at this point.

ah great, thanks for letting us know!

Also posting to show interest. Being able to use Intellisense and the other features remotely would be amazing.

Thanks! Another upvote added.

So far I can get Pony SSH to work with passwords but not with keys. Still interested in a native VScode solution. Thanks.

OK -- another upvote added!

Hi! What parmeters did you use for agent, python etc? I did get this error "Error connecting to PythonAnywhere: All configured authentication methods failed"

"ponyssh.hosts": {

    "PythonAnywhere": {
        "host": "ssh.pythonanywhere.com",
        "username": "xxx",
        "password": true,
        "agent": true
    }

I am interested, too!

What happens when you try to ssh into PA from the command line using the same credentials?

Just upgraded for vs code access via ssh :-(

Just upgraded for vs code access via ssh, that would be a really game changer

We're certainly working on it! Just to re-state the background (because it was in a post I made some time ago), VS Code needs to be able to run a recent version of Node.js from the SSH connection that it makes. Recent versions of Node need to have access to the /proc filesystem, which means that they need to use our new virtualization system. We're still working out the last bugs in that in order to make it live for all of the in-browser consoles, websites, scheduled and always-on tasks. Once that's done, we should be able to switch it on for Jupyter notebooks and SSH. The reason that they are last is that we can enable it on a per-user basis for the other things, but Jupyter and SSH are all-or-nothing -- either every user will have to have it switched on or no-one will.

I'm also interested in this, thanks.

Noted. Thanks.

still no good news?

No

It's been almost a year since the "No" above. Any updates?

Not yet

I think you should give this a little more consideration.

GitHub now has the '.' web editor available everywhere, and their CodeSpaces editor is very useful if you have it enabled. The Visual Studio Code editor is become ubiquitous. So when I ask my students to edit code using the PA online editor, as useful as it is, it doesn't have the editing features that a VS code would have, and the students are less enthusiastic about using it.

Using VS Code to remotely edit works very well (when the host allows it) and would be hugely useful.

Hoping you'll give this some serious effort at some point.

Thanks.

I think you should give this a little more consideration.

GitHub now has the '.' web editor available everywhere, and their CodeSpaces editor is very useful if you have it enabled. The Visual Studio Code editor is become ubiquitous. So when I ask my students to edit code using the PA online editor, as useful as it is, it doesn't have the editing features that a VS code would have, and the students are less enthusiastic about using it.

Using VS Code to remotely edit works very well (when the host allows it) and would be hugely useful.

Hoping you'll give this some serious effort at some point.

Thanks.

Cool. Thanks for the background.