qiskit-community / qiskit-machine-learning

Quantum Machine Learning
https://qiskit-community.github.io/qiskit-machine-learning/
Apache License 2.0
693 stars 328 forks source link

Restore latest dependencies in CI environment #816

Closed edoaltamura closed 3 months ago

edoaltamura commented 4 months ago

Summary

Restores the latest dependencies for Numpy and PyTorch.

Closes https://github.com/qiskit-community/qiskit-machine-learning/issues/815 Closes https://github.com/qiskit-community/qiskit-machine-learning/issues/797 Closes https://github.com/qiskit-community/qiskit-machine-learning/issues/812

Updates the GitHub Actions workflow to skip the mypy job when testing on the Windows platform. The mypy type checker is known to have an issue with PyTorch UTF-8 and skipping this step temporarily will streamline the CI process.

woodsp-ibm commented 4 months ago

Seems it skipped the mypy checks as was wanted but now hits errors in unit test.

edoaltamura commented 4 months ago

It only appears with Windows and only with Py3.12. @OkuyanBoga suggested it could be connected to outstanding compatibility issues between Numpy 2.0 and qiskit_aer_gpu or torch_gpu. Unfortunately, I could not find anything on this topic online, and a quick local debugging didn't give useful information either. Do you have any suggestions?

woodsp-ibm commented 4 months ago

I see there was some recent activity linked to this issue https://github.com/pytorch/pytorch/issues/78341 Locally I see that 3.8 still uses the older numpy with the latest torch and that passes ok. Does it work under 3.12 with that version of numpy, is that something you can try locally, i.e. 1.26.4 - if so we could temporarily pin it to that for windows.

edoaltamura commented 4 months ago

I found that

woodsp-ibm commented 4 months ago

Numpy 2.x passes on Python 3.9-12, but not 3.8

There is no 3.8 distribution of Numpy 2.0 as that version is no longer supported. 3.8 EOL is end Oct this year at which point Qiskit will no longer support it so support for that would expected to be dropped here too. What do you mean passes for 3.12 - isn't it failing here in CI for 3.12 where its using numpy 2.0 (have no idea for 3.9 thru 3.11 as we only test min/max supported versions).

Numpy 1.26.4 passes on Python 3.8-11, but not 3.12 (in general)

What does not in general here mean. CI is failing around the numpy() call in those detach statements for 3.12 where its also using numpy 2.0. Does general mean something else or the same thing? If the CI failure is not related to numpy what is it - other versions of some other libraries somehow interfering. The newest torch is working in 3.8 with 1.26.4 in CI and you indicate its working up to 3.11 so does some library or something change for 3.12? The torch issue I linked above seemed to have recent activity linked, i.e. after the latest release.

coveralls commented 4 months ago

Pull Request Test Coverage Report for Build 10145581774

Details


Totals Coverage Status
Change from base Build 9465953664: 0.0%
Covered Lines: 2018
Relevant Lines: 2170

💛 - Coveralls
edoaltamura commented 4 months ago

Restricting numpy<2.0 in constraints.txt seems to have produced a suitable set of dependencies for all the tests.

edoaltamura commented 4 months ago

Also closes https://github.com/qiskit-community/qiskit-machine-learning/issues/812.

Issue https://github.com/qiskit-community/qiskit-machine-learning/issues/818 was created as a reminder to revert the changes in this PR.