Repository navigation
NumPy does not install on Python 3.12.0b1 #23808
Copy link
Copy link
Closed
Labels
32 - InstallationProblems installing or compiling NumPyProblems installing or compiling NumPycomponent: build
Description
Describe the issue:
Related:
pypa/pip#11501 (comment)
pypa/setuptools#3935
Reproduce the code example:
pip install numpyError message:
pip install numpy
Collecting numpy
Using cached numpy-1.24.3.tar.gz (10.9 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... error
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [33 lines of output]
Traceback (most recent call last):
File "C:\Users\bers\.pyenv-win-venv\envs\project_3.12\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
main()
File "C:\Users\bers\.pyenv-win-venv\envs\project_3.12\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\bers\.pyenv-win-venv\envs\project_3.12\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 112, in get_requires_for_build_wheel
backend = _build_backend()
^^^^^^^^^^^^^^^^
File "C:\Users\bers\.pyenv-win-venv\envs\project_3.12\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 77, in _build_backend
obj = import_module(mod_path)
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\bers\.pyenv\pyenv-win\versions\3.12.0b1\Lib\importlib\__init__.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1293, in _gcd_import
File "<frozen importlib._bootstrap>", line 1266, in _find_and_load
File "<frozen importlib._bootstrap>", line 1216, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 400, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1293, in _gcd_import
File "<frozen importlib._bootstrap>", line 1266, in _find_and_load
File "<frozen importlib._bootstrap>", line 1237, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 841, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 994, in exec_module
File "<frozen importlib._bootstrap>", line 400, in _call_with_frames_removed
File "C:\Users\bers\AppData\Local\Temp\pip-build-env-8dt1uf4c\overlay\Lib\site-packages\setuptools\__init__.py", line 16, in <module>
import setuptools.version
File "C:\Users\bers\AppData\Local\Temp\pip-build-env-8dt1uf4c\overlay\Lib\site-packages\setuptools\version.py", line 1, in <module>
import pkg_resources
File "C:\Users\bers\AppData\Local\Temp\pip-build-env-8dt1uf4c\overlay\Lib\site-packages\pkg_resources\__init__.py", line 2172, in <module>
register_finder(pkgutil.ImpImporter, find_on_path)
^^^^^^^^^^^^^^^^^^^
AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'?
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.Runtime information:
Cannot install numpy :)
Python 3.12.0b1 on Windows 10 21H2
Context for the issue:
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
32 - InstallationProblems installing or compiling NumPyProblems installing or compiling NumPycomponent: build
Activity
pyproject.toml: Upgrade setuptools for Python 3.12 beta 1
mattip commentedon May 28, 2023
We deliberately pin setuptools to work around other problems with numpy.distutils. The plan for python 3.12 is to move to the meson build system, and to deprecate use of setuptools. You can try out the meson build using python3.12 -m pip install -r build_requirements.txt; python3.12 -m spin build.
pyproject.toml: Upgrade setuptools for Python 3.12 beta 1
bersbersbers commentedon May 28, 2023
Thanks, understood!
I just came across https://numpy.org/devdocs/reference/distutils_status_migration.html, which reads
I agree in principle, but I feel that this approach may deadlock if many other projects depend on numpy :) for example, matplotlib does not install on 3.12.0b1 because it depends on numpy at build time, and then that dependency is carried further to all projects depending on matplotlib.
mattip commentedon May 28, 2023
That advice could use an update, especially before the 1.25 release freezes the documentation. SciPy has migrated to meson-python, and NumPy should migrate soon. Rather than trying to get setuptools to work with python3.12, we should start testing the CPython 3.12b1 with meson.
charris commentedon May 28, 2023
Could you open an issue for that? I am going to release 1.25.0rc1 without it, but there will still be time before the final.
mattip commentedon May 28, 2023
Maybe we should be uploading pre-release wheels to https://anaconda.org/scientific-python-nightly-wheels/numpy. It seems cibuildwheel has a option for this
rgommers commentedon May 29, 2023
I think now that
1.25.xhas branched, we can make the switch to Meson by default inmain. That will makepip install .& co work with Python 3.12 beta's (module any crashes due to incompatibilities between CPython, NumPy and Cython of course - and we know we have one of those right now: gh-23766). WDYT?Re uploading a nightly: let's consider it once NumPy actually passes its test suite with a CPython beta? It seems too early now, we don't even run it in our own CI yet.
mattip commentedon May 29, 2023
We need SIMD testing to work to make the transition.
rgommers commentedon May 29, 2023
That can still be done with
python setup.py install, as is already done inarmv7_simd_test.rgommers commentedon Jun 8, 2023
This is being done in gh-23838 - which is close, but needs working through some CI failures. Until it is merged, one can either use the branch from which I made that PR, or follow the instructions at https://github.com/numpy/numpy/blob/main/building_with_meson.md#pip-install.
Questions about this continue to come in, so I'll pin this issue.
47 remaining items
skirpichev commentedon Sep 8, 2023
Great. But the f2py doesn't work with the new default backend without additional requirements:
@rgommers, maybe it does make sense to add these packages to the list of dependencies? Or to the
project.optional-dependenciessection?rgommers commentedon Sep 8, 2023
Good question @skirpichev. Definitely not a required dependency, but
optional-dependenciesmay make sense. We don't list any of those right now - we also have functionality that depends oncffifor example. I'll open a separate issue for this now, to not mix it with the general Python 3.12 support one here.rgommers commentedon Sep 17, 2023
NumPy 1.26.0 is up on PyPI and conda-forge, so we should be all good here. Thanks all!
FIX: Limit NumPy version [no ci]
CHORE: Run tests on Python 3.12
Revert "Disable tests on Windows due to numpy doesn't install. Ref nu…
Revert "Grab later build of numpy; workaround for numpy/numpy#23808."
Skip Python 3.12 for building wheels because of a problem with
requirements: Fix build on Python 3.12.
Update minimum numpy version for Python 3.12
pypi-zipp: Autospec creation for update from version 3.17.0 to versio…
Add upper boundary on python version for package
increase numpy version to be compatible with Python 3.12
increase numpy version to be compatible with Python 3.12