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:
Platform |
Python |
---|---|
Linux 64 bit x86 |
3.7-3.13 |
Linux 64 bit ARM |
3.7-3.13 |
macOS 64 bit x86 |
3.7-3.12 |
macOS 64 bit ARM |
3.8-3.13 |
Windows 64 bit x86 |
3.7-3.13 |
4.1 PIP and Wheels¶
The recommended way to install MOSEK Optimization Suite is via PIP:
pip install Mosek --user
(skip --user
for a system-wide installation).
If you installed the MOSEK package with PIP, no additional setup is required.
4.2 Anaconda¶
The MOSEK Optimization Suite can be installed as an Anaconda package, see https://anaconda.org/MOSEK/mosek, for example by running
conda install -c mosek mosek
If you installed the MOSEK package as part of Anaconda, no additional setup is required.
4.3 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.
Relative Path |
Description |
Label |
---|---|---|
|
Python 3 install |
|
|
Examples |
|
|
Additional data |
|
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
orosx64x86
.
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/10.2/tools/platform/<PLATFORM>/python/3
and run
pip install .
All standard options for pip
can be applied according to the user’s needs.
4.4 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