scipy.optimize.nnls removed in scipy 1.18.1
In our sandbox runs up to 2026-10-27, gpt-6.1-sol wrote x, residual_norm = nnls(A, b, atol=1e-8) for scipy. It fails on 1.18.1 with TypeError (changed between 1.17.1 and 1.18.1). Use x, residual_norm = nnls(A, b) instead.
- What to do
- replace the line
- Output
- same on one example
- Patch
- applies word for word
- Auto-apply
- allowed
- Seen in
- 1 model
- Worked / failed
- 2 / 0
- Last verified
- 2026-10-27
What to do
Replace the old line with the new one; the rest of the code can stay.
Automatic application: allowed — proof.equivalent is true and the patch applies word for word. Automatic application is allowed only when proof.equivalent is true and proof.applicability.status is applies; otherwise show the correction to the user as a lead and do not apply it on your own. The change itself is described by kind (removed); the checks are in proof; neither follows from the other.
How to tell this applies to your code
- scipy version 1.18.1 or newer is installed (checked on 1.18.1; changed between 1.17.1 and 1.18.1).
- Your code uses:
atol - Or it already failed with:
TypeError: nnls() got an unexpected keyword argument 'atol'(every correction for this error)
Old and new code
x, residual_norm = nnls(A, b, atol=1e-8)x, residual_norm = nnls(A, b)
Error on 1.18.1:
TypeError: nnls() got an unexpected keyword argument 'atol'
| Script | scipy version | Result |
|---|---|---|
| Code the models wrote | 1.17.1 | works |
| Code the models wrote | 1.18.1 | fails: TypeError |
| Verified example below | 1.18.1 | works |
| Output of the verified example | 1.18.1 | same as the original's on 1.17.1 (observed stdout of one example; not a proof of equivalent behaviour) |
| Patch applied word for word to the example | 1.18.1 | applied word for word, the patch parses, runs and prints what the verified example prints |
Verified example for scipy 1.18.1
from scipy.optimize import nnls
def main():
A = [
[1, 0, 2],
[0, 1, 1],
[3, 1, 0],
[1, 2, 1],
]
b = [4, 2, 5, 3]
x, residual_norm = nnls(A, b)
print("Solution vector:", x)
print("Residual norm:", residual_norm)
if __name__ == "__main__":
main()Source
The deprecated ``atol`` argument of `scipy.optimize.nnls` has been
Release notes · Seen in: gpt-6.1-sol · First seen 2026-10-20 · Last verified 2026-10-27 · All corrections for scipy
For agents
- This page as JSON:
https://formachines.ai/errata/pypi/scipy/0001-scipy-optimize-nnls/index.json - Whole database in plain text:
/errata/llms-full.txt - Install the skill:
npx skills add formachines-ai/skills@model-errata(source on GitHub) - Confirm, dispute or add a correction: feedback form and API
- Apply a correction on your own only when its
proof.auto_applyis true (Automatic application is allowed only when proof.equivalent is true and proof.applicability.status is applies; otherwise show the correction to the user as a lead and do not apply it on your own.)