This section of the manual will guide you through the process of installing AiiDA on your system. AiiDA has been tested to run on the following platforms:
- Ubuntu 14.04, 16.04
- Mac OS X
We expect that AiiDA should also run on these other platforms:
- Older and newer Ubuntu versions
- Other Linux distributions
The installation procedure can generally be split into four separate steps:
The installation procedure itself requires certain software, which therefore will have to be installed first. The following software is required to continue with the installation:
- git (To download the
- python-2.7.x (The programming language used for AiiDA)
- python-pip (Python package manager)
- virtualenv (Software to create a virtual python environment to install AiiDA in)
- postgresql (Database software version 9.4 or higher)
- RabbitMQ (A message broker necessary for AiiDA to communicate between processes)
The installation instructions for these prerequisites will depend on the operating system of your machine. We provide basic instructions for several operating systems. Make sure you have successfully installed these prerequisites before continuing with the installation guide.
With the prerequisites installed, we can now download AiiDA itself and install it along with all its python dependencies. Create a directory where you want to install AiiDA and clone the repository:
$ mkdir <your_directory> $ cd <your_directory> $ git clone https://github.com/aiidateam/aiida_core
To prevent the python packages that AiiDA depends on, from clashing with the packages you already have installed on your system, we will install them in a virtual environment. For detailed information, see the section on virtual environments. To create a new virtual environment and activate it, run the following commands:
$ virtualenv ~/aiidapy $ source ~/aiidapy/bin/activate
This will create a directory in your home directory named
aiidapy where all the packages will be installed.
After activation, your prompt now should have
(aiidapy) in front of it, indicating that you are working in the virtual environment.
You may need to install
setuptools in your virtual environment in case the system or user version of these tools is old:
$ pip install -U setuptools pip
Finally, to install AiiDA, run the following command from the directory where you cloned the repository:
(aiidapy) $ pip install -e aiida_core
(In this example the AiiDA directory is in
There are additional optional packages that you may want to install, which are grouped in the following categories:
atomic_tools: packages that allow importing and manipulating crystal structure from various formats
ssh_kerberos: adds support for ssh transport authentication through Kerberos
REST: allows a REST server to be ran locally to serve AiiDA data
docs: tools to build the documentation
advanced_plotting: tools for advanced plotting
notebook: jupyter notebook - to allow it to import AiiDA modules
testing: python modules required to run the automatic unit tests
In order to install any of these package groups, simply append them as a comma separated list in the
pip install command:
(aiidapy) $ pip install -e aiida_core[atomic_tools,docs,advanced_plotting]
If you are installing the optional
ssh_kerberos and you are on Ubuntu you might encounter an error related to the
To fix this you need to install the
sudo apt-get install libffi-dev libkrb5-dev
After successful installation AiiDA needs to be setup, which includes setting up a profile.
This can be accomplished through through AiiDA’s command line interface
The setup functionality requires that a database has already been created, for information on how to do this, please refer to the database section.
Once the database has been created, AiiDA can be setup by calling the following command:
verdi setup <profile_name>
verdi -p <profile_name> setup
where <profile_name> is a profile name of your choosing.
verdi setup command will guide you through the setup process through a series of prompts.
The first thing that will be asked to you is the timezone, extremely important to get correct dates and times for your calculations.
AiiDA will do its best to try and understand the local timezone (if properly configured on your machine), and will suggest a set of sensible values.
Choose the timezone that fits best to you (that is, the nearest city in your timezone - for Lausanne, for instance, we choose
Europe/Zurich) and type it at the prompt.
As a second parameter to input during the
verdi setup phase, the “Default user email” is asked.
We suggest here to use your institution email, that will be used to associate the calculations to you.
In AiiDA, the user email is used as username, and also as unique identifier when importing/exporting data from AiiDA.
Even if you choose an email different from the default one
aiida@localhost), a user with email
aiida@localhost will be
with its password set to
None (disabling access via this user
via API or Web interface).
The existence of a default user is internally useful for multi-user setups, where only one user runs the daemon, even if many users can simultaneously access the DB. See the page on setting up AiiDA in multi-user mode for more details (only for advanced users).
The password, in the current version of AiiDA, is not used (it will be used only in the REST API and in the web interface). If you leave the field empty, no password will be set and no access will be granted to the user via the REST API and the web interface.
Then, the following prompts will help you configure the database. Typical settings are:
Insert your timezone: Europe/Zurich Default user email: email@example.com Database engine: postgresql_psycopg2 PostgreSQL host: localhost PostgreSQL port: 5432 AiiDA Database name: aiida_dev AiiDA Database user: aiida AiiDA Database password: <password> AiiDA repository directory: /home/wagner/.aiida/repository/ [...] Configuring a new user with email 'firstname.lastname@example.org' First name: Richard Last name: Wagner Institution: BRUHL, LEIPZIG The user has no password, do you want to set one? [y/N] y Insert the new password: Insert the new password (again):
Remember that in order to work with AiiDA through for example the
verdi command, you need to be in your virtual environment.
If you open a new terminal for example, be sure to activate it first with:
$ source ~/aiidapy/bin/activate
At this point, you can choose to read on for additional installation details and configuration options, or you can choose to start using AiiDA and go straight to the section get started.
verdi command line tool has many commands and options.
To simplify its usage, there is a way to enable tab-completion for it in your bash shell.
To do so, simply run the following command:
$ verdi completioncommand
and append the result to the activation script of your virtual environment (or to your bash config, e.g.
Alternatively, you can accomplish the same by simply adding the following line to the activation script:
eval "$(verdi completioncommand)"
For the changes to apply to your current shell, make sure to source the activation script or
.bashrc (depending the approach you chose).
Adding AiiDA to the PATH¶
If you used a virtual environment for the installation of AiiDA, the required commands such as
verdi should have been added automatically to your
Otherwise, you may have to add the install directory of AiiDA manually to your
PATH so that the binaries are found.
For Linux systems, the path to add is usually
For Mac OS X systems, the path to add is usually
After updating your
PATH you can check if it worked in the following way:
verdion your terminal, and check if the program starts (it should provide a list of valid commands). If it doesn’t, check if you correctly set up the
PATHenvironment variable above.
go into your home folder or in another folder different from the AiiDA folder, run
ipythonand try to import a module, e.g. typing:
If the setup is ok, you shouldn’t get any error. If you do get an
ImportErrorinstead, check that you are in the correct virtual environment. If you did not install AiiDA within a virtual environment, you will have to set up the
PYTHONPATHenvironment variable in your
Customizing the configuration directory location¶
By default, the AiiDA configuration is stored in the directory
~/.aiida. This can be changed by setting the
AIIDA_PATH environment variable. The value of
AIIDA_PATH can be a colon-separated list of paths. For each of the paths in the list, AiiDA will look for a
.aiida directory in the given path and all of its parent folders. If no
.aiida directory is found,
~/.aiida will be used.
For example, the directory structure in your home might look like this
. ├── .aiida ├── project_a │ ├── .aiida │ └── subfolder └── project_b └── .aiida
If you set
the configuration directory used will be
~/project_a/.aiida. The same is true if you set
subdir itself does not contain a
.aiida folder, so AiiDA will first check its parent directories.
If you set
AIIDA_PATH='.', the configuration directory used depends on the current working directory. Inside the
project_b directories, their respective
.aiida directory will be used. Outside of these directories,
~/.aiida is used.
An example for when this option might be used is when two different AiiDA versions are used simultaneously. Using two different
.aiida directories also allows running two daemon concurrently.
Note however that this option does not change the database cluster that is being used. This means that by default you still need to take care that the database names do not clash.
Using AiiDA in Jupyter¶
Jupyter is an open-source web application that allows you to create in-browser notebooks containing live code, visualizations and formatted text.
Originally born out of the iPython project, it now supports code written in many languages and customized iPython kernels.
If you didn’t already install AiiDA with the
[notebook] option (during
pip install), run
pip install jupyter inside the virtualenv, and then run from within the virtualenv:
$ jupyter notebook
This will open a tab in your browser. Click on
New -> Python 2 and type:
Shit-Enter. If no exception is thrown, you can use AiiDA in Jupyter.
If you want to set the same environment as in a
verdi shell, add the following code in
try: import aiida except ImportError: pass else: c = get_config() c.InteractiveShellApp.extensions = [ 'aiida.common.ipython.ipython_magics' ]
then open a Jupyter notebook as explained above and type in a cell:
Shift-Enter. You should receive the message “Loaded AiiDA DB environment.”