{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {},
  "_ordered_sections": [],
  "item_file": null,
  "item_line": null,
  "item_type": null,
  "aliases": [],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [],
  "signature": null,
  "references": null,
  "qa": "building:index",
  "arbitrary": [
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Admonition",
          "__tag": 4056,
          "kind": "note",
          "base_type": "note",
          "children": [
            {
              "__type": "AdmonitionTitle",
              "__tag": 4055,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "note "
                }
              ]
            },
            {
              "__type": "Paragraph",
              "__tag": 4045,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "If you are only trying to install SciPy, we recommend using binaries - see "
                },
                {
                  "__type": "Link",
                  "__tag": 4049,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Installation"
                    }
                  ],
                  "url": "https://scipy.org/install",
                  "title": ""
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": " for details on that."
                }
              ]
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Building SciPy from source requires setting up system-level dependencies (compilers, BLAS/LAPACK libraries, etc.) first, and then invoking a build. The build may be done in order to install SciPy for local usage, develop SciPy itself, or build redistributable binary packages. And it may be desired to customize aspects of how the build is done. This guide will cover all these aspects. In addition, it provides background information on how the SciPy build works, and links to up-to-date guides for generic Python build & packaging documentation that is relevant."
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Building from source"
        }
      ],
      "level": 0,
      "target": "building-from-source"
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "SciPy uses compiled code for speed, which means you need compilers and some other system-level (i.e, non-Python / non-PyPI) dependencies to build it on your system."
            }
          ]
        },
        {
          "__type": "Admonition",
          "__tag": 4056,
          "kind": "note",
          "base_type": "note",
          "children": [
            {
              "__type": "AdmonitionTitle",
              "__tag": 4055,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "note "
                }
              ]
            },
            {
              "__type": "Paragraph",
              "__tag": 4045,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "If you are using Conda, you can skip the steps in this section - with the exception of installing compilers for Windows or the Apple Developer Tools for macOS. All other dependencies will be installed automatically by the "
                },
                {
                  "__type": "InlineCode",
                  "__tag": 4051,
                  "value": "mamba env create -f environment.yml"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": " command."
                }
              ]
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "System-level dependencies"
        }
      ],
      "level": 1,
      "target": "system-level"
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "If you want to only install SciPy from source once and not do any development work, then the recommended way to build and install is to use "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "pip"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ". Otherwise, conda is recommended."
            }
          ]
        },
        {
          "__type": "Admonition",
          "__tag": 4056,
          "kind": "note",
          "base_type": "note",
          "children": [
            {
              "__type": "AdmonitionTitle",
              "__tag": 4055,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "note "
                }
              ]
            },
            {
              "__type": "Paragraph",
              "__tag": 4045,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "If you don't have a conda installation yet, we recommend using "
                },
                {
                  "__type": "Link",
                  "__tag": 4049,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Miniforge"
                    }
                  ],
                  "url": "https://github.com/conda-forge/miniforge#miniforge",
                  "title": ""
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "; any conda flavor will work though."
                }
              ]
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Building SciPy from source"
        }
      ],
      "level": 1,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Building from source to use SciPy"
        }
      ],
      "level": 2,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "If you want to build from source in order to work on SciPy itself, first clone the SciPy repository        "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "git clone https://github.com/scipy/scipy.git\ncd scipy\ngit submodule update --init",
          "execution_status": null
        },
        {
          "__type": "Admonition",
          "__tag": 4056,
          "kind": "tip",
          "base_type": "tip",
          "children": [
            {
              "__type": "AdmonitionTitle",
              "__tag": 4055,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "tip "
                }
              ]
            },
            {
              "__type": "Paragraph",
              "__tag": 4045,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "Many of the steps described below can now be accomplished automatically with commands which execute tasks in SciPy's Pixi workspace, like "
                },
                {
                  "__type": "InlineCode",
                  "__tag": 4051,
                  "value": "pixi run build"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": ". To use this workspace, "
                },
                {
                  "__type": "Link",
                  "__tag": 4049,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "install Pixi"
                    }
                  ],
                  "url": "https://pixi.sh/latest/installation/",
                  "title": ""
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": " and execute "
                },
                {
                  "__type": "InlineCode",
                  "__tag": 4051,
                  "value": "pixi task list"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": " in a local clone of SciPy's source to see the various tasks available."
                }
              ]
            },
            {
              "__type": "Paragraph",
              "__tag": 4045,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "This removes the need for developers to keep track of development environments and installed dependencies, as running a task automatically installs and uses a suitable environment. A future update to this guide will provide full details on using the Pixi workspace for SciPy development."
                }
              ]
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Then you want to do the following:"
            }
          ]
        },
        {
          "__type": "BulletList",
          "__tag": 4053,
          "ordered": true,
          "start": 1,
          "children": [
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Create a dedicated development environment (virtual environment or conda    environment),"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Install all needed dependencies ("
                    },
                    {
                      "__type": "Emphasis",
                      "__tag": 4047,
                      "children": [
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": "build"
                        }
                      ]
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", and also "
                    },
                    {
                      "__type": "Emphasis",
                      "__tag": 4047,
                      "children": [
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": "test"
                        }
                      ]
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", "
                    },
                    {
                      "__type": "Emphasis",
                      "__tag": 4047,
                      "children": [
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": "doc"
                        }
                      ]
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and    "
                    },
                    {
                      "__type": "Emphasis",
                      "__tag": 4047,
                      "children": [
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": "optional"
                        }
                      ]
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " dependencies),"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Build SciPy with our "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "spin"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " developer interface."
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Step (3) is always the same, steps (1) and (2) are different between conda and virtual environments:"
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "To build SciPy in an activated development environment, run      "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "spin build",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "This will install SciPy inside the repository (by default in a "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "build-install"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " directory). You can then run tests ("
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "spin test"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "), drop into IPython ("
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "spin ipython"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "), or take other development steps like build the html documentation or running benchmarks. The "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "spin"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " interface is self-documenting, so please see "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "spin --help"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "spin <subcommand> --help"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " for detailed guidance."
            }
          ]
        },
        {
          "__type": "Admonition",
          "__tag": 4056,
          "kind": "admonition",
          "base_type": "note",
          "children": [
            {
              "__type": "AdmonitionTitle",
              "__tag": 4055,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "IDE support & editable installs"
                }
              ]
            },
            {
              "__type": "Paragraph",
              "__tag": 4045,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "While the "
                },
                {
                  "__type": "InlineCode",
                  "__tag": 4051,
                  "value": "spin build"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": " interface is our recommended way of working on SciPy, it has one limitation: because of the custom install location, SciPy will not be recognized automatically within an IDE (e.g., for running a script via a \"run\" button, or setting breakpoints visually). This will work better with an "
                },
                {
                  "__type": "Emphasis",
                  "__tag": 4047,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "in-place build"
                    }
                  ]
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": " (or \"editable install\")."
                }
              ]
            },
            {
              "__type": "Paragraph",
              "__tag": 4045,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "Editable installs are supported via "
                },
                {
                  "__type": "InlineCode",
                  "__tag": 4051,
                  "value": "spin install"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": ". When making changes to SciPy code, including to compiled code, there is no need to manually rebuild or reinstall. However, should you need to run "
                },
                {
                  "__type": "InlineCode",
                  "__tag": 4051,
                  "value": "git clean -xdf"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": ", which removes the built extension modules, remember to also uninstall SciPy with "
                },
                {
                  "__type": "InlineCode",
                  "__tag": 4051,
                  "value": "pip uninstall scipy"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "."
                }
              ]
            },
            {
              "__type": "Paragraph",
              "__tag": 4045,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "See the "
                },
                {
                  "__type": "Link",
                  "__tag": 4049,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "meson-python"
                    }
                  ],
                  "url": "https://mesonbuild.com/meson-python/",
                  "title": ""
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": " documentation on editable installs for more details on how things work under the hood."
                }
              ]
            },
            {
              "__type": "Paragraph",
              "__tag": 4045,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "Note that editable installations are unsuitable for some forms of development, such as working on sections of C/Cython API where tests are disabled for editable installations. They also tend to hit weird corner cases more frequently than regular installations, and have some known limitations like a lack of support for static typing."
                }
              ]
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Building from source for SciPy development"
        }
      ],
      "level": 2,
      "target": "the-spin-interface"
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "If you would like to install static type stubs to aid your development of SciPy, you can include the "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "scipy-stubs"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " package in your development environment. It is available on PyPI and conda-forge - see the "
            },
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "scipy-stubs",
              "reference": {
                "__type": "LocalRef",
                "__tag": 4022,
                "kind": "docs",
                "path": "building:index"
              },
              "kind": "exists"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " installation guide."
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Installing static type stubs"
        }
      ],
      "level": 1,
      "target": null
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "BulletList",
          "__tag": 4053,
          "ordered": false,
          "start": 1,
          "children": [
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "Compiler selection and customizing a build",
                      "reference": {
                        "__type": "LocalRef",
                        "__tag": 4022,
                        "kind": "docs",
                        "path": "building:compilers_and_options"
                      },
                      "kind": "exists"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "blas_lapack",
                      "reference": {
                        "__type": "LocalRef",
                        "__tag": 4022,
                        "kind": "docs",
                        "path": "building:blas_lapack"
                      },
                      "kind": "exists"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "Cross compilation",
                      "reference": {
                        "__type": "LocalRef",
                        "__tag": 4022,
                        "kind": "docs",
                        "path": "building:cross_compilation"
                      },
                      "kind": "exists"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "Building redistributable binaries",
                      "reference": {
                        "__type": "LocalRef",
                        "__tag": 4022,
                        "kind": "docs",
                        "path": "building:redistributable_binaries"
                      },
                      "kind": "exists"
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Customizing builds"
        }
      ],
      "level": 1,
      "target": "scipy-stubs"
    },
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "BulletList",
          "__tag": 4053,
          "ordered": false,
          "start": 1,
          "children": [
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "Understanding Meson",
                      "reference": {
                        "__type": "LocalRef",
                        "__tag": 4022,
                        "kind": "docs",
                        "path": "building:understanding_meson"
                      },
                      "kind": "exists"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "Introspecting build steps",
                      "reference": {
                        "__type": "LocalRef",
                        "__tag": 4022,
                        "kind": "docs",
                        "path": "building:introspecting_a_build"
                      },
                      "kind": "exists"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "Meson and distutils ways of doing things",
                      "reference": {
                        "__type": "LocalRef",
                        "__tag": 4022,
                        "kind": "docs",
                        "path": "building:distutils_equivalents"
                      },
                      "kind": "exists"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "Miniforge"
        },
        {
          "__type": "Target",
          "__tag": 4061,
          "label": "meson-python"
        }
      ],
      "title": [
        {
          "__type": "Text",
          "__tag": 4046,
          "value": "Background information"
        }
      ],
      "level": 1,
      "target": null
    }
  ],
  "local_refs": []
}