paramiko.ssh_exception.NoValidConnectionsError

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 userTanay.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

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

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

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

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.

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.

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 :smiley:

Anyway, could you please share the output of

verdi computer show localhost
verdi computer configure show localhost
(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

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.

Thanks a ton, @sphuber. It worked.

(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”.

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

Best of luck