INSTALL.rst.txt 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. Building and installing SciPy
  2. +++++++++++++++++++++++++++++
  3. See https://www.scipy.org/install.html
  4. .. Contents::
  5. INTRODUCTION
  6. ============
  7. It is *strongly* recommended that you use either a complete scientific Python
  8. distribution or binary packages on your platform if they are available, in
  9. particular on Windows and Mac OS X. You should not attempt to build SciPy if
  10. you are not familiar with compiling software from sources.
  11. Recommended distributions are:
  12. - Enthought Canopy (https://www.enthought.com/products/canopy/)
  13. - Anaconda (https://www.anaconda.com)
  14. - Python(x,y) (https://python-xy.github.io/)
  15. - WinPython (https://winpython.github.io/)
  16. The rest of this install documentation summarizes how to build Scipy. Note
  17. that more extensive (and possibly more up-to-date) build instructions are
  18. maintained at https://scipy.github.io/devdocs/building/
  19. PREREQUISITES
  20. =============
  21. SciPy requires the following software installed for your platform:
  22. 1) Python__ 2.7 or >= 3.4
  23. __ https://www.python.org
  24. 2) NumPy__ >= 1.8.2
  25. __ https://www.numpy.org/
  26. 3) For building from source: setuptools__
  27. __ https://github.com/pypa/setuptools
  28. 4) If you want to build the documentation: Sphinx__ >= 1.2.1
  29. __ http://www.sphinx-doc.org/
  30. 5) If you want to build SciPy master or other unreleased version from source
  31. (Cython-generated C sources are included in official releases):
  32. Cython__ >= 0.23.4
  33. __ http://cython.org/
  34. Windows
  35. -------
  36. Compilers
  37. ~~~~~~~~~
  38. There are two ways to build Scipy on Windows:
  39. 1. Use Intel MKL, and Intel compilers or ifort + MSVC. This is what Anaconda
  40. and Enthought Canopy use.
  41. 2. Use MSVC + gfortran with OpenBLAS. This is how the SciPy Windows wheels are
  42. built.
  43. Mac OS X
  44. --------
  45. It is recommended to use gcc or clang, both work fine. Gcc is available for
  46. free when installing Xcode, the developer toolsuite on Mac OS X. You also
  47. need a fortran compiler, which is not included with Xcode: you should use a
  48. recent gfortran from an OS X package manager (like Homebrew).
  49. Please do NOT use gfortran from `hpc.sourceforge.net <http://hpc.sourceforge.net>`_,
  50. it is known to generate buggy scipy binaries.
  51. You should also use a BLAS/LAPACK library from an OS X package manager.
  52. ATLAS, OpenBLAS, and MKL all work.
  53. As of Scipy version 1.2.0, we do not support compiling against the system
  54. Accelerate library for BLAS and LAPACK. It does not support a sufficiently
  55. recent LAPACK interface.
  56. Linux
  57. -----
  58. Most common distributions include all the dependencies. You will need to
  59. install a BLAS/LAPACK (all of ATLAS, OpenBLAS, MKL work fine) including
  60. development headers, as well as development headers for Python itself. Those
  61. are typically packaged as python-dev
  62. INSTALLING SCIPY
  63. ================
  64. For the latest information, see the web site:
  65. https://www.scipy.org
  66. Development version from Git
  67. ----------------------------
  68. Use the command::
  69. git clone https://github.com/scipy/scipy.git
  70. cd scipy
  71. git clean -xdf
  72. python setup.py install --user
  73. Documentation
  74. -------------
  75. Type::
  76. cd scipy/doc
  77. make html
  78. From tarballs
  79. -------------
  80. Unpack ``SciPy-<version>.tar.gz``, change to the ``SciPy-<version>/``
  81. directory, and run::
  82. pip install . -v --user
  83. This may take several minutes to half an hour depending on the speed of your
  84. computer.
  85. TESTING
  86. =======
  87. To test SciPy after installation (highly recommended), execute in Python
  88. >>> import scipy
  89. >>> scipy.test()
  90. To run the full test suite use
  91. >>> scipy.test('full')
  92. If you are upgrading from an older SciPy release, please test your code for any
  93. deprecation warnings before and after upgrading to avoid surprises:
  94. $ python -Wd -c my_code_that_shouldnt_break.py
  95. Please note that you must have version 1.0 or later of the Pytest test
  96. framework installed in order to run the tests. More information about Pytest is
  97. available on the website__.
  98. __ https://pytest.org/
  99. COMPILER NOTES
  100. ==============
  101. You can specify which Fortran compiler to use by using the following
  102. install command::
  103. python setup.py config_fc --fcompiler=<Vendor> install
  104. To see a valid list of <Vendor> names, run::
  105. python setup.py config_fc --help-fcompiler
  106. IMPORTANT: It is highly recommended that all libraries that scipy uses (e.g.
  107. BLAS and ATLAS libraries) are built with the same Fortran compiler. In most
  108. cases, if you mix compilers, you will not be able to import Scipy at best, have
  109. crashes and random results at worst.
  110. UNINSTALLING
  111. ============
  112. When installing with ``python setup.py install`` or a variation on that, you do
  113. not get proper uninstall behavior for an older already installed Scipy version.
  114. In many cases that's not a problem, but if it turns out to be an issue, you
  115. need to manually uninstall it first (remove from e.g. in
  116. ``/usr/lib/python3.4/site-packages/scipy`` or
  117. ``$HOME/lib/python3.4/site-packages/scipy``).
  118. Alternatively, you can use ``pip install . --user`` instead of ``python
  119. setup.py install --user`` in order to get reliable uninstall behavior.
  120. The downside is that ``pip`` doesn't show you a build log and doesn't support
  121. incremental rebuilds (it copies the whole source tree to a tempdir).
  122. TROUBLESHOOTING
  123. ===============
  124. If you experience problems when building/installing/testing SciPy, you
  125. can ask help from scipy-user@python.org or scipy-dev@python.org mailing
  126. lists. Please include the following information in your message:
  127. NOTE: You can generate some of the following information (items 1-5,7)
  128. in one command::
  129. python -c 'from numpy.f2py.diagnose import run; run()'
  130. 1) Platform information::
  131. python -c 'import os, sys; print(os.name, sys.platform)'
  132. uname -a
  133. OS, its distribution name and version information
  134. etc.
  135. 2) Information about C,C++,Fortran compilers/linkers as reported by
  136. the compilers when requesting their version information, e.g.,
  137. the output of
  138. ::
  139. gcc -v
  140. g77 --version
  141. 3) Python version::
  142. python -c 'import sys; print(sys.version)'
  143. 4) NumPy version::
  144. python -c 'import numpy; print(numpy.__version__)'
  145. 5) ATLAS version, the locations of atlas and lapack libraries, building
  146. information if any. If you have ATLAS version 3.3.6 or newer, then
  147. give the output of the last command in
  148. ::
  149. cd scipy/Lib/linalg
  150. python setup_atlas_version.py build_ext --inplace --force
  151. python -c 'import atlas_version'
  152. 7) The output of the following commands
  153. ::
  154. python INSTALLDIR/numpy/distutils/system_info.py
  155. where INSTALLDIR is, for example, /usr/lib/python3.4/site-packages/.
  156. 8) Feel free to add any other relevant information.
  157. For example, the full output (both stdout and stderr) of the SciPy
  158. installation command can be very helpful. Since this output can be
  159. rather large, ask before sending it into the mailing list (or
  160. better yet, to one of the developers, if asked).
  161. 9) In case of failing to import extension modules, the output of
  162. ::
  163. ldd /path/to/ext_module.so
  164. can be useful.