Repository navigation
Unvendor libmpdec sources #115119
Description
Activity
- addedextension-modulesC modules in the Modules dirC modules in the Modules dir
on Feb 7, 2024 [...] with a fallback to the bundled copy (maybe with a warning?)
+1 for an autoconf warning.
Adding an external libmpdec to the macOS installer build shouldn't be a big issue. Assign it to me if you proceed with this.
Reacted by Zachary Ware and Erlend E. AaslandFTR: the source deps repo is now updated.
Reacted by Zachary Ware@ned-deily: for build-installer.py, is there more to do than adding a configuration for mpdecimal? I've used the following
configureoptions:['--disable-cxx', 'MACHINE=universal']Likely yes, I'll take care of it. Thanks.
Reacted by Erlend E. AaslandI took a quick look at this and be aware that this change proposal will likely impact everyone building Python 3.13 on macOS. macOS does not ship a copy of libmpdec so, if the bundled version is removed, anyone building Python on macOS will now need to provide a local copy, either building from source or using a version from one of the widely-used third-party package managers, like Homebrew or MacPorts. Both currently have
mpdecimalpackages at the 4.0.0 level. (Recall that, unlike Windows builds, we do not currently provide non-vendored third-party library binaries for macOS users, other than those built for and linked into the Pythons provided by python.org installers for macOS.) In a quick test, it appeared that with./configure --with-system-libmpdectoday,pkg-configinfo forlibmpdecwas not being used. If so, that should be corrected. And, in any case, the devguide instructions for installing dependencies will need to be updated to cover libmpdec. We should add all this and get this working before moving on to changing the installer.Reacted by Erlend E. AaslandIn a quick test, it appeared that with
./configure --with-system-libmpdectoday,pkg-configinfo forlibmpdecwas not being used. If so, that should be corrected.Last time I checked, libmpdec did not provide pkgconfig files:
$ ls $(brew --prefix libmpdec)/lib/pkgconfig ls: /opt/homebrew/opt/mpdecimal/lib/pkgconfig: No such file or directory $ cd mpdecimal-2.5.1; find . | grep pkg $
With the current 4.0.0 version, it appears both Homebrew and MacPorts ship them:
$ pkg-config libmpdec --cflags -I/opt/homebrew/Cellar/mpdecimal/4.0.0/include $ pkg-config libmpdec --libs -L/opt/homebrew/Cellar/mpdecimal/4.0.0/lib -lmpdec -lm ... $ pkg-config libmpdec --libs -L/opt/macports/lib -lmpdec -lm
Reacted by Erlend E. AaslandYes, the 4.0.0 version does indeed provide pkg-config configuration files. I'll work on an Autoconf patch.
132 remaining items
@serhiy-storchaka heh I mean neither of those are great -- I liked your idea here fwiw #139994 (comment)
I consider the disappearance of
libmpdec{,-dev}in Ubuntu 24.04 to be a bug in that version of Ubuntu; lobby them to fix it.it's an LTS, they don't add new packages. I've tried many times
it's also not present in debian:bookworm
Can't you add libmpdev in deadsnakes PPA?
Reacted by Petr Viktorin and Zachary Ware@eli-schwartz I don't control the ubuntu repositories just the deadsnakes ones. unless you're suggesting "backporting" via revendoring in a patch?
I quite literally mean backport the
*.debpackaging format package for a dpkg package named "libmpdec". If I'd meant reverting a patch to revendor the source directory I'd say "forward port the libmpdec sources from older python", which is the opposite of a backport.The repository that you control is deadsnakes, hence backport from Ubuntu 26.04 to deadsnakes.
(noticing this because of nightly builds for deadsnakes) -- removing the bundled copy makes python unbuildable on ubuntu 24.04 because there is no system libmpdec there
@asottile, could you please point to build logs or elaborate a bit exact reason of failure? Missing libmpdec shouldn't prevent CPython 3.16 from build:
$ ./configure -q configure: WARNING: no system libmpdec found; falling back to pure-Python version for the decimal module $ make -s Written build/lib.linux-x86_64-3.16/_sysconfigdata__linux_x86_64-linux-gnu.py Written build/lib.linux-x86_64-3.16/_sysconfig_vars__linux_x86_64-linux-gnu.json The necessary bits to build these optional modules were not found: _decimal To find the necessary bits, look in configure.ac and config.log. Checked 116 modules (37 built-in, 77 shared, 1 n/a on linux-x86_64, 0 disabled, 1 missing, 0 failed on import) $ ./python -m test test_decimal Using random seed: 1990606034 0:00:00 load avg: 2.12 Run 1 test sequentially in a single process 0:00:00 load avg: 2.12 [1/1] test_decimal C tests skipped: no module named _decimal. 0:00:15 load avg: 2.24 [1/1] test_decimal passed == Tests result: SUCCESS == 1 test OK. Total duration: 15.6 sec Total tests: run=579 skipped=198 Total test files: run=1/1 Result: SUCCESSIt might be that differences of pure-Python decimal module wrt the C extension break some your CI tests. In this case, please open issues.
I consider the disappearance of libmpdec{,-dev} in Ubuntu 24.04 to be a bug in that version of Ubuntu; lobby them to fix it.
They blindly follow unprofessional actions of Debian maintainers: https://bugs.debian.org/1056785.
BTW, this is not a problem for ubuntu 22.04 or 26.04. Tentative schedule for new GA images: actions/runner-images#13964 (comment)
Edit:
I would prefer waiting to remove the bundled copy until 24.04 is end-of-lifed
That means April 2034, i.e ~10 years. Any good reasons for this huge delay, given that the libmpdec is available in PPA and it's trivial to build it from sources?
- added a commit that references this issue
on May 18, 2026 - added a commit that references this issue
on Jun 1, 2026 - added a commit that references this issue
on Jun 2, 2026 I consider the disappearance of
libmpdec{,-dev}in Ubuntu 24.04 to be a bug in that version of Ubuntu; lobby them to fix it.Opened https://support-portal.canonical.com/tickets/00448718
Reacted by Victor Stinner- added a commit that references this issue
on Sep 18, 2026 Opened https://support-portal.canonical.com/tickets/00448718
Which resulted in a (currently in-progress) SRU request to add
libmpdec-devto noble, here:
https://bugs.launchpad.net/ubuntu/+source/mpdecimal/+bug/2167730Reacted by Victor StinnerReacted by Victor Stinner
To facilitate cleaner updates of the externally-maintained
libmpdecrequired by the_decimalmodule, we should migrate away from the bundled copy inModules/_decimal/libmpdecand towards an "external" incpython-source-depsfor Windows and--with-system-libmpdecby default elsewhere.My tentative plan is as follows:
mpdecimal-2.5.1andmpdecimal-4.0.0tocpython-source-deps:mpdecimal-2.5.1external (gh-115119: Switch Windows build to mpdecimal external #115182)mpdecimal-4.0.0Post#118539: amend Ubuntu CI to use system installed mpdecimallibmpdecsources #115119 (comment)--with-system-libmpdecremoval to 3.16 #139318--without-system-libmpdec(with warning): gh-115119: removed implicit fallback to the bundled libmpdec #134078--with[out]-system-libmpdecconfigureoptions andModules/_decimal/libmpdec/: gh-115119: Removed bundled copy of the libmpdec #133964Linked PRs
--with-system-libmpdecremoval to 3.16 #139318--with-system-libmpdecremoval to 3.16 (GH-139318) #139347--with-system-libmpdecremoval to 3.16 (GH-139318) #139348