-
Notifications
You must be signed in to change notification settings - Fork 26.5k
Initial Python 3.12 build fixes #106083
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
Initial Python 3.12 build fixes #106083
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/106083
Note: Links to docs will display an error until the docs builds have been completed. ✅ You can merge normally! (1 Unrelated Failure)As of commit 9a50db8 with merge base 79b3a9f ( UNSTABLE - The following job failed but was likely due to flakiness present on trunk and has been marked as unstable:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Same treatment as many other objects such as https://github.com/pytorch/pytorch/blob/main/torch/csrc/autograd/python_hook.cpp#L99 This one can outlive the python runtime due to structs like: https://github.com/pytorch/pytorch/blob/2f35715f0d230f8d5527bdf01b9793f6613f3a2e/torch/csrc/autograd/python_cpp_function.cpp#L232 With the pybind patch and this one, the 3.12 build at #106083 stops segfaulting and runs test_autograd.py just fine. Pull Request resolved: #106334 Approved by: https://github.com/ezyang
| jinja2 | ||
| fsspec | ||
| # setuptools was removed from default python install | ||
| setuptools ; python_version >= "3.12" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we going to get people to stop using setup.py directly 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we have a good alternative at the moment. The setuptools package doesn't seem to be going anywhere anytime soon: https://pypi.org/project/setuptools/
|
this is clearly not ready, how would you like to proceed with review? |
|
Actually I would argue this is ready for review. |
| #if PY_VERSION_HEX >= 0x030C0000 // 3.12 | ||
| #error "Please ensure that the functions below still match the CPython implementation for 3.12" | ||
| // Spoiler alert: They don't! This will be done in a follow up. | ||
| // #error "Please ensure that the functions below still match the CPython implementation for 3.12" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you planning to do this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am planning on doing some of the C++ cleanup to build a case to share with the CPython team yes.
I am not planning on making Dynamo fully work though. There will need to be some staffing from the Dynamo side to fix this (like we did for 3.11).
| #if IS_PYTHON_3_12_PLUS | ||
| // Most of these don't exist in 3.12 anymore. | ||
| // _PyFunction_CopyWithNewCode and _PyFrame_InitializeSpecials in particular | ||
| PyFunctionObject* func; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems bad. At minimum you should error in this branch right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can make that an error yes.
ezyang
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure I guess
|
@pytorchbot merge |
Merge failedReason: This PR needs a If not, please add the To add a label, you can comment to pytorchbot, for example For more information, see Details for Dev Infra teamRaised by workflow job |
|
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
This compiles with python 3.12 You can get numpy from https://anaconda.org/scientific-python-nightly-wheels/numpy/files so that you don't need to remove numpy from test files. Basic core tests work but obviously dynamo and first class dims don't work. Pull Request resolved: #106083 Approved by: https://github.com/ezyang
This compiles with python 3.12
You can get numpy from https://anaconda.org/scientific-python-nightly-wheels/numpy/files so that you don't need to remove numpy from test files.
Basic core tests work but obviously dynamo and first class dims don't work.
cc @voznesenskym @penguinwu @anijain2305 @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @Xia-Weiwen @wenzhe-nrv @jiayisunx @ipiszy @chenyang78 @aakhundov