Skip to content

Only pure Python decimal module is used in Python 3.15 on Ubuntu #139994

Description

@serhiy-storchaka

Bug report

There is no system libmpdec on Ubuntu 24.04 LTS. So Python 3.15 falls back to pure-Python version for the decimal module.

Activity

  1. added
    type-bugAn unexpected behavior, bug, or error
    buildThe build process and cross-build
    3.15bugs and security fixes
    on Oct 12, 2025
  2. changed the title [-]Only pure Python decimal module is used in Python 3.15 on Ubunta[/-] [+]Only pure Python decimal module is used in Python 3.15 on Ubuntu[/+] on Oct 12, 2025
  3. skirpichev commented on Oct 12, 2025

    @skirpichev
    Member

    I don't think this fits meaning of "regression".

    Removal of the bundled libmpdec was previously announced and we already shifted schedule a little (to 3.16). The v3.15 was released only recently and only here silent fallback to bundled library was removed. It's in news, etc. It's not silent on the configure side. And nothing (modulo docs) was changed for previous versions of the CPython.

    The lack of the libmpdec was a known issue for Ubuntu 24.04 (and Debian version, on which it based). (This is something was happened for me by accident, see #119299). And it has a known workaround (see our CI tests). We could document this in user docs (as we did for developers). Does this make sense for you?

    Alternative - full reversion of #134078. I don't think it's a good idea - that means we shift our schedule again!

    And what's special in this Ubuntu version? I beat there are lot of systems without libmpdec, available as a native package.

  4. added
    pendingThe issue will be closed if no feedback is provided
    on Oct 12, 2025
  5. serhiy-storchaka commented on Oct 12, 2025

    @serhiy-storchaka
    MemberAuthor

    Python should fall back to the bundled version instead of pure Python implementation if system libmpdec is not found and --with-system-libmpdec is not explicitly used.

  6. serhiy-storchaka commented on Oct 12, 2025

    @serhiy-storchaka
    MemberAuthor

    Yes, this means rollback of #134078.

  7. skirpichev commented on Oct 12, 2025

    @skirpichev
    Member

    Python should fall back to the bundled version instead of pure Python implementation if system libmpdec is not found and --with-system-libmpdec is not explicitly used.

    Sorry, but that means we can't remove bundled libmpdec forever.

    Currently we have following behavior (with --with-system-libmpdec is our default, since 3.13): #134078 (comment)

    Yes, this means rollback of #134078.

    What you suggest instead as a first step, before removal of the bundled copy, as scheduled in #115119?

  8. AA-Turner commented on Oct 12, 2025

    @AA-Turner
    Member

    I think this is an Ubuntu bug rather than CPython. Debian/Ubuntu need to change how they build Python to include libmpdec, probably meaning using the bundled version now and libmpdec for the newer OS versions that it now exists in.

    cc @doko42 @mitya57

    A

  9. edmorley commented on Oct 12, 2025

    @edmorley

    It looks like libmpdec-dev + libmpdec* is available for Ubuntu 22.04 and older, and also 25.04 and newer, and is just missing for the releases in-between (such as 24.04)?
    https://packages.ubuntu.com/search?suite=all&section=all&arch=any&keywords=libmpdec-dev&searchon=names

    I'm presuming this is a side-effect of the package's removal from Debian and then reintroduction under a new maintainer later? xref:

    Seeing that the package is available in newer Ubuntu releases again, would the Ubuntu libmpdec maintainers be open to backporting it to 24.04 too?

    Whilst Ubuntu 24.04 will never ship with Python 3.15/3.16 itself, there are many people who need to build newer Python versions on all currently supported Ubuntu LTS releases.

  10. skirpichev commented on Oct 12, 2025

    @skirpichev
    Member

    Debian/Ubuntu need to change how they build Python to include libmpdec

    No, they shouldn't change anything. Never versions of the Debian/Ubuntu - will provide package for libmpdec, as before, see #115119 (comment).

    IIUC, Serhiy's issue is related to custom builds (e.g. during development) and change of meaning ./configure --with-system-libmpdec (i.e. default), introduced in v3.15.

    We have:

    1. <= 3.14: --with-system-libmpdec with a silent fallback to the bundled copy of libmpdec
    2. ???
    3. >= 3.16: --with-system-libmpdec - removed, together with bundled copy. If no system library is available - only pure-Python version will be present, no configure failure (only a warning, like for other modules). PROFIT!

    How to make 1->3 transition better?

  11. self-assigned this
    on Oct 12, 2025
  12. serhiy-storchaka commented on Oct 12, 2025

    @serhiy-storchaka
    MemberAuthor

    I suggest postponing the transition for a few years.

  13. skirpichev commented on Oct 12, 2025

    @skirpichev
    Member

    I suggest postponing the transition for a few years.

    How many, why? It's already postponed. What (and why?!) will be changed after XXX years, assuming the only reason to return libmpdec back into in the Debian was feedback from the CPython core dev?

    Most other systems don't have libmpdec available as binary package at all. Silent fallback (#119196) to bundled library was a reaction to stupid (IMO) actions of Debian maintainers (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1056785).

  14. serhiy-storchaka commented on Oct 13, 2025

    @serhiy-storchaka
    MemberAuthor

    The date of End of Standard Support of Ubuntu 24.04 LTS is Apr 2029. Python 3.18 will be released after that date, so the bundled copy of libmpdec can be safely removed in 3.18.

  15. skirpichev commented on Oct 13, 2025

    @skirpichev
    Member

    I still see a lot of arguments against.

    1. Ubuntu is just one Linux distribution.
    2. Most others lacks libmpdec in repositories and providing the bundled copy in CPython will only delay native support for this library. Remember, the libmpdec was removed from the Debian just for that reason. Do we want this again?!
    3. Removal was already announced (and then deferred).
    4. The bundled copy is outdated.

    Note also, that "regression" happens for any system, which lacks the libmpdec installed (regardless on whether it's provided in repos or not). E.g. for Ubuntu 22.04. System packages are not installed magically :-) With removal in 3.18 - you only delay such "regression".

    CC @vstinner

    N.B.: in #134078 was mentioned alternative, when we produce a configure error with --with-system-libmpdec (i.e. current default) and a missing system libmpdec.

  16. vstinner commented on Oct 14, 2025

    @vstinner
    Member

    There is no system libmpdec on Ubuntu 24.04 LTS. So Python 3.15 falls back to pure-Python version for the decimal module.

    Maybe it's a documentation issue in the devguide. It's possible to get a package on Ubuntu with the PHP repository, see commands from the Python GitHub Actions:

    # Workaround missing libmpdec-dev on ubuntu 24.04:
    # https://launchpad.net/~ondrej/+archive/ubuntu/php
    # https://deb.sury.org/
    sudo add-apt-repository ppa:ondrej/php
    apt-get update
    apt-get -yq install libmpdec-dev

  17. vstinner commented on Oct 14, 2025

    @vstinner
    Member

    Yes, this means rollback of #134078.

    An alternative would be to fail with an error in Python 3.15 configure if libmpdec cannot be found, with a message suggesting to use --without-system-libmpdec, and maybe a link to the devguide (where we can document how to install the dependency on Ubuntu 2.04).

  18. AA-Turner commented on Oct 14, 2025

    @AA-Turner
    Member

    I agree with Sergey, we shouldn't needlessly block this on downstream redistributions. They took the decision to remove libmpdec-dev when we were already discussing this plan to eventually devendor the sources, IIUC.

    A

  19. skirpichev commented on Oct 14, 2025

    @skirpichev
    Member

    It's possible to get a package on Ubuntu with the PHP repository, see commands from the Python GitHub Actions

    @vstinner, it's already documented:

    Note that Debian 12 and Ubuntu 24.04 do not have the libmpdec-dev package. You can safely remove it from the install list above and the Python build will use a bundled version. But we recommend using the system libmpdec library. Either built it from sources or install this package from https://deb.sury.org/.

    An alternative would be to fail with an error in Python 3.15 configure if libmpdec cannot be found, with a message suggesting to use --without-system-libmpdec

    Yes, this was already suggested above.

    The major drawback is that for people who don't care - this will be an additional source of pain. First, they have to add --without-system-libmpdec, then remove it at some point in the future. I.e. in 3.16, if removal schedule will be unchanged.

  20. vstinner commented on Oct 14, 2025

    @vstinner
    Member

    First, they have to add --without-system-libmpdec, then remove it at some point in the future. I.e. in 3.16, if removal schedule will be unchanged.

    If the option is removed in Python 3.16, configure would just ignore the unknown option with a warning. It's not a big deal.

    Example:

    $ ./configure --without-unknown-option
    configure: WARNING: unrecognized options: --without-unknown-option
    
  21. skirpichev commented on Oct 19, 2025

    @skirpichev
    Member

    I'm going to close this in few days.

    Apparently, it's not a regression. I will also update #115119: lets decide in that issue if we should make --without-system-libmpdec mandatory to fallback on bundled copy.

  22. skirpichev commented on Oct 26, 2025

    @skirpichev
    Member

    Closing in favor of #115119.

    It's not a regression. This is an inherently incompatible change, which we have to do.

  23. removed
    pendingThe issue will be closed if no feedback is provided
    on Oct 26, 2025
  24. removed their assignment
    on Oct 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.15bugs and security fixesbuildThe build process and cross-buildtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions