In this section we discuss how to install and setup the MOSEK Fusion API for Python.
Before running this MOSEK interface please make sure that you:
The Fusion API for Python requires Python with numpy. The supported versions of Python are shown below:
Platform Python PyPy2.7 Linux 64 bit 2.7, 3.5 and newer Yes Mac OS 64 bit 2.7, 3.5 and newer Yes Windows 32 and 64 bit 2.7, 3.5 and newer Yes
The relevant files of the Fusion API for Python are organized as reported in Table 4.1.
||Python 2 install||
||Python 3 install||
<MSKHOME>is the folder in which the MOSEK package has been installed,
<PLATFORM>is the actual platform among those supported by MOSEK, i.e.
Manual install and setting up paths
To install MOSEK for Python run the
<PYTHON3DIR>/setup.py script depending on the Python version you want to use. This will add the MOSEK module to your Python distribution’s library of modules. The script accepts the standard options typical for Python setup scripts. For instance, to install MOSEK for Python 3 in the user’s local library run:
$ python3 <PYTHON3DIR>/setup.py install --user
on Linux and Mac OS or
C:\> python3 <PYTHON3DIR>\setup.py install --user
For a system-wide installation drop the
If you installed the MOSEK package as part of Anaconda, no additional setup is required.
A simple PIP installer with instructions is available from the MOSEK Github repository at https://github.com/MOSEK/Mosek.pip.
Note that the official PIP repository contains another package with an old version of MOSEK, that was not created by Mosek ApS, and we do not recommend it.
4.1 Testing the Installation¶
First of all, to check that the Fusion API for Python was properly installed, start Python and try
The installation can further be tested by running some of the enclosed examples. Open a terminal, change folder to
<EXDIR> and use Python to run a selected example, for instance: