4 Installation

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:

  • Installed MOSEK correctly. Some operating systems require extra steps. See the Installation guide for instructions and common troubleshooting tips.
  • Set up a license. See the Licensing guide for instructions.


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

Locating Files

The relevant files of the Fusion API for Python are organized as reported in Table 4.1.

Table 4.1 Relevant files for the Fusion API for Python.
Relative Path Description Label
<MSKHOME>/mosek/8/tools/platform/<PLATFORM>/python/2 Python 2 install <PYTHON2DIR>
<MSKHOME>/mosek/8/tools/platform/<PLATFORM>/python/3 Python 3 install <PYTHON3DIR>
<MSKHOME>/mosek/8/tools/examples/fusion/python Examples <EXDIR>
<MSKHOME>/mosek/8/tools/examples/fusion/data Additional data <MISCDIR>


  • <MSKHOME> is the folder in which the MOSEK package has been installed,
  • <PLATFORM> is the actual platform among those supported by MOSEK, i.e. win32x86, win64x86, linux64x86 or osx64x86.

Manual install and setting up paths

To install MOSEK for Python run the <PYTHON2DIR>/setup.py or <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

on Windows.

For a system-wide installation drop the --user flag.

Anaconda installation

If you installed the MOSEK package as part of Anaconda, no additional setup is required.

PIP install

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

import mosek

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:

python lo1.py