Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Python 3.13 #1484

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open

Support Python 3.13 #1484

wants to merge 14 commits into from

Conversation

alecandido
Copy link
Member

@alecandido alecandido commented Oct 10, 2024

Since py3.13 has been finally published (on Monday), I tried out of curiosity whether it was possible to upgrade our version constraint to use that.

We do not directly rely on Python internals, and py3.x versions are backward compatible (in principle). So, there is no reason for Qibo not to support it, for as long as our dependencies support that.

So, it was just a matter of running poetry lock, and... it seems working.

Now, we still need to solve the Qibojit problem (that in the meanwhile became also a Qibotn one, and soon Qiboml as well).

I expected this to be blocked by TensorFlow once again. And it should, since they are not distributing wheels for py3.13 yet (and they apparently won't before next year tensorflow/tensorflow#62003 (comment)), but apparently they didn't care declaring it
https://github.com/tensorflow/tensorflow/blob/a2fadc33162b16989eb10a541d112e6b9fffa0e1/tensorflow/tools/pip_package/setup.py#L412
and Poetry is not examining the wheel compatibility, so we already got a valid lockfile anyhow.

While going through Qibojit and the rest of it (following the much beloved procedure in #1231 (comment)) further problems may arise. But, at this point, I will have a try soon, also to track the present blockers.

@alecandido
Copy link
Member Author

The CI is of course failing, since I had to disable qibojit and qibotn to lock. Re-enabling them is the missing part to complete this PR.

@cosenal
Copy link

cosenal commented Jan 7, 2025

Ciao @alecandido, any update on this? Qibo is one dependency that is blocking Mitiq to support Python 3.13.

@alecandido
Copy link
Member Author

@cosenal thanks for reaching about this, we're now in a better situation than last time (i.e. #1231), but still not optimal. Let me explain.

Before Qibo was locked behind TensorFlow, which was still the case in October, when I opened this PR.
While NumPy and some other packages have now synced their release cycle with Python's one (which I guess was the main reason for Python itself to establish a well-predictable schedule), so they are already upgrading compatibility based on beta releases, making them ready by October. However, TensorFlow is much slower (certainly not the only major one, but essentially the only one among Qibo's dependencies).

What happened in the last few months is the final migration of the differentiable computation support of Qibo to Qiboml https://github.com/qiboteam/qiboml.
This makes Qibo (almost) independent of TensorFlow, thus I was able to lock.

Unfortunately, we're still in a situation in which part of the backends are tested in Qibo's CI, thus we should still follow the update procedure outlined in #1231 (comment)
We already had plans to solve this situation, by either deeply reworking the Qibo internals layout (https://github.com/qiboteam/qibo-core) or moving/duplicating part of the tests. But it hasn't happened yet...

Thus, the current issue is that Qiboml will be needed to test the TensorFlow backend in the Qibo CI, right now failing for its absence (actually, first encountering Qibojit's absence, but that can be solved with the above procedure). If the dependency were reinstated, then it would fail because of Qiboml not supporting Python 3.13 - eventually coming back to TensorFlow once more.

So, the original issue is not completely solved, but we're now much closer, since we only have to choose how to handle the test issue, introducing the dependency, and then TensorFlow would be out of the main loop (unless Mitiq explicitly targets the TensorFlow backend - at which point Qibo can't solve the issue, until TensorFlow itself will).

@scarrazza

@scarrazza scarrazza added this to the Qibo 0.2.16 milestone Jan 20, 2025
@glpatcern glpatcern mentioned this pull request Feb 3, 2025
@scarrazza scarrazza modified the milestones: Qibo 0.2.16, Qibo 0.2.17 Feb 12, 2025
@alecandido alecandido force-pushed the py3.13 branch 4 times, most recently from 328f5e9 to 6bf8f3e Compare March 6, 2025 12:20
Copy link

codecov bot commented Mar 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.06%. Comparing base (00a3961) to head (357b6c7).

Additional details and impacted files
@@            Coverage Diff             @@
##           numpy_2.0    #1484   +/-   ##
==========================================
  Coverage      99.06%   99.06%           
==========================================
  Files             76       76           
  Lines          11322    11322           
==========================================
  Hits           11216    11216           
  Misses           106      106           
Flag Coverage Δ
unittests 99.06% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@alecandido alecandido marked this pull request as ready for review March 6, 2025 12:44
@alecandido alecandido requested review from renatomello and removed request for scarrazza March 7, 2025 14:46
Copy link
Contributor

@renatomello renatomello left a comment

Choose a reason for hiding this comment

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

@alecandido maybe it is worth adding a no cover tag to the _sgd_tf function

@alecandido
Copy link
Member Author

@alecandido maybe it is worth adding a no cover tag to the _sgd_tf function

To be fair, having a no cover or coverage below 100% is quite equivalent, from my point of view.
So, it is definitely fine to introduce the no cover, but I'm not inclined doing it myself :P

@renatomello renatomello linked an issue Mar 10, 2025 that may be closed by this pull request
@renatomello renatomello added the enhancement New feature or request label Mar 10, 2025
@alecandido alecandido changed the base branch from master to numpy_2.0 March 10, 2025 19:22
@alecandido alecandido force-pushed the py3.13 branch 2 times, most recently from f97cd69 to 0cabce6 Compare March 10, 2025 19:42
@alecandido alecandido mentioned this pull request Mar 10, 2025
4 tasks
@alecandido alecandido force-pushed the py3.13 branch 2 times, most recently from 9343131 to dd83da0 Compare March 10, 2025 20:17
@alecandido alecandido force-pushed the py3.13 branch 3 times, most recently from d8085d5 to d90bdd5 Compare March 10, 2025 20:38
Base automatically changed from numpy_2.0 to master March 11, 2025 08:05
@alecandido alecandido requested a review from scarrazza March 11, 2025 15:26
@alecandido
Copy link
Member Author

To any willing reviewer: most of the comments written above have already been applied in #1582 (Cirq, Qiboml, Qibotn, ...), thus they are already in https://github.com/qiboteam/qibo/tree/master.

This PR is now just updating the dependencies and workflows (and fixing very few linters complaints).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants