QCQMC Hamiltonian test fails in NumPy 2 due to difference in PySCF output on MacOS arm64
There is a NumPy 2 vs NumPy 1 difference involving PySCF in recirq/qcqmc, specifically line 115 in hamiltonian_test.py where a value generated by using PySCF's SCF package is compared to a value stored in a file. With NumPy 1, the test succeeds; with NumPy 2, it fails because the SCF method returns a number that differs from the expected value in the 3rd decimal place. It fails on MacOS 15 (on arm64) but not on Linux (Debian Linux on x86_64). It is only test that fails.
The RHF method in PySCF takes a number of arguments to control the Newton method it uses. I've tried changing the tolerances and max cycles and other values all over the place, but very few have any effect, and the one change that did have an effect caused the output to diverge from the desired value even more. Searching the PySCF GitHub issues doesn't turn up complains about similar failures. PySCF has supported NumPy 2 for some time, so by now, you would think obvious problems would have been shaken out (although it's not guaranteed).
References used while investigating this:
- https://github.com/pyscf/pyscf/blob/265bb15f7f507335397b43ac92bbc95c3bc9524b/pyscf/soscf/newton_ah.py
- https://pyscf.org/pyscf_api_docs/pyscf.scf.html#pyscf.scf.RHF
- https://github.com/pyscf/pyscf/blob/265bb15f7f507335397b43ac92bbc95c3bc9524b/doc_legacy/source/overview.rst#L81
👋🏻 @fdmalone you had mentioned wanting to take this on. Would it be possible for you to give a status update?
Haven't looked at it, seems like p2 given it only affects apple and is more likely than not a pyscf issue
I'll unassign you, and mark this as a "help wanted" issue.