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

Python 3.13.1-jit : issue when compiling from source #129438

Closed
aldeponk opened this issue Jan 29, 2025 · 8 comments
Closed

Python 3.13.1-jit : issue when compiling from source #129438

aldeponk opened this issue Jan 29, 2025 · 8 comments
Labels
3.13 bugs and security fixes 3.14 new features, bugs and security fixes build The build process and cross-build docs Documentation in the Doc dir easy topic-JIT

Comments

@aldeponk
Copy link

aldeponk commented Jan 29, 2025

Hi all,

I am trying to build python 3.13.1 from source (grabed here https://www.python.org/ftp/python/3.13.1/Python-3.13.1.tgz) on Ubuntu 22.04 instance with configuration so that I disable GIL + get JIT :

./configure --disable-gil --enable-experimental-jit --enable-optimizations --with-lto

Requirements installed according to https://devguide.python.org/getting-started/setup-building/index.html#install-dependencies

The make step fails with error :

gcc -c -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall    -D_Py_TIER2=1 -D_Py_JIT -fno-semantic-interposition -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -std=c11 -Wextra -Wno-unused-parameter
 -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden -fprofile-generate -I./Include/internal -I./Include/internal/mimalloc  -I. -I./Include    -DPy_BUILD_CORE -o Python
/mystrtoul.o Python/mystrtoul.c
Traceback (most recent call last):
  File "/tmp/Python-3.13.1/./Tools/jit/build.py", line 8, in <module>
    import _targets
  File "/tmp/Python-3.13.1/Tools/jit/_targets.py", line 15, in <module>
    import _schema
  File "/tmp/Python-3.13.1/Tools/jit/_schema.py", line 60, in <module>
    class MachORelocation(typing.TypedDict):
  File "/tmp/Python-3.13.1/Tools/jit/_schema.py", line 64, in MachORelocation
    Section: typing.NotRequired[dict[typing.Literal["Value"], str]]
AttributeError: module 'typing' has no attribute 'NotRequired'

I've been looking around, and was not able to find any reference to this kind of issue. What am i doing wrong ?

Thank you so much for any help in reply.

Linked PRs

@Eclips4
Copy link
Member

Eclips4 commented Jan 29, 2025

Hello!
To build JIT from source, Python 3.11+ must be installed on your system. Your Python version seems to be older, as it does not have typing.NotRequired.

@Eclips4 Eclips4 added build The build process and cross-build docs Documentation in the Doc dir 3.13 bugs and security fixes 3.14 new features, bugs and security fixes labels Jan 29, 2025
@Eclips4
Copy link
Member

Eclips4 commented Jan 29, 2025

However, there's no information in the docs that building CPython with JIT requires a Python 3.11+. It would be good to cover it in the docs.

@Eclips4 Eclips4 added the easy label Jan 29, 2025
@Fidget-Spinner
Copy link
Member

Fidget-Spinner commented Jan 29, 2025

Just an FYI also, when you build with GIL disabled the JIT is actually disabled at runtime (at least via the specializing interpreter in 3.13), so there's no point to --enable-experimental-jit with --disable-gil.

@aldeponk
Copy link
Author

This sounds so obvious, feel ashamed I didn't think of it.
I have a go with this, if I succeed in achieving a proper build I'll close the issue.
Thank you so much.

@Eclips4
Copy link
Member

Eclips4 commented Jan 29, 2025

This sounds so obvious, feel ashamed I didn't think of it. I have a go with this, if I succeed in achieving a proper build I'll close the issue. Thank you so much.

Please don't close this issue, even if your problem has been resolved. We should document that building CPython with JIT requires Python 3.11+. So, let's reuse this issue for that 🙂

@aldeponk
Copy link
Author

I came to a stable build !

Note that Ubuntu 22.04 comes with a 3.10 python version.

The sequence I used :

  • installed python 3.13 from deadsnake without changing default python3 version not to break apt/apt-get
  • installed dependancy packages required for the build
  • installed llvm
  • change default python3 version to 3.13.1 (change symlink)
  • build python3.13.1t
  • restore default python3 version to 3.10

I can now experiment 3.13.1t, thank you for your crucial hint

Eclips4 pushed a commit that referenced this issue Jan 30, 2025
…requirements (#129450)

Add a note to the `JIT` docs that building CPython with `JIT` requires Python 3.11 or newer.

Co-authored-by: Brandt Bucher <[email protected]>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jan 30, 2025
…stall requirements (pythonGH-129450)

Add a note to the `JIT` docs that building CPython with `JIT` requires Python 3.11 or newer.

(cherry picked from commit 652f66a)

Co-authored-by: Stan Ulbrych <[email protected]>
Co-authored-by: Brandt Bucher <[email protected]>
Eclips4 pushed a commit that referenced this issue Jan 30, 2025
…nstall requirements (GH-129450) (#129472)

gh-129438: Update ``--enable-experimental-jit`` section with install requirements (GH-129450)

Add a note to the `JIT` docs that building CPython with `JIT` requires Python 3.11 or newer.

(cherry picked from commit 652f66a)

Co-authored-by: Stan Ulbrych <[email protected]>
Co-authored-by: Brandt Bucher <[email protected]>
@Eclips4
Copy link
Member

Eclips4 commented Jan 30, 2025

Doc fix merged & backported; @aldeponk let us know if you have any other problems with building!

@Eclips4 Eclips4 closed this as completed Jan 30, 2025
@aldeponk
Copy link
Author

By now everything is ok, I can run built 3.13t version for tests.
Thank you all !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.13 bugs and security fixes 3.14 new features, bugs and security fixes build The build process and cross-build docs Documentation in the Doc dir easy topic-JIT
Projects
Status: Todo
Development

No branches or pull requests

3 participants