Repository navigation
Open
Labels
32 - InstallationProblems installing or compiling NumPy
Description
Steps to reproduce:
- Use the public.ecr.aws/lambda/python:3.11 Docker base image.
- In a Dockerfile, copy in a requirements.txt containing numpy
- Run
pip install -r requirements.txt. - Observe that pip falls back to building NumPy 2.3.0 from source and fails due to missing C compiler.
Error message:
#7 2.842 Downloading numpy-2.3.0.tar.gz (20.4 MB)
#7 2.990 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 20.4/20.4 MB 132.5 MB/s eta 0:00:00
#7 5.039 Installing build dependencies: started
#7 7.540 Installing build dependencies: finished with status 'done'
#7 7.540 Getting requirements to build wheel: started
#7 7.639 Getting requirements to build wheel: finished with status 'done'
#7 7.644 Installing backend dependencies: started
#7 8.255 Installing backend dependencies: finished with status 'done'
#7 8.256 Preparing metadata (pyproject.toml): started
#7 9.146 Preparing metadata (pyproject.toml): finished with status 'error'
#7 9.151 error: subprocess-exited-with-error
#7 9.151
#7 9.151 × Preparing metadata (pyproject.toml) did not run successfully.
#7 9.151 │ exit code: 1
#7 9.151 ╰─> [20 lines of output]
#7 9.151 + /var/lang/bin/python3.11 /tmp/pip-install-pv61bimt/numpy_a2374ad6e38d46daba33ed2d9893ca9c/vendored-meson/meson/meson.py setup /tmp/pip-install-pv61bimt/numpy_a2374ad6e38d46daba33ed2d9893ca9c /tmp/pip-install-pv61bimt/numpy_a2374ad6e38d46daba33ed2d9893ca9c/.mesonpy-rw0po2ou -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md --native-file=/tmp/pip-install-pv61bimt/numpy_a2374ad6e38d46daba33ed2d9893ca9c/.mesonpy-rw0po2ou/meson-python-native-file.ini
#7 9.151 The Meson build system
#7 9.151 Version: 1.6.1
#7 9.151 Source dir: /tmp/pip-install-pv61bimt/numpy_a2374ad6e38d46daba33ed2d9893ca9c
#7 9.151 Build dir: /tmp/pip-install-pv61bimt/numpy_a2374ad6e38d46daba33ed2d9893ca9c/.mesonpy-rw0po2ou
#7 9.151 Build type: native build
#7 9.151 Project name: NumPy
#7 9.151 Project version: 2.3.0
#7 9.151
#7 9.151 ../meson.build:1:0: ERROR: Unknown compiler(s): [['cc'], ['gcc'], ['clang'], ['nvc'], ['pgcc'], ['icc'], ['icx']]
#7 9.151 The following exception(s) were encountered:
#7 9.151 Running `cc --version` gave "[Errno 2] No such file or directory: 'cc'"
#7 9.151 Running `gcc --version` gave "[Errno 2] No such file or directory: 'gcc'"
#7 9.151 Running `clang --version` gave "[Errno 2] No such file or directory: 'clang'"
#7 9.151 Running `nvc --version` gave "[Errno 2] No such file or directory: 'nvc'"
#7 9.151 Running `pgcc --version` gave "[Errno 2] No such file or directory: 'pgcc'"
#7 9.151 Running `icc --version` gave "[Errno 2] No such file or directory: 'icc'"
#7 9.151 Running `icx --version` gave "[Errno 2] No such file or directory: 'icx'"
#7 9.151
#7 9.151 A full log can be found at /tmp/pip-install-pv61bimt/numpy_a2374ad6e38d46daba33ed2d9893ca9c/.mesonpy-rw0po2ou/meson-logs/meson-log.txt
#7 9.151 [end of output]
#7 9.151
#7 9.151 note: This error originates from a subprocess, and is likely not a problem with pip.
#7 9.153 error: metadata-generation-failed
#7 9.153
#7 9.153 × Encountered error while generating package metadata.
#7 9.153 ╰─> See above for output.
#7 9.153
#7 9.153 note: This is an issue with the package mentioned above, not pip.
#7 9.153 hint: See above for details.
#7 9.162
#7 9.162 [notice] A new release of pip is available: 24.0 -> 25.1.1
#7 9.162 [notice] To update, run: pip install --upgrade pip
#7 ERROR: process "/bin/sh -c pip install -r requirements.txt" did not complete successfully: exit code: 1
------
> [3/5] RUN pip install -r requirements.txt:
9.153 error: metadata-generation-failed
9.153
9.153 × Encountered error while generating package metadata.
9.153 ╰─> See above for output.
9.153
9.153 note: This is an issue with the package mentioned above, not pip.
9.153 hint: See above for details.Additional information:
No response
Reacted by James Cook, cedricfarinazzo, John Larkin, MCTrustPower, Mike Altonji, DanielClimaco, TCarricoDTT, Michael Lavrisha, Andrew Ware, Andrew Stahlman and 10 more
Metadata
Metadata
Assignees
Labels
32 - InstallationProblems installing or compiling NumPy
Activity
pangolinkeys commentedon Jun 9, 2025
We've also started experiencing this issue this morning.
Our build step uses
public.ecr.aws/sam/build-python3.11:latest-x86_64to install dependencies so we do have a GCC compiler but the wrong version.Edit: We are just going to pin 2.2.6 for now
mattip commentedon Jun 9, 2025
We provide wheels for manylinux_2_28. Perhaps you are using an older amazon linux2 image, which does not support manylinux_2_28?
cedricfarinazzo commentedon Jun 9, 2025
I had the same error with the image
public.ecr.aws/lambda/python:3.11andnumpy==2.3.0.I temporarily fixed it by installing GCC 10:
Now
numpy==2.3.0installs correctly, but the build takes 10 minutes because it compiles NumPy from source.When using
numpy==2.2.6, the wheel filename isnumpy-2.2.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whlThe job building wheel for
manylinux_2_17_x86_64: https://github.com/numpy/numpy/actions/runs/15086533833/job/42411405542On
numpy==2.3.0, i can only see build job formanylinux_2_28wheels.So I think
manylinux_2_17wheel is missing fornumpy==2.3.0and must be kept for retrocompatibility.andyfaff commentedon Jun 9, 2025
The 2_17 target is end of life. To use a pre built wheel you either need to use an older numpy version, or use newer Linux image to get the newest version.
Alternatively you can build from source. Since the image is EOL we won't be making a 2_17 wheel again.
A rough guide is https://github.com/mayeut/pep600_compliance/blob/master/EOL.rst, https://github.com/pypa/manylinux
mattip commentedon Jun 9, 2025
Unfortunately the EOL date for amazon linux 2 was delayed to June 2026. This puts it in a difficult position since it is based on glibc 2.26, which means users of this platform will not be able to install latest versions of many scientific python packages, including NumPy and pytorch.
Do we have any knowledge of when aws will update its base images off amazon linux 2?
piscoTech commentedon Jun 11, 2025
Hi,
In Verizon we are having the same issue and have found a similar problem reported aws/aws-lambda-builders#700 and after investigation we opened aws/aws-lambda-builders#752 to correct the supported glibc.
While this does not address the original problem on Python 3.11, it does on Python 3.12 and 3.13 which run on AL 2023 since there glibc 2.34 is available.
[-]Provide manylinux wheels for NumPy 2.3.0 on CPython 3.11 / AWS Lambda base image[/-][+]Provide manylinux wheels for NumPy 2.3.0 on CPython 3.11 / AWS amazon linux 2 lambda image[/+][-]Provide manylinux wheels for NumPy 2.3.0 on CPython 3.11 / AWS amazon linux 2 lambda image[/-][+]No wheels for NumPy 2.3.0 on amazon linux 2 AWS lambda image[/+]mattip commentedon Jul 22, 2025
Digging around in the aws lambda runtime specs, I see that the python3.11 image is based on Amazon Linux 2, where the python3.12 and up images are based on Amazon Linux 2023. So to use numpy2.3.0 and later, we require using the python3.12 or later aws lambda images. Note we will be dropping support for python3.11 for the next numpy release (as we move to supporting the upcoming release of python 3.14), so this issue is relevant only for NumPy 2.3.x.
dyaskur commentedon Jul 29, 2025
What
--platformvalue should I use with pip install to install NumPy 2.3.x for use in an AWS Lambda layer?Previously, I was able to install NumPy using manylinux2014_x86_64 with this command:
However, when I changed to numpy==2.3.1, it fails because the latest available NumPy version for manylinux2014_x86_64 is 2.2.6.
I also tried using
--platform manylinux_2_28_x86_64,but couldn’t find any available version of NumPy under that platform either.Is there a compatible platform tag for installing NumPy 2.3.x that works with AWS Lambda's Amazon Linux 2023 runtime (or similar), or is it currently unsupported?update
numpy in manylinux_2_28_x86_64 is works, but pandas not works. Pandas only support manylinux2014_x86_64 yet.
dyaskur commentedon Jul 29, 2025
By the way, I tested AWS Lambda with Python 3.13 by running the following code:
The output returned:
This suggests that AWS Lambda is still running on Amazon Linux 2, even for Python 3.13. As far as I know, Amazon Linux 2023 uses kernel version 6.x, not 5.x.
I'm not sure why this discrepancy isn't reflected in their official documentation:
mattip commentedon Jul 29, 2025
I can't comment on why AWS lambda for python3.13 uses the older version.
Using
--platforminpip installis advanced usage, and limits the version resolver to only use that version. If you do not use that flag, the resolver will accept any package suitable for your machine, so for a 2_28 GLIBC platform it will accept manylinux_2_28 or manylinux_2_17 (which is an alias for manylinux2014).Edit: if you wish to use the
--platformflag, you will need to use thepip installcommand twice: once for numpy, and again for pandas.