Skip to content

Commit d08fa50

Browse files
authored
Merge pull request #64 from moorepants/setuppy-deps
Better handling of missing dependencies on install and README improvements.
2 parents ea4ce7b + 352270b commit d08fa50

File tree

2 files changed

+65
-66
lines changed

2 files changed

+65
-66
lines changed

README.rst

Lines changed: 55 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -16,114 +16,106 @@ Slycot
1616
Python wrapper for selected SLICOT routines, notably including solvers for
1717
Riccati, Lyapunov, and Sylvester equations.
1818

19-
2019
Dependencies
2120
------------
2221

23-
Supported Python versions are 2.7, and 3.5 and later.
24-
25-
Slycot depends on Numpy and, if you are installing a binary distribution,
26-
Numpy should be the only prerequisite (though you may need LAPACK
27-
libraries as well, depending on your particular system configuration).
22+
Slycot supports Python versions 2.7 and >=3.5.
2823

29-
If you are installing Slycot from source, you will need a FORTRAN
30-
compiler, such as gfortran, and BLAS/LAPACK libraries. Openblas is
31-
also supported. The build system uses skbuild (scikit-buildsystem >=
32-
0.8.1) and cmake.
24+
To run the compiled Slycot package, the following must be installed as
25+
dependencies:
3326

34-
On Debian derivatives you should be able to install OpenBLAS using::
27+
- Python 2.7, 3.5+
28+
- NumPy
3529

36-
sudo apt-get install libopenblas-dev
30+
If you are compiling and installing Slycot from source, you will need the
31+
following dependencies:
3732

38-
Additionally install cmake and install scikit-build with pip or conda.
39-
40-
On Mac, you will first need to install the `developer tools
41-
<https://developer.apple.com/xcode/>`_. You can then install gfortran using
42-
`homebrew <http://brew.sh>`_ with::
33+
- Python 2.7, 3.5+
34+
- NumPy
35+
- scikit-build >=0.8.1
36+
- cmake
37+
- C compiler (e.g. gcc, MS Visual C++)
38+
- FORTRAN compiler (e.g. gfortran, ifort, flang)
39+
- BLAS/LAPACK (e.g. OpenBLAS, ATLAS, MKL)
4340

44-
brew install gcc
41+
There are a variety of ways to install these dependencies on different
42+
operating systems. See the individual packages' documentation for options.
4543

46-
On Windows, the BLAS and LAPACK libraries can be obtained from:
44+
Installing
45+
-----------
4746

48-
http://icl.cs.utk.edu/lapack-for-windows/libraries/VisualStudio/3.4.1/Dynamic-MINGW/Win32/
47+
In general Slycot requires non-trivial compilation to install on a given
48+
system. The easiest way to get started using Slycot is by installing
49+
pre-compiled binaries. The Slycot team provides pre-compiled binaries via the
50+
conda package manager and conda forge package hosting channel for Linux, OSX,
51+
and Windows.
4952

50-
Alternatively, use conda to install BLAS and LAPACK or OpenBLAS
53+
Using conda
54+
~~~~~~~~~~~
5155

56+
Install Miniconda or Anaconda and then Slycot can be installed via the conda
57+
package manager from the conda-forge channel with the following command::
5258

53-
Installing
54-
-----------
59+
conda install -c conda-forge slycot
5560

5661
Using pip
5762
~~~~~~~~~
5863

59-
Slycot supports the pip packaging system. You must first have pip installed.
60-
61-
On Debian Linux based systems you can install pip with the command::
62-
63-
sudo apt-get install pip
64+
Slycot can also be installed via the pip package manager. Install pip as per
65+
recommendations in pip's documentation. At a minimum, Python and pip must be
66+
installed. If a pre-complied binary (i.e. "wheel") is available it will be
67+
installed with no need for compilation. If not, pip will attempt to compile the
68+
package from source and thus the compilation dependencies will be required
69+
(scikit-build, gfortran, BLAS, etc.).
6470

6571
Pip can then be used to install Slycot with the command::
6672

6773
pip install slycot
6874

69-
Note that installing with pip may or may not require having the build
70-
dependencies installed. There are some binary "wheels" available on PyPI,
71-
so if those versions match with your system, you may be able to avoid
72-
installing from source.
73-
74-
Using conda
75-
~~~~~~~~~~~
76-
77-
Slycot can be installed via the conda package manager from the conda-forge
78-
channel with the following command::
79-
80-
conda install -c conda-forge slycot
81-
8275
From source
8376
~~~~~~~~~~~
8477

8578
Unpack the course code to a directory of your choice,
86-
e.g. ``/path/to/slycot_src/``, and execute::
79+
e.g. ``/path/to/slycot_src/``
8780

88-
cd /path/to/slycot_src/
89-
python setup.py install
90-
91-
Where # is for commands that needs to be executed as root/administrator.
92-
93-
If you need to specify a specific compiler, set the environment
94-
variable FC before running the install::
81+
If you need to specify a specific compiler, set the environment variable FC
82+
before running the install::
9583

9684
# Linux/OSX:
9785
export FC=/path/to/my/fortran
9886

9987
# Windows:
10088
set FC=D:\path\to\my\fortran.exe
10189

102-
You can also use conda to build and install slycot from source::
90+
To build and install execute::
91+
92+
cd /path/to/slycot_src/
93+
python setup.py install
94+
95+
You can also use conda to build and install Slycot from source::
10396

10497
conda build conda-recipe
10598
conda install --use-local slycot
10699

107100
If you prefer to use the OpenBLAS library, a conda recipe is available in
108101
``conda-recipe-openblas``.
109102

110-
Additional tips for how to install slycot from source can be found in the
111-
.travis.yml (commands used for Travis CI) and conda-recipe/ (conda
112-
pre-requisities).
103+
Additional tips for how to install Slycot from source can be found in the
104+
``.travis.yml`` (commands used for Travis CI) and conda-recipe/ (conda
105+
pre-requisites) both which are included in the source code repository.
113106

114-
The hardest part about installing from source is getting
115-
a working version of FORTRAN and LAPACK installed on your system and working
116-
properly with Python. On Windows, the build system currently uses
117-
flang, which can be installed from conda-forge. Note that flang is
118-
incompatible with Python 2.7.
107+
The hardest part about installing from source is getting a working version of
108+
FORTRAN and LAPACK installed on your system and working properly with Python.
109+
On Windows, the build system currently uses flang, which can be installed from
110+
conda-forge. Note that flang is incompatible with Python 2.7.
119111

120-
If you are using conda, you can also get working
121-
(binary) copies of LAPACK from conda-forge using the command::
112+
If you are using conda, you can also get working (binary) copies of LAPACK from
113+
conda-forge using the command::
122114

123-
conda install -c conda-forge lapack
115+
conda install -c conda-forge lapack
124116

125117
Slycot will also work with the OpenBLAS libraries.
126118

127-
Note that in some cases you may need to set the LIBRARY_PATH environment
128-
variable to pick up dependencies such as -lpythonN.m (where N.m is the
119+
Note that in some cases you may need to set the ``LIBRARY_PATH`` environment
120+
variable to pick up dependencies such as ``-lpythonN.m`` (where N.m is the
129121
version of python you are using).

setup.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,27 @@
2121
else:
2222
import __builtin__ as builtins
2323

24-
from skbuild import setup
25-
from skbuild.command.sdist import sdist
24+
try:
25+
from skbuild import setup
26+
from skbuild.command.sdist import sdist
27+
except ImportError:
28+
raise ImportError('sckit-build must be installed before running setup.py')
2629

2730
if sys.version_info[:2] < (2, 7) or (3, 0) <= sys.version_info[0:2] < (3, 5):
2831
raise RuntimeError("Python version 2.7 or >= 3.5 required.")
2932

3033
DOCLINES = __doc__.split("\n")
3134

3235
CLASSIFIERS = """\
33-
Development Status :: 3 - Alpha
36+
Development Status :: 4 - Beta
3437
Intended Audience :: Science/Research
3538
Intended Audience :: Developers
3639
License :: OSI Approved
40+
License :: OSI Approved :: GNU General Public License v2 (GPLv2)
3741
Programming Language :: C
42+
Programming Language :: Fortran
3843
Programming Language :: Python
44+
Programming Language :: Python :: 2
3945
Programming Language :: Python :: 3
4046
Topic :: Software Development
4147
Topic :: Scientific/Engineering
@@ -240,6 +246,7 @@ def setup_package():
240246
'-DISRELEASE:STRING=' + str(ISRELEASED),
241247
'-DFULL_VERSION=' + VERSION + '.git' + gitrevision[:7]],
242248
zip_safe=False,
249+
install_requires=['numpy'],
243250
)
244251

245252
# Windows builds use Flang.

0 commit comments

Comments
 (0)