Skip to content

ceph: Build with Python 3.12#455889

Open
nh2 wants to merge 3 commits intoNixOS:masterfrom
nh2:ceph-python3.12
Open

ceph: Build with Python 3.12#455889
nh2 wants to merge 3 commits intoNixOS:masterfrom
nh2:ceph-python3.12

Conversation

@nh2
Copy link
Contributor

@nh2 nh2 commented Oct 26, 2025

Closes #443671.

Extracted from PR

as mentioned in #443671 (comment)

Things done

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

Add a 👍 reaction to pull requests you find important.

nh2 and others added 2 commits October 26, 2025 14:35
Also patch s3select for arrow-cpp 20.

See: NixOS#426609

Also:

* Build with current `fmt`

Split (from the original larger contribution
NixOS#443671
) done by:
Niklas Hambüchen <[email protected]>
@nh2 nh2 requested review from benaryorg, djds and josh October 26, 2025 14:46
@nixpkgs-ci nixpkgs-ci bot added 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 11.by: package-maintainer This PR was created by a maintainer of all the package it changes. labels Oct 26, 2025
@nix-owners nix-owners bot requested review from adevress, johanot and krav October 26, 2025 14:51
# Version pinned by Ceph `src/rocksdb` submodule, last update from:
# https://github.com/ceph/ceph/tree/v19.2.3/src
rev = "9fa4990159853479a222244574ca41202e4c95c1";
sha256 = "sha256-g0CCiWHG/jjn/fumHGXp88PjOGuRjrKC3ETCy6ffWvQ=";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm I'm getting a mismatch on this hash when building:

         specified: sha256-g0CCiWHG/jjn/fumHGXp88PjOGuRjrKC3ETCy6ffWvQ=
            got:    sha256-JJXtN8mk8fRsGzyimw4e7tN2/c1RJ4Ei6YioVIMhvl0=

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, very weird. I can repro what you say. I'll push a fix but am not sure how it built yesterday given this.

Copy link
Contributor

@benaryorg benaryorg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a cursory glance from my side, I'll take a closer look soon.

Comment on lines -34 to -38

# Remove once Ceph supports arrow-cpp >= 20, see:
# * https://tracker.ceph.com/issues/71269
# * https://github.com/NixOS/nixpkgs/issues/406306
ceph-arrow-cpp ? callPackage ./arrow-cpp-19.nix { },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a stable link we can provide here to check for current compatibility, similar to the comment we have for Python?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +204 to +208
src = fetchurl {
url = "https://download.ceph.com/tarballs/ceph-${version}.tar.gz";
hash = "sha256-zlgp28C81SZbaFJ4yvQk4ZgYz4K/aZqtcISTO8LscSU=";
};

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've run into issues with that pattern before (e.g. the authentik package); since src is used not just in ceph but also ceph-common below, overriding src using overrideAttrs will cause issues since ceph will be built with the new src, but ceph-common won't.
Is there anything we can do to improve this, like making ceph-common somehow reference the finalAttrs.src of ceph (like by making this a function taking a src and version argument and calling the function using the finalAttr values from within ceph)?

I realize this isn't being introduced by this PR (the code just moves up a few lines), so this is kind of out-of-scope for this PR, but I'd like to throw it in here so it's at least somewhere.

Copy link
Contributor Author

@nh2 nh2 Oct 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is a very good point, I'd definitely want my overrideAttrs of Ceph source to also override its Python code!

Could we put the src of the C++ package into the passthru and get it that way for the Python? Edit: Hmm no, the C++ package references the ceph-pyhton-env.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there anything we can do to improve this, like making ceph-common somehow reference the finalAttrs.src of ceph (like by making this a function taking a src and version argument and calling the function using the finalAttr values from within ceph)?

👍🏻 I've wanted the same!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we put the src of the C++ package into the passthru and get it that way for the Python?

Most ways I can think of will just run into infinite recursion.
Is it possible to just add ceph-common and ceph-python-env as attrs of the derivation and change all their references to finalAttrs.{ceph-common,ceph-python-env}?
That would also allow overriding either of them using something like this:

ceph.overrideAttrs ({ ceph-python-env, ... }:
{
  ceph-python-env = ceph-python-env.overrideAttrs
  {
    # I dunno, add some Python packages or something
  };
})

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Completely forgot, of course patches should be inherited too in exactly the same way, otherwise we won't be able to apply patches to the Python parts via overrideAttrs for testing either.

@nh2 nh2 force-pushed the ceph-python3.12 branch from 47815f8 to e73414d Compare October 27, 2025 13:55
@josh
Copy link
Contributor

josh commented Oct 27, 2025

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 455889
Commit: e73414dce1b45db6119eb6c25ab4760734f6e0fe


x86_64-linux

✅ 14 packages built:
  • ceph (ceph-dev)
  • ceph-client (ceph-client.client, ceph-client.dev, ceph-client.doc, ceph-client.lib, ceph-client.man, ceph-dev.client, ceph.client)
  • ceph-csi
  • ceph.dev (ceph-dev.dev)
  • ceph.doc (ceph-dev.doc)
  • libceph (ceph.lib, libceph.client, libceph.dev, libceph.doc, libceph.lib, libceph.man)
  • ceph.man (ceph-dev.man)
  • qemu_full
  • qemu_full.debug
  • qemu_full.doc
  • qemu_full.ga
  • sambaFull (samba4Full)
  • sambaFull.dev (samba4Full.dev)
  • sambaFull.man (samba4Full.man)

aarch64-linux

✅ 10 packages built:
  • ceph (ceph-dev)
  • ceph-client (ceph-client.client, ceph-client.dev, ceph-client.doc, ceph-client.lib, ceph-client.man, ceph-dev.client, ceph.client)
  • ceph-csi
  • ceph.dev (ceph-dev.dev)
  • ceph.doc (ceph-dev.doc)
  • libceph (ceph.lib, libceph.client, libceph.dev, libceph.doc, libceph.lib, libceph.man)
  • ceph.man (ceph-dev.man)
  • qemu_full
  • qemu_full.doc
  • qemu_full.ga

@nixpkgs-ci nixpkgs-ci bot added the 2.status: merge-bot eligible This PR can be merged by commenting "@NixOS/nixpkgs-merge-bot merge". label Nov 5, 2025
Copy link
Contributor

@eclairevoyant eclairevoyant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this becomes imperative again since ceph is broken on master (this time due to some python deps).

@nixpkgs-ci nixpkgs-ci bot added the 12.approvals: 1 This PR was reviewed and approved by one person. label Nov 14, 2025
Comment on lines -242 to -250
# Ceph does not support the following yet:
# * `bcrypt` > 4.0
# * `cryptography` > 40
# See:
# * https://github.com/NixOS/nixpkgs/pull/281858#issuecomment-1899358602
# * Upstream issue: https://tracker.ceph.com/issues/63529
# > Python Sub-Interpreter Model Used by ceph-mgr Incompatible With Python Modules Based on PyO3
# * Moved to issue: https://tracker.ceph.com/issues/64213
# > MGR modules incompatible with later PyO3 versions - PyO3 modules may only be initialized once per interpreter process
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately still seeing the bcrypt issue via ceph-mgr:

ImportError: PyO3 modules do not yet support subinterpreters, see https://github.com/PyO3/pyo3/issues/576

Encountered this when trying to run the ceph-single-node NixOS test via ceph.passthru.tests.ceph-single-node. This test times out due to ceph -s printing health: HEALTH_WARN instead of health: HEALTH_OK (13 mgr modules have failed dependencies).

Full logs: ceph-single-node.log

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can reproduce the same failure.

@eclairevoyant eclairevoyant mentioned this pull request Nov 16, 2025
3 tasks
@dotlambda dotlambda linked an issue Nov 17, 2025 that may be closed by this pull request
3 tasks
@nixpkgs-ci nixpkgs-ci bot added the 2.status: merge conflict This PR has merge conflicts with the target branch label Nov 20, 2025
@nh2
Copy link
Contributor Author

nh2 commented Nov 21, 2025

Side note: I have a WIP branch ceph-20 for when this PR is done:

https://github.com/nh2/nixpkgs/pull/new/ceph-20 (currently at commit 5ba8628)

I won't have time to work on this PR #455889 though unitl beginning of December, so in case anybody wants to already address or test easy-to-address feedback from above, feel free to add some commits!

That builds and passes tests, on commit 68cde06.

When I put the commit 5ba8628 on top of it that switches to Python 3.13, it has in the tests' logs ImportError: PyO3 modules do not yet support subinterpreters, see https://github.com/PyO3/pyo3/issues/576, and tests hang (don't terminate), so I'm removing that from my branch ceph-20.

Edit: The above must be wrong, running it again on these commits, I do get the PyO3 modules do not yet support subinterpreters already on Python 3.12 (without the Python 3.13 usage), and tests hang.

@arachnist
Copy link
Contributor

arachnist commented Nov 26, 2025

This very well might be a PEBKAC, but activating ceph OSDs[2] failed for me[3] when trying to use this PR as an overlay[1].

I suspect this might be caused by python importlib shenanigans, as the code surrounding the failing part is:

10:try:
11:    from importlib.metadata import entry_points
12:
13:    def get_entry_points(group: str):  # type: ignore
14:        return entry_points().get(group, [])  # type: ignore
15:except ImportError:

[1]:

  nixpkgsCeph = pkgs.fetchFromGitHub {
    owner = "nixos";
    repo = "nixpkgs";
    rev = "e73414dce1b45db6119eb6c25ab4760734f6e0fe";
    sha256 = "sha256-38D40MYOuso2QuGePuaQrI7UzAf9vttMEnqA0fiCSqc=";
  };

[ ... ]

      overlays = [
        (self: super: {
          inherit (import nixpkgsCeph { system = "x86_64-linux"; }) ceph;
        })
      ];

[2]: ceph-volume lvm activate --bluestore --no-systemd 15 …

[3]:

exception caught by decorator
Traceback (most recent call last):
  File "/nix/store/01df67x6jgh8cafgv88hbidv2nsv7qbj-ceph-19.2.3/lib/python3.12/site-packages/ceph_volume/decorators.py", line 59, in newfunc
    return f(*a, **kw)
           ^^^^^^^^^^^
  File "/nix/store/01df67x6jgh8cafgv88hbidv2nsv7qbj-ceph-19.2.3/lib/python3.12/site-packages/ceph_volume/main.py", line 118, in main
    self.enable_plugins()
  File "/nix/store/01df67x6jgh8cafgv88hbidv2nsv7qbj-ceph-19.2.3/lib/python3.12/site-packages/ceph_volume/main.py", line 83, in enable_plugins
    plugins = _load_library_extensions()
              ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/01df67x6jgh8cafgv88hbidv2nsv7qbj-ceph-19.2.3/lib/python3.12/site-packages/ceph_volume/main.py", line 188, in _load_library_extensions
    for ep in get_entry_points(group=group):
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/01df67x6jgh8cafgv88hbidv2nsv7qbj-ceph-19.2.3/lib/python3.12/site-packages/ceph_volume/main.py", line 14, in get_entry_points
    return entry_points().get(group, [])  # type: ignore
           ^^^^^^^^^^^^^^^^^^
AttributeError: 'EntryPoints' object has no attribute 'get'
-->  AttributeError: 'EntryPoints' object has no attribute 'get'

edit:
This particular problem can be solved by adding another patch on ceph:

              (pkgs.fetchpatch {
                url = "https://github.com/ceph/ceph/commit/8c78a22d2cf69892570f635735d9735169b64a75.patch";
                hash = "sha256-QnlSGJw0lRdXoLaf58/yXr3ArAut40dSnkA3TFeFJNE=";
              })

but after that we hit problems with ceph-mgr, which we didn't investigate further (rolled back to previous versions):

ceph-mgr[29638]: 2025-11-26T20:41:49.400+0100 7f30e18bf900 -1 mgr[py] Traceback (most recent call last):
ceph-mgr[29638]:   File "/nix/store/fllm5is0r4zh6sl4qapbhf7rklhlla7k-ceph-19.2.3-lib/lib/ceph/mgr/mgr_module.py", line 30, in <module>
ceph-mgr[29638]:     from mgr_util import profile_method
ceph-mgr[29638]:   File "/nix/store/fllm5is0r4zh6sl4qapbhf7rklhlla7k-ceph-19.2.3-lib/lib/ceph/mgr/mgr_util.py", line 6, in <module>
ceph-mgr[29638]:     import bcrypt
ceph-mgr[29638]:   File "/nix/store/p8fvcvb8jv49fv0vigwlvrd4zyhlcal6-python3-3.12.11-env/lib/python3.12/site-packages/bcrypt/__init__.py", line 13, in <module>
ceph-mgr[29638]:     from ._bcrypt import (
ceph-mgr[29638]: ImportError: PyO3 modules do not yet support subinterpreters, see https://github.com/PyO3/pyo3/issues/576
ceph-mgr[29638]: 2025-11-26T20:41:49.401+0100 7f30e18bf900 -1 mgr[py] Class not found in module 'osd_perf_query'
ceph-mgr[29638]: 2025-11-26T20:41:49.401+0100 7f30e18bf900 -1 mgr[py] Error loading module 'osd_perf_query': (22) Invalid argument

@numinit
Copy link
Contributor

numinit commented Nov 29, 2025

I've gone ahead and marked @dotlambda's review comments as resolved because I've implemented them here after rebasing against master: numinit@f6d3953

I'll hold off from force-pushing this branch up to @nh2's tree until I can get the tests passing though.

@arachnist

This particular problem can be solved by adding another patch on ceph: [...] but after that we hit problems with ceph-mgr, which we didn't investigate further (rolled back to previous versions):

My ceph-python3.12 branch is currently here (and this is reproducible by running nix-build -A ceph.tests). I pulled in the latest patch you suggested and that fixed the first issue you mentioned. Trying to figure out the bcrypt issue now.

@numinit
Copy link
Contributor

numinit commented Nov 29, 2025

Which means we're back here:

pyca/cryptography#12080 (comment)

#380823 (comment)

ceph/ceph#62951

@benaryorg

Ideally we could just apply ceph#62951 onto the latest squid release (i.e. adding it as a fetchpatch or such in #455889), although I think we also need ceph#65959 for this to work properly.

Giving this a shot now.

@numinit
Copy link
Contributor

numinit commented Nov 29, 2025

Got patches applying cleanly on numinit@4d74cd2; still debugging a ModuleNotFoundError: No module named 'ceph.cryptotools' error from ceph.tests but this is at least progress.

Edit: Still some errors that cause tests to time out, but it got further with these:

  • ERROR:root:Module 'xmltodict' is not installed.
  • ceph/mgr/cephadm/ssl_cert_utils.py: from cryptography import x509 throws ImportError: PyO3 modules do not yet support subinterpreters, see https://github.com/PyO3/pyo3/issues/576 which breaks cephadm

Wondering if we should use aur-ceph patches or proxmox but proxmox also has a lot of them.

@numinit
Copy link
Contributor

numinit commented Nov 30, 2025

I guess one thing I could try is applying most of the 55 entire patches that Proxmox does. It's for nearly the same version.

My guess is we'll still need a few of our own, and leaving out the Debian-specific ones, but they seemed to address some of the cases that the Arch patch did not.

@nh2
Copy link
Contributor Author

nh2 commented Dec 1, 2025

I guess one thing I could try is applying most of the 55 entire patches that Proxmox does

@numinit Does Proxmox track these patches somewhere instead of just collecting them as .patch files in a folder, e.g. to track upstream status?

It's for nearly the same version.

Note though that I have Ceph 20 already in the pipeline (see #455889 (comment))

@numinit
Copy link
Contributor

numinit commented Dec 1, 2025

@nh2 The patch files look like this:

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: John Mulligan <[email protected]>
Date: Thu, 17 Apr 2025 13:23:09 -0400
Subject: [PATCH] python-common/cryptotools: use one single dir for cryptotools

(Regrettably, the commit hash is zeroed... but my guess is it could be reverse engineered back into the original hashes with enough git digging).

BTW: numinit@0d2b82e

Have to clean up the commit series, but:

/nix/store/sy25b2dc6cv5lgr2q0ab0ns3y1vk2nyn-vm-test-run-basic-multi-node-ceph-cluster
/nix/store/mw178ixr5vp6d6r56494d86nkzs58mw8-vm-test-run-basic-single-node-ceph-cluster
/nix/store/ng7qzf43b7qm7xlw2i9h3haqfb5i2xl6-vm-test-run-basic-single-node-ceph-cluster-bluestore
/nix/store/w3rbrh6whfa7688524b9hanr2hmlx6qj-vm-test-run-basic-single-node-ceph-cluster-bluestore-dmcrypt

😄

@numinit
Copy link
Contributor

numinit commented Dec 1, 2025

Note though that I have Ceph 20 already in the pipeline (see #455889 (comment))

Yeah. I figure this work is just going to be for 25.11 since going to 20 would be breaking.

@dotlambda
Copy link
Member

dotlambda commented Dec 1, 2025

I figure this work is just going to be for 25.11

But ceph was fixed in #462435 (#466339) and #462437.
I don't think moving ceph to Python 3.12 should be backported.

@numinit
Copy link
Contributor

numinit commented Dec 1, 2025

I think this becomes imperative again since ceph is broken on master (this time due to some python deps).

So, guess it's not imperative anymore and we can go to 20?

Edit: the branch with passing tests using Proxmox patches, in case it's useful: https://github.com/numinit/nixpkgs/tree/ceph-python3.12-proxmox

@limwa limwa mentioned this pull request Feb 25, 2026
3 tasks
@nixpkgs-ci nixpkgs-ci bot removed the 2.status: merge-bot eligible This PR can be merged by commenting "@NixOS/nixpkgs-merge-bot merge". label Feb 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2.status: merge conflict This PR has merge conflicts with the target branch 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 11.by: package-maintainer This PR was created by a maintainer of all the package it changes. 12.approvals: 1 This PR was reviewed and approved by one person.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build failure: ceph

10 participants