# paramiko.ssh\_exception.NoValidConnectionsError

**URL:** <https://aiida.discourse.group/t/paramiko-ssh-exception-novalidconnectionserror/105>\
**Category:** New to AiiDA\
**Created:** [September 13, 2023, 8:10pm UTC](https://aiida.discourse.group/t/paramiko-ssh-exception-novalidconnectionserror/105 "2023-09-13T20:10:12Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ezio](https://avatars.discourse-cdn.com/v4/letter/e/76d3ee/32.png) [@Ezio](https://aiida.discourse.group/u/Ezio)\
**Post date:** [September 13, 2023, 8:10pm UTC](https://aiida.discourse.group/t/paramiko-ssh-exception-novalidconnectionserror/105/1 "2023-09-13T20:10:12Z")

</div>

Hi,  
I am trying to set up the aiida on my local workstation to submit jobs on remote HPC/clusters following the official document. But I am facing the following error when I am doing “verdi computer test localhost”.

Report: Testing computer for user[Tanay.Sahu@inrs.ca](mailto:Tanay.Sahu@inrs.ca)…

- Opening connection… Error: Error connecting to ‘localhost’ through SSH: [SshTransport] [Errno None] Unable to connect to port 22 on 127.0.0.1, connect\_args were: {‘username’: ‘sahu’, ‘port’: 22, ‘look\_for\_keys’: False, ‘key\_filename’: ‘’, ‘timeout’: 120, ‘allow\_agent’: False, ‘proxy\_jump’: ‘’, ‘proxy\_command’: ‘’, ‘compress’: True, ‘gss\_auth’: False, ‘gss\_kex’: False, ‘gss\_deleg\_creds’: False, ‘gss\_host’: ‘localhost’}  
[FAILED]: Error while trying to connect to the computer  
Full traceback:  
Traceback (most recent call last):  
File “/home/sahu/miniconda3/envs/aiida/lib/python3.11/site-packages/aiida/cmdline/commands/cmd\_computer.py”, line 547, in computer\_test  
with transport:  
File “/home/sahu/miniconda3/envs/aiida/lib/python3.11/site-packages/aiida/transports/transport.py”, line 128, in **enter**  
self.open()  
File “/home/sahu/miniconda3/envs/aiida/lib/python3.11/site-packages/aiida/transports/plugins/ssh.py”, line 516, in open  
self.\_client.connect(self.\_machine, \*\*connection\_arguments)  
File “/home/sahu/miniconda3/envs/aiida/lib/python3.11/site-packages/paramiko/client.py”, line 381, in connect  
raise NoValidConnectionsError(errors)  
paramiko.ssh\_exception.NoValidConnectionsError: [Errno None] Unable to connect to port 22 on 127.0.0.1

---

<div class="post-metadata">

**Author:** ![giovannipizzi](https://yyz2.discourse-cdn.com/free1/user_avatar/aiida.discourse.group/giovannipizzi/32/17_2.png) [@giovannipizzi](https://aiida.discourse.group/u/giovannipizzi)\
**Post date:** [September 13, 2023, 8:29pm UTC](https://aiida.discourse.group/t/paramiko-ssh-exception-novalidconnectionserror/105/2 "2023-09-13T20:29:05Z")

</div>

Hi, do you have a SSH server installed on your localhost computer? In particular, if you run `ssh localhost` in a shell, are you able to connect? If not, you need first to install a SSH server (if you want to submit jobs to your own computer) and make sure you can connect without a password.

Best,  
Giovanni

---

<div class="post-metadata">

**Author:** ![Ezio](https://avatars.discourse-cdn.com/v4/letter/e/76d3ee/32.png) [@Ezio](https://aiida.discourse.group/u/Ezio)\
**Post date:** [September 13, 2023, 8:32pm UTC](https://aiida.discourse.group/t/paramiko-ssh-exception-novalidconnectionserror/105/3 "2023-09-13T20:32:46Z")

</div>

Thanks, @giovannipizzi, for your prompt reply.  
While running “ssh localhost” I am getting “ssh: connect to host localhost port 22: Connection refused”

---

<div class="post-metadata">

**Author:** ![sphuber](https://yyz2.discourse-cdn.com/free1/user_avatar/aiida.discourse.group/sphuber/32/6_2.png) [@sphuber](https://aiida.discourse.group/u/sphuber)\
**Post date:** [September 13, 2023, 8:45pm UTC](https://aiida.discourse.group/t/paramiko-ssh-exception-novalidconnectionserror/105/4 "2023-09-13T20:45:26Z")

</div>

Did I understand correctly that you want to use AiiDA to submit to _remote_ computers? Because in that case, you don’t want to setup `localhost` but that remote computer. For example, if the remote HPC machine is accessible at the hostname `some.hpc.hostname`, and you can SSH into it normally with `ssh some.hpc.hostname` it is this computer that you want to setup.

So you would do

```auto
verdi computer setup -T core.ssh --hostname some.hpc.hostname

```

and then you answer the other prompts.

Note that this will require that you have a passwordless SSH key that you can use to login to the remote.

---

<div class="post-metadata">

**Author:** ![Ezio](https://avatars.discourse-cdn.com/v4/letter/e/76d3ee/32.png) [@Ezio](https://aiida.discourse.group/u/Ezio)\
**Post date:** [September 13, 2023, 9:07pm UTC](https://aiida.discourse.group/t/paramiko-ssh-exception-novalidconnectionserror/105/5 "2023-09-13T21:07:20Z")

</div>

Hi @sphuber, yes, you get it right. I want to use aiida to submit to remote computers (compute canada) from my lab workstation. More specifically, I want to build a workflow for my DFT calculations. But the suggestion you have suggested, I have already done that. So as per the aiida documentation, once you set up the computer, you do “verdi computer test computername” (I have given “localhost” as my computer label). Which is giving me an error, as I mentioned in my previous post.  
I hope this clarifies the confusion.

---

<div class="post-metadata">

**Author:** ![sphuber](https://yyz2.discourse-cdn.com/free1/user_avatar/aiida.discourse.group/sphuber/32/6_2.png) [@sphuber](https://aiida.discourse.group/u/sphuber)\
**Post date:** [September 13, 2023, 9:28pm UTC](https://aiida.discourse.group/t/paramiko-ssh-exception-novalidconnectionserror/105/6 "2023-09-13T21:28:31Z")

</div>

Thanks for the additional details. That does clarify things. It was just a bit confusing that you used the label `localhost` for a remote computer 😃

Anyway, could you please share the output of

```auto
verdi computer show localhost
verdi computer configure show localhost

```

---

<div class="post-metadata">

**Author:** ![Ezio](https://avatars.discourse-cdn.com/v4/letter/e/76d3ee/32.png) [@Ezio](https://aiida.discourse.group/u/Ezio)\
**Post date:** [September 13, 2023, 9:47pm UTC](https://aiida.discourse.group/t/paramiko-ssh-exception-novalidconnectionserror/105/7 "2023-09-13T21:47:55Z")

</div>

```auto
(aiida) sahu@2034-V-011962:~$ verdi computer show localhost
--------------------------- -------------------------------------------------------------------------
Label localhost
PK 1
UUID 51f20161-d7df-47cb-bee2-f4c407a78078
Description lab workstation
Hostname localhost
Transport type core.ssh
Scheduler type core.slurm
Work directory /scratch/tanay11/aiida/
Shebang #!/bin/bash
Mpirun command mpirun -np 64
Default #procs/machine
Default memory (kB)/machine 50000000
Prepend text module purge
                             module use /lustre06/project/6042828/modules/avx2/MPI/intel2020/impi2019/
                             module load vasp/
Append text srun vasp_std

(aiida) sahu@2034-V-011962:~$ verdi computer configure show localhost
* username sahu
* port 22
* look_for_keys False
* key_filename
* timeout 120
* allow_agent False
* proxy_jump
* proxy_command
* compress True
* gss_auth False
* gss_kex False
* gss_deleg_creds False
* gss_host localhost
* load_system_host_keys True
* key_policy AutoAddPolicy
* use_login_shell True
* safe_interval 60.0

```

---

<div class="post-metadata">

**Author:** ![sphuber](https://yyz2.discourse-cdn.com/free1/user_avatar/aiida.discourse.group/sphuber/32/6_2.png) [@sphuber](https://aiida.discourse.group/u/sphuber)\
**Post date:** [September 13, 2023, 9:55pm UTC](https://aiida.discourse.group/t/paramiko-ssh-exception-novalidconnectionserror/105/8 "2023-09-13T21:55:30Z")

</div>

Thanks. I think the problem is that you set the `hostname` to `localhost`. That means you are trying to SSH into the workstation, but that is not what you want, right? You should change that to the hostname of the remote cluster that you want to submit the calculations to. You probably should also change the `gss_host` accordingly.

Finally, on a side note, you probably don’t want to have `srun vasp_std` in the `append_text`. That line should be written by the plugin. You probably can leave the `append_text` empty.

If you want to change these things, you can best `verdi computer delete` the computer and restart the setup procedure.

---

<div class="post-metadata">

**Author:** ![Ezio](https://avatars.discourse-cdn.com/v4/letter/e/76d3ee/32.png) [@Ezio](https://aiida.discourse.group/u/Ezio)\
**Post date:** [September 13, 2023, 10:30pm UTC](https://aiida.discourse.group/t/paramiko-ssh-exception-novalidconnectionserror/105/9 "2023-09-13T22:30:24Z")

</div>

Thanks a ton, @sphuber. It worked.

```auto
(aiida) sahu@2034-V-011962:~$ verdi computer test narval
Report: Testing computer<narval> for user<Tanay.Sahu@inrs.ca>...
* Opening connection... [OK]
* Checking for spurious output... [OK]
* Getting number of jobs from scheduler... [OK]: 11909 jobs found in the queue
* Determining remote user name... [OK]: tanay11
* Creating and deleting temporary file... [OK]
* Checking for possible delay from using login shell... [OK]
Success: all 6 tests succeeded
(aiida) sahu@2034-V-011962:~$ verdi computer list
Report: List of configured computers
Report: Use 'verdi computer show COMPUTERLABEL' to display more detailed information
* narval
(aiida) sahu@2034-V-011962:~$ verdi computer show narval
--------------------------- -------------------------------------------------------------------------
Label narval
PK 2
UUID d4c619b6-5c60-4821-a17d-a1bd8d32ffed
Description
Hostname narval.computecanada.ca
Transport type core.ssh
Scheduler type core.slurm
Work directory /scratch/tanay11/aiida/
Shebang #!/bin/bash
Mpirun command mpirun -np 64
Default #procs/machine
Default memory (kB)/machine 50000000
Prepend text module purge
                             module use /lustre06/project/6042828/modules/avx2/MPI/intel2020/impi2019/
                             module load vasp/
Append text
--------------------------- ----------------------------------------------------------------------

```

I was wondering if you don’t mind, if it is possible for you to point me toward the next step? It would be really helpful.  
I want to use “vasp” plugin of aiida to run my job on “narval”.

---

<div class="post-metadata">

**Author:** ![sphuber](https://yyz2.discourse-cdn.com/free1/user_avatar/aiida.discourse.group/sphuber/32/6_2.png) [@sphuber](https://aiida.discourse.group/u/sphuber)\
**Post date:** [September 14, 2023, 6:53am UTC](https://aiida.discourse.group/t/paramiko-ssh-exception-novalidconnectionserror/105/10 "2023-09-14T06:53:52Z")

</div>

Fantastic, if you could mark my previous response as the “answer” (just click the checkmark underneath it), that would be great.

If you want to use VASP with AiiDA, I suggest you install and use the excellent `aiida-vasp` plugin. You can find install instructions and tutorials in their documentation: [Welcome to AiiDA-VASP’s documentation! — AiiDA-VASP 3.0.0-5-g33fa43d documentation](https://aiida-vasp.readthedocs.io/en/latest/)

Best of luck
