Unix (Linux, Mac OS X)
Knitro is supported on Linux (64-bit), Mac OS X (64-bit x86_64 on Mac OS X 10.8 or higher).
The Knitro software package for Unix is delivered as a gzipped tar file, or as a zip file on Mac OS X. Save this file in a fresh subdirectory on your system. To unpack a gzipped tar file, type the commands:
> gunzip knitro-|release|-platformname.tar.gz > tar -xvf knitro-|release|-platformname.tar
Unpacking will create a directory named knitro-11.1.0-z. Contents of the full product distribution are the following:
INSTALL: A file containing installation instructions.
LICENSE_KNITRO: A file containing the Knitro license agreement.
README: A file with instructions on how to get started using Knitro.
Knitro_11_1_ReleaseNotes: A file containing release notes.
get_machine_ID: An executable that identifies the machine ID, required for obtaining a Artelys license file.
doc: A directory containing Knitro documentation, including this manual.
include: A directory containing the Knitro header file
lib: A directory containing the Knitro library files:
libknitro.dylibon Mac OS X), as well as any other libraries that can be used with Knitro.
examples: A directory containing examples of how to use the Knitro API in different programming languages (C, C++, Fortran, Java, Python, R). The
examples/Cdirectory contains the most extensive set (see
knitroampl: A directory containing knitroampl (the Knitro solver for AMPL), instructions, and an example model for testing Knitro with AMPL.
knitromatlab: A folder containing the files needed to use the Knitro solver for MATLAB, example models, and the instructions and explanation file
To activate Knitro for your computer you will need a valid Artelys license file. If you purchased a floating network license, then refer to the Artelys License Manager User’s Manual. For a stand-alone license, execute get_machine_ID, a program supplied with the distribution. This will generate a machine ID (five pairs of hexadecimal digits).
If purchased through Artelys, you may request your license key from your
Artelys customer area at https://www.artelys.com/en/home
using your machine ID (please contact firstname.lastname@example.org
if you have any
issue with your customer area). If Knitro was purchased through a
distributor, then email the machine ID to your local distributor.
Artelys (or your local distributor) will then send a license file containing
the encrypted license text
string. The Artelys license manager supports a variety of ways
to install licenses. The simplest
procedure is to copy each license into your
The license file name may be changed, but must begin with the characters
(use lower-case letters).
If this does not work, try creating a new environment variable
ARTELYS_LICENSE and set it to the folder holding your license file(s).
See information on setting environment variables below and refer to the
Artelys License Manager User’s Manual for more installation details.
Setting environment variables
In order to run Knitro binary or executable files from anywhere on your Unix computer, as well as load dynamic, shared libraries (i.e. “.so” or “.dylib” files) used by Knitro at runtime, it is necessary to make sure that several environment variables are set properly on your machine.
In particular, you must update the
PATH environment variable
so that it indicates the location of the
knitroampl directory (or
whichever directory contains the knitroampl executable file).
You must also update the
DYLD_LIBRARY_PATH on Mac OS X)
environment variable so that it indicates the location of the Knitro
lib directory (containing the Knitro provided “.so” or “.dylib” shared libraries).
DYLD_LIBRARY_PATH on Mac OS X)
environment variables on Unix systems can be done as follows. In the instructions
below, replace <file_absolute_path> with the full path to the directory
containing the Knitro binary file (e.g. the
knitroampl directory), and replace
<file_absolute_library_path> with the full path to the directory
containing the Knitro shared object library (e.g. the Knitro
If you run a Unix bash shell, then type:> export PATH= <file_absolute_path>:$PATH > export LD_LIBRARY_PATH= <file_absolute_library_path>:$LD_LIBRARY_PATH
If you run a Unix csh or tcsh shell, then type:> setenv PATH <file_absolute_path>:$PATH > setenv LD_LIBRARY_PATH <file_absolute_library_path>:$LD_LIBRARY_PATH
Mac OS X
Determine the shell being used:> echo $SHELL
If you run a Unix bash shell, then type:> export PATH= <file_absolute_path>:$PATH > export DYLD_LIBRARY_PATH=<file_absolute_library_path>:$DYLD_LIBRARY_PATH
If you run a Unix csh or tcsh shell, then type:> setenv PATH <file_absolute_path>:$PATH > setenv DYLD_LIBRARY_PATH <file_absolute_library_path>:$DYLD_LIBRARY_PATH
Note that the value of the environment variable is only valid in the shell in which it was defined. Moreover, if a particular environment variable points to more than one directory that contains a binary or dynamic library of the same name, the one that will be chosen is the one whose directory appears first in the environment variable definition.
If you are using Knitro with AMPL, you should also make sure the directory
containing the AMPL executable file ampl is added to the
PATH environment variable (as well as the directory containing the
knitroampl executable file as described above).
Additionally, if you are using an external third party runtime library
with Knitro such as your own Basic Linear Algebra Subroutine (BLAS)
libraries (see user options
or a Linear Programming (LP) solver library (see user option
lpsolver), then you will also need to add
the directories containing these libraries to the
DYLD_LIBRARY_PATH on Mac OS X)
If you are setting the
ARTELYS_LICENSE environment variable to activate
your license, then follow the instructions above to
create a new environment variable called
ARTELYS_LICENSE and give it
the value of the directory containing your Artelys license file (specify the
whole path to this directory).
For more installation options and general troubleshooting,
read the Artelys License Manager User’s Manual.
Knitro for MATLAB
To use Knitro with MATLAB, you may need to add the Knitro/MATLAB interface files to your MATLAB path. Assuming the default installation folders were used and the KNITRODIR environment variable contains the path to the Knitro installation directory, the MATLAB path can be updated with the following commands in MATLAB:
> addpath(strcat(getenv('KNITRODIR’),’/knitromatlab')); > savepath();
Alternatively, if the environment variable is not set properly, you can update the MATLAB path by calling addpath() with the full path to the Knitro/MATLAB interface files, such as:
> addpath('/home/user/knitro-|release|/knitromatlab'); > savepath();