# (psycopg2.OperationalError)

**URL:** <https://aiida.discourse.group/t/psycopg2-operationalerror/250>\
**Category:** General Usage\
**Created:** [February 7, 2024, 9:58pm UTC](https://aiida.discourse.group/t/psycopg2-operationalerror/250 "2024-02-07T21:58:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rkarkee](https://avatars.discourse-cdn.com/v4/letter/r/a88e4f/32.png) [@rkarkee](https://aiida.discourse.group/u/rkarkee)\
**Post date:** [February 7, 2024, 9:58pm UTC](https://aiida.discourse.group/t/psycopg2-operationalerror/250/1 "2024-02-07T21:58:01Z")

</div>

Hi all,  
I have AiiDA in home directory of HPC.  
I am trying to configure the computer.yaml which has following tags:  
label: newhpc # PLEASE CHANGE HERE AS YOU WISH  
description: lanl\_hpc # PLEASE CHANGE HERE AS YOU WISH  
hostname: localhost # for example [lumi.csc.fi](http://lumi.csc.fi) for LUMI-G supercomputer; in your case it can also be a resolved address like 111.222.33.44  
transport: core.local  
scheduler: core.slurm  
work\_dir: “/lustre/scratch4/turquoise/rkarkee/AiiDA” # PLEASE CHANGE HERE AS YOU WISH  
mpirun\_command: “srun -n {tot\_num\_mpiprocs}” # leave it like this, so that `{tot_num_mpiprocs}` can be changed dynamically, e.g. in case you have other partitions on the same cluster  
mpiprocs\_per\_machine: 256 # your default number of mpiprocs on the default partition

Then when I try to configure it, I get the following:  
Can you please suggest on how may I fix this?

(aiidaENV) rkarkee@ch-fe2:~\> verdi computer setup --config computer.yaml  
Report: enter ? for help.  
Report: enter ! to ignore the default and set no value.  
Shebang line (first line of each script, starting with #!) [#!/bin/bash]: #!/bin/bash  
Default amount of memory per machine (kB).: 51765  
Escape CLI arguments in double quotes [y/N]: N  
Critical: Could not connect to database: (psycopg2.OperationalError) connection to server at “localhost” (127.0.0.1), port 5432 failed: Connection refused  
Is the server running on that host and accepting TCP/IP connections?

(Background on this error at: [Error Messages — SQLAlchemy 2.0 Documentation](https://sqlalche.me/e/20/e3q8))  
(aiidaENV) rkarkee@ch-fe2:~\>

---

<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:** [February 7, 2024, 10:19pm UTC](https://aiida.discourse.group/t/psycopg2-operationalerror/250/2 "2024-02-07T22:19:20Z")

</div>

The problem is that AiiDA requires a PostgreSQL server to run (at least for the default storage backend) and there is none running on your machine. At least not on the port 5432 that is configured.

Given that you are on an HPC cluster, I assume PostgreSQL is not running as a system service, and since you managed to create a profile, you must have installed it as part of a Conda environment? If so, please note that in this case the PostgreSQL service is not automatically started, but has to be started manually. See this thread for example solution: [Getting started — AiiDA 2.5.1.post0 documentation](https://aiida.readthedocs.io/projects/aiida-core/en/latest/intro/get_started.html#getting-started)

The documentation also contains this information: [Installation into Conda environment — AiiDA 2.5.1.post0 documentation](https://aiida.readthedocs.io/projects/aiida-core/en/latest/intro/install_conda.html#intro-get-started-conda-install)

---

<div class="post-metadata">

**Author:** ![rkarkee](https://avatars.discourse-cdn.com/v4/letter/r/a88e4f/32.png) [@rkarkee](https://aiida.discourse.group/u/rkarkee)\
**Post date:** [February 7, 2024, 10:56pm UTC](https://aiida.discourse.group/t/psycopg2-operationalerror/250/3 "2024-02-07T22:56:54Z")

</div>

Hi sphuber  
I followed the step and created a profile.  
Then when I do verdi daemon start 2, it gave me this error:

(aiidaENV) rkarkee@ch-fe2:~\> verdi daemon start 2  
Critical: Could not connect to database: (psycopg2.OperationalError) connection to server at “localhost” (127.0.0.1), port 5432 failed: FATAL: database “rkarkee\_rkarkee\_20554bcc4bead70a3479c4ef8d5f1f4e” does not exist

(Background on this error at: [Error Messages — SQLAlchemy 2.0 Documentation](https://sqlalche.me/e/20/e3q8))

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/aiida/original/1X/c417197d3750949351575d03ed03f5e2ad32e649.png) [@system](https://aiida.discourse.group/u/system)\
**Post date:** [February 6, 2026, 10:57pm UTC](https://aiida.discourse.group/t/psycopg2-operationalerror/250/4 "2026-02-06T22:57:03Z")

</div>

This topic was automatically closed 730 days after the last reply. New replies are no longer allowed.
