.. _setupdakota-main:

"""""""""""""""
Getting Started
"""""""""""""""

.. _setupdakota-download:

===============
Download Dakota
===============

------------------
Command Line + GUI
------------------

- **6.19.0** `macOS`__ | `Windows`__ | `Linux (RHEL7)`__ | `Linux (RHEL8)`__
- **6.18.0** `macOS`__ | `Windows`__ | `Linux (RHEL7)`__ | `Linux (RHEL8)`__
- **6.17.0** `macOS`__ | `Windows`__ | `Linux (RHEL7)`__ | `Linux (RHEL8)`__
- **6.16.0** `macOS`__ | `Windows`__ | `Linux (RHEL7)`__ 

.. __: https://github.com/snl-dakota/dakota/releases/download/v6.19.0/dakota-6.19.0-public-darwin.Darwin.x86_64-gui_cli.tar.gz
__ https://github.com/snl-dakota/dakota/releases/download/v6.19.0/dakota-6.19.0-public-windows.Windows.x64-gui_cli.zip
__ https://github.com/snl-dakota/dakota/releases/download/v6.19.0/dakota-6.19.0-public-rhel7.Linux.x86_64-gui_cli.tar.gz
__ https://github.com/snl-dakota/dakota/releases/download/v6.19.0/dakota-6.19.0-public-rhel8.Linux.x86_64-gui_cli.tar.gz
__ https://github.com/snl-dakota/dakota/releases/download/v6.18.0/dakota-6.18.0-public-darwin.Darwin.x86_64-gui_cli.tar.gz
__ https://github.com/snl-dakota/dakota/releases/download/v6.18.0/dakota-6.18.0-public-windows.Windows.x64-gui_cli.zip
__ https://github.com/snl-dakota/dakota/releases/download/v6.18.0/dakota-6.18.0-public-rhel7.Linux.x86_64-gui_cli.tar.gz
__ https://github.com/snl-dakota/dakota/releases/download/v6.18.0/dakota-6.18.0-public-rhel8.Linux.x86_64-gui_cli.tar.gz
__ https://github.com/snl-dakota/dakota/releases/download/v6.17.0/dakota-6.17.0-release-public-darwin.Darwin.x86_64-gui_cli.tar.gz
__ https://github.com/snl-dakota/dakota/releases/download/v6.17.0/dakota-6.17.0-release-public-windows.Windows.x64-gui_cli.zip
__ https://github.com/snl-dakota/dakota/releases/download/v6.17.0/dakota-6.17.0-release-public-rhel7.Linux.x86_64-gui_cli.tar.gz
__ https://github.com/snl-dakota/dakota/releases/download/v6.17.0/dakota-6.17.0-release-public-rhel8.Linux.x86_64-gui_cli.tar.gz
__ https://github.com/snl-dakota/dakota/releases/download/v6.16.0/dakota-6.16.0-public-darwin.Darwin.x86_64-gui_cli.tar.gz
__ https://github.com/snl-dakota/dakota/releases/download/v6.16.0/dakota-6.16.0-public-windows.Windows.x64-gui_cli.zip
__ https://github.com/snl-dakota/dakota/releases/download/v6.16.0/dakota-6.16.0-public-rhel7.Linux.x86_64-gui_cli.tar.gz


-----------------
Command Line Only
-----------------

- **6.19.0** `macOS`__ | `Windows`__ | `Linux (RHEL7)`__ | `Linux (RHEL8)`__ | `Source (zip)`__ | `Source (tar.gz)`__ 
- **6.18.0** `macOS`__ | `Windows`__ | `Linux (RHEL7)`__ | `Linux (RHEL8)`__ | `Source (zip)`__ | `Source (tar.gz)`__
- **6.17.0** `macOS`__ | `Windows`__ | `Linux (RHEL7)`__ | `Linux (RHEL8)`__ | `Source (zip)`__ | `Source (tar.gz)`__
- **6.16.0** `macOS`__ | `Windows`__ | `Linux (RHEL7)`__ | `Source (zip)`__ | `Source (tar.gz)`__

.. __: https://github.com/snl-dakota/dakota/releases/download/v6.19.0/dakota-6.19.0-public-darwin.Darwin.x86_64-cli.tar.gz
__ https://github.com/snl-dakota/dakota/releases/download/v6.19.0/dakota-6.19.0-public-windows.Windows.x64-cli.zip
__ https://github.com/snl-dakota/dakota/releases/download/v6.19.0/dakota-6.19.0-public-rhel7.Linux.x86_64-cli.tar.gz
__ https://github.com/snl-dakota/dakota/releases/download/v6.19.0/dakota-6.19.0-public-rhel8.Linux.x86_64-cli.tar.gz
__ https://github.com/snl-dakota/dakota/releases/download/v6.19.0/dakota-6.19.0-public-src-cli.zip
__ https://github.com/snl-dakota/dakota/releases/download/v6.19.0/dakota-6.19.0-public-src-cli.tar.gz
__ https://github.com/snl-dakota/dakota/releases/download/v6.19.0/dakota-6.18.0-public-darwin.Darwin.x86_64-cli.tar.gz
__ https://github.com/snl-dakota/dakota/releases/download/v6.18.0/dakota-6.18.0-public-windows.Windows.x64-cli.zip
__ https://github.com/snl-dakota/dakota/releases/download/v6.18.0/dakota-6.18.0-public-rhel7.Linux.x86_64-cli.tar.gz
__ https://github.com/snl-dakota/dakota/releases/download/v6.18.0/dakota-6.18.0-public-rhel8.Linux.x86_64-cli.tar.gz
__ https://github.com/snl-dakota/dakota/releases/download/v6.18.0/dakota-6.18.0-public-src-cli.zip
__ https://github.com/snl-dakota/dakota/releases/download/v6.18.0/dakota-6.18.0-public-src-cli.tar.gz
__ https://github.com/snl-dakota/dakota/releases/download/v6.17.0/dakota-6.17.0-release-public-darwin.Darwin.x86_64-cli.tar.gz
__ https://github.com/snl-dakota/dakota/releases/download/v6.17.0/dakota-6.17.0-release-public-windows.Windows.x64-cli.zip
__ https://github.com/snl-dakota/dakota/releases/download/v6.17.0/dakota-6.17.0-release-public-rhel7.Linux.x86_64-cli.tar.gz
__ https://github.com/snl-dakota/dakota/releases/download/v6.17.0/dakota-6.17.0-release-public-rhel8.Linux.x86_64-cli.tar.gz
__ https://github.com/snl-dakota/dakota/releases/download/v6.17.0/dakota-6.17.0-release-public-src-cli.zip
__ https://github.com/snl-dakota/dakota/releases/download/v6.17.0/dakota-6.17.0-release-public-src-cli.tar.gz
__ https://github.com/snl-dakota/dakota/releases/download/v6.16.0/dakota-6.16.0-public-darwin.Darwin.x86_64-cli.tar.gz
__ https://github.com/snl-dakota/dakota/releases/download/v6.16.0/dakota-6.16.0-public-windows.Windows.x64-cli.zip
__ https://github.com/snl-dakota/dakota/releases/download/v6.16.0/dakota-6.16.0-public-rhel7.Linux.x86_64-cli.tar.gz
__ https://github.com/snl-dakota/dakota/releases/download/v6.16.0/dakota-6.16.0-public-src-cli.zip
__ https://github.com/snl-dakota/dakota/releases/download/v6.16.0/dakota-6.16.0-public-src-cli.tar.gz

--------
GUI Only
--------

- **6.19.0** `macOS`__ | `Windows`__ | `Linux`__ | `Source`__
- **6.18.0** `macOS`__ | `Windows`__ | `Linux`__ | `Source`__
- **6.17.0** `macOS`__ | `Windows`__ | `Linux`__ | `Source`__
- **6.16.0** `macOS`__ | `Windows`__ | `Linux`__ | `Source`__

.. __: https://github.com/snl-dakota/dakota/releases/download/v6.19.0/dakota-6.19.0-public-Darwin.x86_64-gui.tar.gz
__ https://github.com/snl-dakota/dakota/releases/download/v6.19.0/dakota-6.19.0-public-Windows.x64-gui.zip
__ https://github.com/snl-dakota/dakota/releases/download/v6.19.0/dakota-6.19.0-public-Linux.x86_64-gui.tar.gz
__ https://github.com/snl-dakota/dakota/releases/download/v6.19.0/dakota-6.19.0-public-src-gui.zip
__ https://github.com/snl-dakota/dakota/releases/download/v6.18.0/dakota-6.18.0-public-Darwin.x86_64-gui.tar.gz
__ https://github.com/snl-dakota/dakota/releases/download/v6.18.0/dakota-6.18.0-public-Windows.x64-gui.zip
__ https://github.com/snl-dakota/dakota/releases/download/v6.18.0/dakota-6.18.0-public-Linux.x86_64-gui.tar.gz
__ https://github.com/snl-dakota/dakota/releases/download/v6.18.0/dakota-6.18.0-public-src-gui.zip
__ https://github.com/snl-dakota/dakota/releases/download/v6.17.0/dakota-6.17.0-release-public-Darwin.x86_64-gui.tar.gz
__ https://github.com/snl-dakota/dakota/releases/download/v6.17.0/dakota-6.17.0-release-public-Windows.x64-gui.zip
__ https://github.com/snl-dakota/dakota/releases/download/v6.17.0/dakota-6.17.0-release-public-Linux.x86_64-gui.tar.gz
__ https://github.com/snl-dakota/dakota/releases/download/v6.17.0/dakota-6.17.0-release-public-src-gui.zip
__ https://github.com/snl-dakota/dakota/releases/download/v6.16.0/dakota-6.16.0-release-public-Darwin.x86_64-gui.tar.gz
__ https://github.com/snl-dakota/dakota/releases/download/v6.16.0/dakota-6.16.0-release-public-Windows.x64-gui.zip
__ https://github.com/snl-dakota/dakota/releases/download/v6.16.0/dakota-6.16.0-release-public-Linux.x86_64-gui.tar.gz
__ https://github.com/snl-dakota/dakota/releases/download/v6.16.0/dakota-6.16.0-release-public-src-gui.zip

:ref:`Release Notes <releasenotes-main>`

.. _setupdakota-installation:

============
Installation
============

---------------------------
Installing for Linux or Mac
---------------------------

Extract archive file into suitable install location, e.g. $HOME.  If you have root access, you may extract archive file in a shared directory, e.g. /usr/local.

.. code-block::

   $ cd /path/to/Dakota/install/directory
   $ tar xzvf /path/to/Dakota-release.platform.tar.gz

Rename the extracted Dakota binary executable directory:

.. code-block::

   $ ls
   dakota-release.platform
   $ mv dakota-release.platform Dakota

Set up your platform environment to access the Dakota executable, libraries, and tests.


----------------------
Installing for Windows
----------------------

Extract archive file into suitable install location, e.g. C:\\Dakota using the Windows extract utility.

- In Windows Explorer window, highight Dakota.<release>.<platform>.zip file.
- Right click and select "Extract All"
- Select a destination, e.g. C:\\Dakota, and click the Extract button. In the instructions below, %dest_dir% refers to this destination directory. 

Rename the extracted Dakota executable directory folder:

- Right click the dakota-<release>.<platform> file, and select 'Rename'.
- Rename file to 'Dakota'. In the instructions below, %install_dir% refers to the path to this new directory, %dest_dir%\\Dakota.

Set up your platform environment to access the Dakota executable, libraries, and tests.

---------------------------------
Build from Source Code (Advanced)
---------------------------------

For custom installations, download and build Dakota from source code.

.. _setupdakota-environment:

========================
Setting Your Environment
========================

-----------------------------------------
Setting Your Environment for Linux or Mac
-----------------------------------------

**Check your PATH Setting**

*In the instructions below, $INSTALL_DIR refers to the path to the new install directory, /path/to/dakota/install/directory/Dakota.*

Make sure Dakota executables (and optionally test files and current directory) are available on the PATH by typing 'which dakota' at command line prompt. If your PATH variable is set correctly, the path to the dakota binary should be displayed.

.. code-block::

   $ which dakota
   /path/to/dakota/install/directory/bin/dakota

If your PATH variable is NOT set correctly, you will get a message like  the following:


.. code-block::

   $ which dakota
   /usr/bin/which: no dakota in (/usr/local/bin:/usr/local/sbin)

The following setup will make the dakota command and other helper programs available at the terminal. If you prefer you may refer to the dakota executable using its fully-qualified path. Note, however, that some examples will require modification to work properly if dakota and related helper programs are not on your PATH.

To persist the PATH to Dakota across terminals/sessions, make the following changes to the appropriate shell login script. If you prefer to just test in your current terminal, execute the commands directly in a terminal.

**Make Changes in Bash Shell**

1. Edit your Bash startup file in your favorite text editor. For Linux, this is ~/.bashrc. macOS terminal runs a login shell, and so the start up file may be ~/.bashrc, ~/.bash_profile, ~/.bash_login, or ~/.profile. See the manpage for Bash for more information about the differences between login and non-login shells.
2. Modify and export PATH and PYTHONPATH.  Type the following lines, replacing `$INSTALL_DIR` with the absolute path to your installation directory, e.g. $HOME. You need not add the gui path if you are not using the Dakota GUI, or PYTHONPATH if you do not plan to use the dakota.interfacing Python module.
   
- On Linux:

.. code-block::
     
   export PATH=$INSTALL_DIR/bin:$INSTALL_DIR/share/dakota/test:$INSTALL_DIR/gui:$PATH
   export PYTHONPATH=$PYTHONPATH:$INSTALL_DIR/share/dakota/Python
     
- On macOS:

.. code-block::

   export PATH=$INSTALL_DIR/bin:$INSTALL_DIR/share/dakota/test:$INSTALL_DIR/gui/Dakota_UI_6.19.0.app/Contents/MacOS:$PATH
   export PYTHONPATH=$PYTHONPATH:$INSTALL_DIR/share/dakota/Python

3. Save and close file.
4. Update changes in your shell window.
   
.. code-block::

   $ source ~/.bashrc # Or other startup file on macOS 

**Make Changes in C Shell**

1. Edit the startup file ~/.cshrc in your favorite text editor.
2. Modify and export PATH and PYTHONPATH.  Type the following lines, replacing `$INSTALL_DIR` with the absolute path to your installation directory, e.g. $HOME. You need not add the gui path if you are not using the Dakota GUI, or PYTHONPATH if you do not plan to use the dakota.interfacing Python module.

- On Linux:

.. code-block::

   set path=($INSTALL_DIR/bin $INSTALL_DIR/share/dakota/test $INSTALL_DIR/gui $path)
   setenv PYTHONPATH "${PYTHONPATH}:${INSTALL_DIR}/share/dakota/Python"

- On macOS:

.. code-block::

   set path=($INSTALL_DIR/bin $INSTALL_DIR/share/dakota/test $INSTALL_DIR/gui/Dakota_UI_6.19.0.app/Contents/MacOS $path)
   setenv PYTHONPATH "${PYTHONPATH}:${INSTALL_DIR}/share/dakota/Python"

3. Save and close file.
4. Update changes in your shell window.

.. code-block::

   $ source ~/.cshrc


------------------------------------
Setting Your Environment for Windows
------------------------------------

You will likely want to set the path to the Dakota executable. The following setup will make the dakota.exe command and other helper programs available at the command prompt. If you prefer you may refer to the dakota.exe executable using its fullly-qualified path. Note, however, that some examples will require modification to work properly if dakota.exe and related helper programs are not on your path.

1. Click the Start button and type 'cmd' in the 'Search program and files' text box to open cmd.exe.
2. At the command prompt, type the following command, replacing %install_dir% with the path to your Dakota installation:

.. code-block::

   set path=%path%;%install_dir%\bin;%install_dir%\test;%install_dir%\lib

3. Optionally, to install the dakota Python package, also perform:

.. code-block::

   set PYTHONPATH=%PYTHONPATH%;%install_dir%\share\dakota\Python
   
4. These changes are active as long as the current terminal window is open. To make them persistent, edit the system environment variables in the Windows system settings. This operation differs slightly from version to version of Windows. Consult the documentation for the one you use.


=================
Test Installation
=================

Make sure Dakota runs. You should see Dakota version information when you type:

.. code-block::

   dakota -v

**Now what?**

:ref:`Learn how to run a simple example in Dakota. <helloworld-main>`
