4 Installation

In this section we discuss how to install and setup the MOSEK Fusion API for Python.

Important

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.

Compatibility

The Fusion API for Python requires Python 3 with NumPy. The supported versions of Python are shown below:

Table 4.1 Supported Python versions.

Platform

Python

Linux 64 bit x86

3.9-3.13

Linux 64 bit ARM

3.9-3.13

macOS 64 bit x86

3.9-3.13

macOS 64 bit ARM

3.9-3.13

Windows 64 bit x86

3.9-3.13

4.1 PIP

The recommended way to install MOSEK Optimization Suite is via PIP:

pip install mosek

(alternatively with --user for a user installation; all standard pip options apply).

If you installed the MOSEK package with PIP, no additional setup is required.

4.2 Manual installation

Locating files in the MOSEK Optimization Suite

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

Table 4.2 Relevant files for the Fusion API for Python.

Relative Path

Description

Label

<MSKHOME>/mosek/11.0/tools/platform/<PLATFORM>/python/3

Python 3 install

<PYTHON3DIR>

<MSKHOME>/mosek/11.0/tools/examples/fusion/python

Examples

<EXDIR>

<MSKHOME>/mosek/11.0/tools/examples/fusion/data

Additional data

<MISCDIR>

where

  • <MSKHOME> is the folder in which the MOSEK Optimization Suite has been installed,

  • <PLATFORM> is the actual platform among those supported by MOSEK, i.e. win64x86, linux64x86, linuxaarch64 or osxaarch64.

Manual install and setting up paths

You can install MOSEK for Python manually from the MOSEK distribution using pip. At least version 21.3 of pip is required, as it allows for in-tree builds. Go to the folder <MSKHOME>/mosek/11.0/tools/platform/<PLATFORM>/python/3 and run

pip install .

All standard options for pip can be applied according to the user’s needs.

4.3 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