Package: slycot
Python wrapper for selected SLICOT routines, notably including solvers for
Riccati, Lyapunov, and Sylvester equations.DependenciesSlycot supports Python versions 3.8 or later.To run the compiled Slycot package, the following must be installed as
dependencies:Python 3.8+NumPyIf you are compiling and installing Slycot from source, you will need the
following dependencies:Python 3.8+NumPyscikit-buildCMakeC compiler (e.g. gcc, MS Visual C++, clang)FORTRAN compiler (e.g. gfortran, ifort, flang)BLAS/LAPACK (e.g. OpenBLAS, ATLAS, MKL)To run the Slycot unit tests and examples, you’ll also need SciPy and
pytest.There are a variety of ways to install these dependencies on different
operating systems. See the individual packages’ documentation for options.InstallingThe easiest way to get started with Slycot is to install pre-compiled
binaries from conda-forge (see below); these are available for Linux,
OSX, and Windows.Compiling the Slycot source is unfortunately a bit tricky, especially
on Windows, but we give some pointers further below for doing this.Using conda and conda-forgeFirst install Miniconda or Anaconda.  Slycot can then be installed
from the conda-forge channel with the following command:conda install -c conda-forge slycotCompiling from sourceThe hardest part about installing from source is getting a working
version of FORTRAN and LAPACK (provided by OpenBLAS, MKL, etc.)
installed on your system. Depending on where you get your NumPy and SciPy
from, you will need to use a compatible LAPACK implementation. Make sure that
the correct header files are installed, and specify the CMake variableBLA_VENDOR, if necessary. We recommend to useBLA_VENDOR=Genericin order
to produce a Slycot module, which is binary compatible with all implementations.Compiling the PyPI source with pipWe publish Slycot to the Python package index, but only as a source
package, so to install using pip you’ll first need to install the
build prerequisites (compilers, libraries, etc.)If you have these build prerequisites, the command:pip install slycotwill download the latest release of the source code fromPyPI, compile, and
install Slycot into the currently configured location (virtual environment or
user site-packages).Getting the full source codeGet it from PyPIGet the source code of the latest release is available fromPyPI. It
contains both the Python to Fortran wrappers as well as the SLICOT-Reference
Fortran sources.Get it from GitHub archivesIf you decide to download a source code archive from GitHub (tagged release or
a specific branch), you also have to get the correct version of our
SLICOT-Reference fork and place it intoslycot/src/SLICOT-Reference:Download and unpackhttps://github.com/python-control/Slycot/archive/master.zipGo tohttps://github.com/python-control/Slycot/master/slycot/srcFollow the link ofSLICOT-Reference@<commit-id>Download the archive of SLICOT-Reference from the Code download button
(https://github.com/python-control/SLICOT-Reference/archive/<commit-id>.zip)Unpack the contents of the SLICOT-Reference archive intoslycot/src/SLICOT-ReferenceReplacemasterwith the release tag or branch name, which you want to build.Clone the git repositoryDirectly checkout the submodule, when cloning the git repository:git clone --recurse-submodules https://github.com/python-control/Slycot.gitor if you forked the repository:git clone --recurse-submodules https://github.com/<your-username>/Slycot.gitIf you already have a local checkout, but still need to init the submodule:git submodule init
git submodule updateCompiling the source (Linux, macOS, Windows)If you need to specify a specific compiler, set the environment variable FC
before running the install:# Linux/OSX:
export FC=/path/to/my/fortran

# Windows:
set FC=D:\path\to\my\fortran.exeTo build and install, execute:cd /path/to/slycot_src/
pip install -v .Using the conda recipeYou can use conda to compile and install Slycot from source. The recipe is
located in the folderconda-recipeand is intended to work for all
platforms.Theconda-forgechannel provides almost all requirements to compile
Slycot withconda-build, except:On macOS, you need the macOS SDK. See theconda-build documentation for macOShow to get it.On Windows, you need to installMicrosoft Visual C++ 14.xprovided e.g.
byMicrosoft Visual Studio.  To build, you’ll need a command shell setup
for both conda and the Visual Studio build tools.  Seeconda activationandMicrosoft Visual Studio setupfor information on this.To build and install:conda build -c conda-forge conda-recipe
conda install -c conda-forge --use-local slycotBuilding from source manually in a conda environment (Windows)A similar method can be used for Linux and macOS, but is detailed here
for Windows.  This method uses conda and conda-forge to get most build
dependencies,exceptfor the C compiler.This procedure has been tested on Python 3.8.InstallMicrosoft Visual Studio.Unpack the source code to a directory of your choice,Create a command shell setup that can run the conda commands and the Visual
Studio build tools (see above)In such a command shell, within the Slycot source code directory, run the
following commands to build and install Slycot (this example creates a
Python 3.8 environment):conda create --channel conda-forge --name build-slycot python=3.8 numpy scipy libblas=*=*netlib liblapack=*=*netlib scikit-build flang pytest
conda activate build-slycot

pip install -v .Additional hintsAdditional hints for how to install Slycot from source can be found in the.githubdirectory , (commands used to build and test in the GitHub Actions
CI), thelogs from the GitHub Actions, and theconda-recipedirectory
(conda pre-requisites, install and test commands) which is included
in the source code repository.TestingTo test if the installation was successful, you can run the slycot unit tests:pytest --pyargs slycotYou may also run the tests by callingslycot.test()from within the python
interpreter:import slycot
slycot.test()Importingslycotor runningpytestwithout--pyargsslycotfrom
inside the source directory will fail, unless the compiled wrapper library has
been installed into that directory. Note that the[tool:pytest]section
insetup.cfgenforces the--pyargsslycotargument by default.LicenseUp until version 0.4, Slycot used a version of SLICOT that was released under
the GPLv2 license. This requires Slycot to be released under the same license. In
December 2020, SLICOT 5.7 was released under BSD-3-Clause. However, as the
existing Slycot wrappers have been submitted by many contributors, we cannot
move away from GPLv2 unless we get the permission to do so by all authors.
Thus, Slycot remains licensed under GPLv2 until further notice.