Get started now

AMPL Installation Guides

After downloading your AMPL & Solvers bundle from the AMPL Portal, please follow the instructions below that correspond to your operating system.

How to install using amplpy:

# Install Python API for AMPL
$ python -m pip install amplpy --upgrade

# Install solver modules (e.g., HiGHS, CBC, Gurobi)
$ python -m amplpy.modules install highs cbc gurobi --upgrade

# Activate your license (e.g., free https://ampl.com/ce license)
$ python -m amplpy.modules activate <license-uuid>

# Import in Python
$ python
>>> from amplpy import AMPL
>>> ampl = AMPL() # instantiate AMPL object

VS Code | Recommended Development Environment

We recommend using Visual Studio Code with the official AMPL VS Code plugin for the best experience:

  • Full syntax highlighting and model navigation

  • Easy access to solver output

  • Integrated license and data management

👉 You can install the AMPL plugin directly from the VS Code Marketplace.

Use VS Code’s editor and the official AMPL extension to write, run, and debug models all in one environment.

  1. Install the extension from the VS Code Marketplace.
  2. If AMPL is not on the system path, configure the path to the AMPL binary in the settings.

How to use:

AMPL Model Colaboratory is a collection of AMPL models in Jupyter Notebooks that run on platforms such as Google ColabKaggleGradient, and AWS SageMaker

Setting up your notebook:

In order to use AMPL on  notebook platforms you just need to add the following two code blocks at the beginning of your notebook:

# Install dependencies

%pip install -q amplpy
# Google Colab & Kaggle integration

from amplpy import AMPL, ampl_notebook
ampl = ampl_notebook(
modules=["gurobi", "cbc", "highs"], # modules to install
license_uuid="default") # license to use

Direct Install to use with Other APIs

AMPL APIs are interfaces that allow developers to access the features of the AMPL interpreter from within a programming language. We have APIs available for:

Download and Install AMPL

  1. Download the Windows installer from the AMPL License Portal website.

  2. Run the installer.

  3. When prompted, enter your License UUID (e.g., for AMPL Community Edition or AMPL for Courses).

    • If you provide it during installation, your license will be automatically activated.

Tip: We recommend installing AMPL in your home folder (e.g., C:\Users\<YourName>\AMPL) to avoid permission issues.

If using dynamic cloud licenses, do not install in C:\Program Files\AMPL — that folder is read-only and won’t work with dynamic licensing.

If AMPL Is Already Installed

If you’ve already installed AMPL but didn’t enter your license during installation, you can activate it manually:

  1. Open AMPL.

  2. Run the following command inside the AMPL console:

				
					ampl: shell "amplkey activate --uuid <license-uuid>";
				
			

       3. Close and restart AMPL to apply the license.

VS Code | Recommended Development Environment

We recommend using Visual Studio Code with the official AMPL VS Code plugin for the best experience:

  • Full syntax highlighting and model navigation

  • Easy access to solver output

  • Integrated license and data management

👉 You can install the AMPL plugin directly from the VS Code Marketplace.

Download and Install AMPL

  1. Download the macOS installer from the AMPL License Portal website.

  2. Run the installer and follow the on-screen instructions.

  3. At the end of the installation process, you will be prompted to enter your License UUID (e.g., for AMPL Community Edition or AMPL for Courses).

    • If you provide it during installation, your license will be automatically activated.

If AMPL Is Already Installed

If you’ve already installed AMPL but didn’t enter your license during installation, you can activate it manually:

  1. Open AMPL (e.g., from Terminal or the AMPL application).

  2. Run the following command inside the AMPL console:

				
					ampl: shell "amplkey activate --uuid <license-uuid>";
				
			

         * Replace <license-uuid> with the actual license code you received.

       3. Close and restart AMPL to apply the license.

VS Code | Recommended Development Environment

We recommend using Visual Studio Code with the official AMPL VS Code plugin for the best experience:

  • Full syntax highlighting and model navigation

  • Easy access to solver output

  • Integrated license and data management

👉 You can install the AMPL plugin directly from the VS Code Marketplace.

Download and Extract

Download and extract your bundle above. This will be your AMPL directory. Rename it if you like, and move it anywhere on your computer that you want.

Warning: Please make sure you place AMPL in a directory where you have write permissions such as your home directory. Otherwise, please see the note at the end.

To run via VS Code

Open VS Code, install the AMPL plugin. If AMPL is not on the system path, configure the path to the AMPL binary in the settings.

To run via the command line

In a command window, use cd to go to your AMPL directory, then type ./ampl at the system prompt. Then you will see an ampl: prompt and can proceed to type AMPL commands.

Activate your license if you received a license UUID (e.g., AMPL CE licenses)

Run this command in AMPL to activate your license:

				
					ampl: shell "amplkey activate --uuid <license-uuid>";
      # replace <license-uuid> by the license UUID
				
			

Note: you need to restart AMPL in order to start using the new license.

Note

If you install AMPL somewhere in your home directory, you do not need to worry about the following.

If you use cloud licenses (e.g., AMPL Community Edition licenses), the AMPL directory cannot be read-only. If really you want to have AMPL installed on a read-only directory, you need to set the environment variables AMPL_LICFILE to a location where you store ampl.lic and where you have permissions to write, and set AMPLKEY_RUNTIME_DIR to a temporary directory.

For instance, assuming that you want to install AMPL on a Linux system in the /opt directory, which is not writeable by normal users. To install AMPL and dynamic licenses, you need to do the following:

  1. Unpack the AMPL tarball into /opt as root user. The executables should then be at /opt/ampl.linux-intel64/.

  2. For each user that wants to use this AMPL installation with his own license:

    1. Define environment variables to point to a writeable directory in the user home directory:

				
					    export AMPL_LICFILE=$HOME/.ampl/ampl.lic
    export AMPLKEY_RUNTIME_DIR=$HOME/.ampl
    export PATH=/opt/ampl.linux-intel64/:$PATH
				
			

and add those definitions to the .bash_profile or .bashrc of each user.

2. Start a new terminal in order to load the new environment variable definitions.

3. Run the amplkey activate --uuid <license-uuid> command in the terminal.