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

adding py312 support #6

Merged
merged 4 commits into from
Jan 17, 2024
Merged

adding py312 support #6

merged 4 commits into from
Jan 17, 2024

Conversation

esc
Copy link
Member

@esc esc commented Aug 23, 2023

As title

@esc
Copy link
Member Author

esc commented Aug 23, 2023

Having trouble compiling NumPy 1.25 from source:

 > [5/5] RUN python3.12 -m pip install numpy:
#8 14.50 Collecting numpy
#8 14.97   Downloading numpy-1.25.2.tar.gz (10.8 MB)
#8 19.76      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 10.8/10.8 MB 2.4 MB/s eta 0:00:00
#8 25.14   Installing build dependencies: started
#8 46.92   Installing build dependencies: finished with status 'done'
#8 46.95   Getting requirements to build wheel: started
#8 47.93   Getting requirements to build wheel: finished with status 'error'
#8 47.99   error: subprocess-exited-with-error
#8 47.99
#8 47.99   × Getting requirements to build wheel did not run successfully.
#8 47.99   │ exit code: 1
#8 47.99   ╰─> [33 lines of output]
#8 47.99       Traceback (most recent call last):
#8 47.99         File "/usr/local/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
#8 47.99           main()
#8 47.99         File "/usr/local/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
#8 47.99           json_out['return_val'] = hook(**hook_input['kwargs'])
#8 47.99                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#8 47.99         File "/usr/local/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 112, in get_requires_for_build_wheel
#8 47.99           backend = _build_backend()
#8 47.99                     ^^^^^^^^^^^^^^^^
#8 47.99         File "/usr/local/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 77, in _build_backend
#8 47.99           obj = import_module(mod_path)
#8 47.99                 ^^^^^^^^^^^^^^^^^^^^^^^
#8 47.99         File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module
#8 47.99           return _bootstrap._gcd_import(name[level:], package, level)
#8 47.99                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#8 47.99         File "<frozen importlib._bootstrap>", line 1293, in _gcd_import
#8 47.99         File "<frozen importlib._bootstrap>", line 1266, in _find_and_load
#8 47.99         File "<frozen importlib._bootstrap>", line 1216, in _find_and_load_unlocked
#8 47.99         File "<frozen importlib._bootstrap>", line 400, in _call_with_frames_removed
#8 47.99         File "<frozen importlib._bootstrap>", line 1293, in _gcd_import
#8 47.99         File "<frozen importlib._bootstrap>", line 1266, in _find_and_load
#8 47.99         File "<frozen importlib._bootstrap>", line 1237, in _find_and_load_unlocked
#8 47.99         File "<frozen importlib._bootstrap>", line 841, in _load_unlocked
#8 47.99         File "<frozen importlib._bootstrap_external>", line 994, in exec_module
#8 47.99         File "<frozen importlib._bootstrap>", line 400, in _call_with_frames_removed
#8 47.99         File "/tmp/pip-build-env-oaxrhrbq/overlay/lib/python3.12/site-packages/setuptools/__init__.py", line 16, in <module>
#8 47.99           import setuptools.version
#8 47.99         File "/tmp/pip-build-env-oaxrhrbq/overlay/lib/python3.12/site-packages/setuptools/version.py", line 1, in <module>
#8 47.99           import pkg_resources
#8 47.99         File "/tmp/pip-build-env-oaxrhrbq/overlay/lib/python3.12/site-packages/pkg_resources/__init__.py", line 2172, in <module>
#8 47.99           register_finder(pkgutil.ImpImporter, find_on_path)
#8 47.99                           ^^^^^^^^^^^^^^^^^^^
#8 47.99       AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'?
#8 47.99       [end of output]
#8 47.99
#8 47.99   note: This error originates from a subprocess, and is likely not a problem with pip.
#8 48.00 error: subprocess-exited-with-error
#8 48.00
#8 48.00 × Getting requirements to build wheel did not run successfully.
#8 48.00 │ exit code: 1
#8 48.00 ╰─> See above for output.
#8 48.00
#8 48.00 note: This error originates from a subprocess, and is likely not a problem with pip.

@esc
Copy link
Member Author

esc commented Aug 23, 2023

Using --pre to install a NumPy pre-release works and NumPy can be installed/compiled.

@esc
Copy link
Member Author

esc commented Aug 23, 2023

llvmlite compiles fine and tests pass with 3.12 -- would say it's probably ready. Numba has a version guard for 3.12.

@esc
Copy link
Member Author

esc commented Aug 23, 2023

with 6ac0c37 I can run a complete build from a pristine state:

mkdir hatch && cd hatch && git clone git@github.com:esc/numba-hatchery.git -b py312 . && make update && make build && make clone && make compile

Gets:

gcc -pthread -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall -fPIC -I/usr/local/lib/python3.12/site-packages/numpy/core/include -I/usr/local/include/python3.12 -c numba/_dispatcher.cpp -o build/temp.linux-x86_64-cpython-312/numba/_dispatcher.o -std=c++11
numba/_dispatcher.cpp: In function ‘int call_trace(Py_tracefunc, PyObject*, PyThreadState*, PyFrameObject*, int, PyObject*)’:
numba/_dispatcher.cpp:53:28: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘tracing_what’
   53 |     int old_what = tstate->tracing_what;
      |                            ^~~~~~~~~~~~
numba/_dispatcher.cpp:54:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘tracing_what’
   54 |     tstate->tracing_what = what;
      |             ^~~~~~~~~~~~
numba/_dispatcher.cpp:58:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘tracing_what’
   58 |     tstate->tracing_what = old_what;
      |             ^~~~~~~~~~~~
numba/_dispatcher.cpp: In function ‘PyObject* call_cfunc(Dispatcher*, PyObject*, PyObject*, PyObject*, PyObject*)’:
numba/_dispatcher.cpp:658:25: error: ‘_PyCFrame’ {aka ‘struct _PyCFrame’} has no member named ‘use_tracing’
  658 |     if (tstate->cframe->use_tracing && tstate->c_profilefunc)
      |                         ^~~~~~~~~~~
In file included from /usr/local/include/python3.12/Python.h:78,
                 from numba/_pymodule.h:6,
                 from numba/_dispatcher.cpp:1:
/usr/local/include/python3.12/pystate.h:63:46: warning: control reaches end of non-void function [-Wreturn-type]
   63 | #define PyThreadState_GET() PyThreadState_Get()
      |                             ~~~~~~~~~~~~~~~~~^~
numba/_dispatcher.cpp:650:14: note: in expansion of macro ‘PyThreadState_GET’
  650 |     tstate = PyThreadState_GET();
      |              ^~~~~~~~~~~~~~~~~
error: command '/usr/bin/gcc' failed with exit code 1
+ cd ..
+ exec bash

llvmlite doesn't have an upper bound for 3.12 -- so yay! Numba needs: https://github.com/esc/numba/tree/update_py_pin_to_3.12 (the conf files take this into account)

@esc
Copy link
Member Author

esc commented Aug 23, 2023

Note: once cloned, you can update just the compilation from within the hatch directory using: make clone && make compile

This was referenced Sep 14, 2023
@esc esc merged commit 6ac0c37 into numba:main Jan 17, 2024
@esc esc deleted the py312 branch January 17, 2024 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant