pyproject.tomlsetup.py based project?Scientific software tends to have more complex dependencies than most, andit will often have multiple build options to take advantage of differentkinds of hardware, or to interoperate with different pieces of externalsoftware.
In particular,NumPy, which provides the basisfor most of the software in thescientific Python stack can be configuredto interoperate with different FORTRAN libraries, and can take advantageof different levels of vectorized instructions available in modern CPUs.
Starting with version 1.10.4 of NumPy and version 1.0.0 of SciPy, pre-built32-bit and 64-bit binaries in thewheel format are available for all majoroperating systems (Windows, macOS, and Linux) on PyPI. Note, however, that onWindows, NumPy binaries are linked against theATLAS BLAS/LAPACK library, restricted to SSE2instructions, so they may not provide optimal linear algebra performance.
There are a number of alternative options for obtaining scientific Pythonlibraries (or any other Python libraries that require a compilation environmentto install from source and don’t provide pre-built wheel files on PyPI).
The same complexity which makes it difficult to distribute NumPy (and manyof the projects that depend on it) as wheel files also make them difficultto build from source yourself. However, for intrepid folks that are willingto spend the time wrangling compilers and linkers for both C and FORTRAN,building from source is always an option.
For Linux users, the system package manager will often have pre-compiledversions of various pieces of scientific software, including NumPy andother parts of the scientific Python stack.
If using versions which may be several months old is acceptable, then this islikely to be a good option (just make sure to allow access to distributionsinstalled into the system Python when using virtual environments).
Many Python projects that don’t (or can’t) currently publish wheel files atleast publish Windows installers, either on PyPI or on their projectdownload page. Using these installers allows users to avoid the need to setup a suitable environment to build extensions locally.
The extensions provided in these installers are typically compatible withthe CPython Windows installers published on python.org.
As with Linux system packages, the Windows installers will only install into asystem Python installation - they do not support installation in virtualenvironments. Allowing access to distributions installed into the system Pythonwhen using virtual environments is a common approach to working around thislimitation.
TheWheel project also provides awheel convert subcommand that canconvert a Windowsbdist_wininst installer to a wheel.
Similar to the situation on Windows, many projects (including NumPy) publishmacOS installers that are compatible with the macOS CPython binariespublished on python.org.
macOS users also have access to Linux distribution style package managerssuch asHomebrew. The SciPy site has more details on using Homebrew toinstall SciPy on macOS.
The SciPy site listsseveral distributionsthat provide the full SciPy stack toend users in an easy to use and update format.
Some of these distributions may not be compatible with the standardpipandvirtualenv based toolchain.
Spack is a flexible package managerdesigned to support multiple versions, configurations, platforms, and compilers.It was built to support the needs of large supercomputing centers and scientificapplication teams, who must often build software many different ways.Spack is not limited to Python; it can install packages forC,C++,Fortran,R, and other languages. It is non-destructive; installinga new version of one package does not break existing installations, so manyconfigurations can coexist on the same system.
Spack offers a simple but powerful syntax that allows users to specifyversions and configuration options concisely. Package files are written inpure Python, and they are templated so that it is easy to swap compilers,dependency implementations (like MPI), versions, and build options with a singlepackage file. Spack also generatesmodule files so that packages canbe loaded and unloaded from the user’s environment.
conda is an open source (BSD licensed) package management system andenvironment management system that allows users to installmultiple versions of binary software packages and their dependencies, andeasily switch between them. It is a cross-platform tool working on Windows,MacOS, and Linux. Conda can be used to package up and distribute all kinds ofpackages, it is not limited to just Python packages. It has full support fornative virtual environments. Conda makes environments first-class citizens,making it easy to create independent environments even for C libraries. It iswritten in Python, but is Python-agnostic. Conda manages Python itself as apackage, so thatconda update python is possible, in contrast topip, which only manages Python packages.
AnacondaAnaconda is a Python distribution published by Anaconda, Inc. It is a stable collection of Open Source packages for big data and scientific use, and a collection of Graphical Interface utilities for managing conda environments.
In addition to the full distribution provided by Anaconda, the conda package manager itself is available inminiconda,miniforge, andpixi.
Conda packages are available on multiple channels on Anaconda.org, including thedefault channel supported by Anaconda, Inc, the community supported conda-forge channel, which provides a wide variety of pre-built packages, and some domain-specific package collections.