Skip to content

Addressing Dependency Challenges / Future of Sage-the-Distribution #39192

@tobiasdiez

Description

@tobiasdiez

One of the major pain points for users and developers of Sage is the need to install a wide range of dependencies before getting started with actually building sagelib. The idea of this issue is to discuss potential solutions and hopefully converge to one long-term vision, which can then be presented/discussed further on the mailing list.


Problem Overview

  • Installing Sage often requires handling numerous dependencies, some of which can be tricky to install due to version conflicts, compatibility issues, or the lack of packaged versions in common package managers.
  • This complexity acts as a barrier for users, particularly those who are not experienced with package management or building software from source.

Potential Solutions

1. Provide Build and Install Scripts for All Dependencies

This is the current status quo for sage-the-distribution. Based on a minimal set of dependencies, all Sage dependencies are installed via a manually maintained set of installation scripts and a dependency tree.

Advantages:

  • Convenient for users.
  • Ensures a consistent set of dependencies, providing a stable basis for testing.

Disadvantages:

  • Installing these dependencies is a common source of build errors, requiring developer time to assist users with troubleshooting.
  • Scripts require constant updates as dependencies evolve.
  • There is no automated mechanism for updating external dependencies in sage-the-distribution.
  • Extensive CI testing is required to maintain the scripts, adding to the maintenance burden.
  • Lack of Windows support (currently).
  • The setup is not reusable in other projects.

2. Provide Build and Install Scripts for a Minimal Set of Dependencies

This approach involves selecting a set of supported operating systems and maintaining scripts only for a minimal set of dependencies required to install sagelib after using the OS-provided package manager. There are different flavors, Python could be managed via external tools like pyenv or uv.

Advantages:

  • Reduces the scope of dependencies Sage-the-Distribution maintains directly.
  • Easier to manage and test a minimal set of scripts compared to the full dependency tree.

Disadvantages:

  • Users may still face challenges, especially with dependencies not included in the minimal set.
  • Some dependencies would rely on external tools, requiring additional user knowledge or documentation.
  • Limited to supported operating systems, reducing flexibility.

3. Conda

Use Conda as the primary package and environment manager for Sage. Either directly using conda/mamba or via pixi.

Advantages:

  • Conda provides prebuilt binaries, allowing users to install SageMath with minimal effort and minimal chance for installation problems.
  • Conda creates isolated environments, making it possible to easily experiment with different versions of dependencies.
  • Works seamlessly across Windows, macOS, and Linux.
  • Familiarity within the scientific ecosystem: Many contributors to projects like NumPy and SciPy are already familiar with Conda workflows.

Disadvantages:

  • Users unfamiliar with Conda need to install it first and learn its basics.
  • Keeping Conda recipes updated and compatible across platforms requires ongoing effort.

4. Meson Wrap-DB

Explore using Meson Wrap-DB to manage dependencies. Meson Wrap-DB allows dependencies to be included as subprojects, simplifying their integration into the build system. In essence it is similar to the current sage-the-distro setup, but the build scripts of dependencies are written in Meson.

Advantages:

  • Meson is fast, modular, and integrates well with subprojects through Wrap-DB.
  • Wrap-DB simplifies dependency integration, reducing manual maintenance.
  • Other projects could profit from the work done, e.g. python-flint could use the same scripts to install flint in their project
  • Perhaps it's the only approach that easily allows to build dependencies for systems that they don't officially support (e.g. Windows).

Disadvantages:

  • Transitioning to Meson would require significant effort and might disrupt the current build system.
  • Contributors need to learn Meson and Wrap-DB concepts, which could initially slow development.

5. Only Rely on Package Managers to Install Dependencies

This approach would remove the need for custom build and install scripts and instead rely entirely on popular package managers like apt, yum, brew, pacman for dependency management. Users would be instructed to install dependencies using these package managers, and SageMath would ensure compatibility by specifying the required versions.
If an required version is not available, Sage would simply not install the part of sagelib that requires on this dependency.

Advantages:

  • This approach leverages the existing ecosystem of package managers, eliminating the need for custom scripts.
  • Package managers ensure that dependencies are installed in a consistent, well-tested way.

Disadvantages:

  • Many dependencies may not be available, potentially reducing the functionality of the installed sage.
  • Relying on package managers may lead to conflicts between system-level packages and the versions required by SageMath, especially for highly specific or custom libraries.
  • This method provides less control over the installation process, and custom patches or configurations for dependencies may be harder to manage.

Mixed Strategies

These potential solutions should not necessarily be seen as mutually exclusive. A mixed approach could combine the strengths of different strategies to balance simplicity, flexibility, and maintainability. For example: Conda could be the recommended installation procedure (3.) and otherwise Sage would simply not install parts of sagelib if a dependency is not installed via the system's package maanger (5.).

Request for Community Input

I invite the SageMath community to share their experiences and thoughts about these solutions. Are there additional tools or approaches we should consider to reduce the dependency burden?
Looking forward to your feedback and ideas!

Pinging a few people that showed interest in discussing these topics in the past: @kwankyu @dimpase @orlitzky @tornaria @antonio-rojas @saraedum

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions