Skip to content

Numpy 2.3.0+ requires np.frombuffer instead of np.frombytes for binary data#21419

Open
onitake wants to merge 1 commit intoUltimaker:mainfrom
onitake:fix/numpy-frombuffer
Open

Numpy 2.3.0+ requires np.frombuffer instead of np.frombytes for binary data#21419
onitake wants to merge 1 commit intoUltimaker:mainfrom
onitake:fix/numpy-frombuffer

Conversation

@onitake
Copy link
Copy Markdown
Contributor

@onitake onitake commented Feb 21, 2026

Description

This PR replaces usage of np.fromstring with np.frombuffer, when the handling binary data.
Numpy 2.3.0 no longer supports the deprecated binary mode of np.fromstring, which would cause Cura to crash otherwise.

Fixes: #21418
See there for details.

Similar changes are required in Uranium, see Ultimaker/Uranium#1028 for a patch.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Printer definition file(s)
  • Translations

How Has This Been Tested?

The patches have been tested against an older Cura version (5.0.0), with a system-installed numpy 2.4.0, as packaged in Debian sid. The affected Cura source code has not changed significantly since then, so the patches are more or less identical.

Patches used for the Debian version:
https://salsa.debian.org/3dprinting-team/uranium/-/blob/master/debian/patches/1001-numpy-tostring-deprecation.patch?ref_type=heads
https://salsa.debian.org/3dprinting-team/cura/-/blob/master/debian/patches/1012-numpy-fromstring-deprecation.patch?ref_type=heads

Tests done:

  • Start Cura
  • Load a 3MF file (data only)
  • Slice
  • Show preview

Test Configuration:

  • Operating System: Debian Linux sid

Checklist:

@github-actions github-actions bot added the PR: Community Contribution 👑 Community Contribution PR's label Feb 21, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Test Results

24 592 tests  ±0   24 590 ✅ ±0   52s ⏱️ +2s
     1 suites ±0        2 💤 ±0 
     1 files   ±0        0 ❌ ±0 

Results for commit 7adc157. ± Comparison against base commit 2e1a12c.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: Community Contribution 👑 Community Contribution PR's

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use of deprecated fromstring binary mode crashes with numpy 2.3.0+

1 participant