Cannot connect to database

Hi everyone

I have been using Aiida in two different workstations available in my research group. To install Aiida in those workstations, I simply followed the steps in Installation into Conda environment — AiiDA 2.5.1.post0 documentation with no problem.

Now I have a new workstation in which I have to install Aiida again, but this time, I am having an issue. When I write verdi status, I get:

:heavy_check_mark: version: AiiDA v2.5.0
:heavy_check_mark: config: /home/ICN2/jgarridoa/.aiida
:heavy_check_mark: profile: jgarridoa
✘ storage: Unable to connect to profile’s storage.
Error: UnreachableStorage: Could not connect to database: (psycopg2.OperationalError) connection to server at “localhost” (, 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)
✘ rabbitmq: Unable to connect to rabbitmq with URL: amqp://guest:guest@
Error: ConnectionError: [Errno 111] Connect call failed (‘’, 5672)
✘ daemon: The daemon could not be reached, seemingly because of a stale PID file. Either stop or start the daemon to remove it and restore the daemon to a functional state.

Any idea of what might be causing this error?

In case it helps , I am using Ubuntu 22.04.3 LTS. The previous workstations I used have Ubuntu 22.04.2 LTS.

Thanks in advance


Hi Jaime,

I haven’t used conda/mamba much myself, but if I understand correctly the services (postgresql/rabbitMQ) need to be started again every time the environment is activated.

Can you try to restart the services after starting the environment using the “Restart the services” instructions at the end of the page you linked above?

Thanks @mbercx, I forget to tell you that I had a zoom chat with @jgarridoa. The problem he encountered was the postgreSQL can not be start because the port 5432 is used.
He is running AiiDA in a multi-user cluster with having his own folder (@jgarridoa correct me if I am wrong).
In the end the problem is solved by starting PostgreSQL with specifying the other port number. The command to run is:

pg_ctl -D mylocal_db -o "-F -p 15443" -l logfile start   # 15433 is the port number, change to what ever you need.

We can try to improve the documentation with some of these information, it now simply point to the postgresql official documentation.

For the rabbitmq, @mbercx is right, start the service with rabbitmq-server -detached solve the problem.

1 Like

Yes, it is exactly that. I am using a multi-user workstation with my own folder. The rest was exactly as you say

Thanks a lot!

1 Like

Hi again.

I kept working and I had the following problem: I had already designed a workchain and I wast trying to submit it. I was trying it via a jupyter notebook in Visual Studio Code. The problem I had was that despite having added the folder with the workchains I used to the python path, I kept getting the error that modules could not be loaded. I obtained the same error after trying adding the folder to the python path temporarily using sys. …

After checking several things, I did not arrive to any conclusion. but I thought that something might be off with my miniconda environment and how it was interacting with the pythonpath.

In the end, I decided to delete all my miniconda environmentes and then, install aiida again.

The problem I am facing now during the installation is with rabbitmq. After following the steps that worked the last time (including changing the port number), I get a different error:

✘ rabbitmq: Unable to connect to rabbitmq with URL: amqp://guest:guest@
Error: ConnectionResetError: [Errno 104] Connection reset by peer

Any idea about how to solve this problem? I would also like to know what might be causing it. After having so many weird difficulties with not only aiida but also with the things I said about the python path, I am starting to think that IT department did something weird when setting up my workstation. I have worked with aiida in two other workstations and I never had the issues I am having with this one.

Thanks a lot in advance