Skip to content

No wheels for NumPy 2.3.0 on amazon linux 2 AWS lambda image #29150

Open

Description

@akshit0201

Steps to reproduce:

  1. Use the public.ecr.aws/lambda/python:3.11 Docker base image.
  2. In a Dockerfile, copy in a requirements.txt containing numpy
  3. Run pip install -r requirements.txt.
  4. 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

Activity

  1. added
    32 - Installation
    on Jun 9, 2025
  2. pangolinkeys commented on Jun 9, 2025

    @pangolinkeys

    We've also started experiencing this issue this morning.

          The Meson build system
          Version: 1.6.1
          Source dir: /tmp/pip-install-gf4doqkk/numpy_717adc4dac3e4268ac40ff583ce5715b
          Build dir: /tmp/pip-install-gf4doqkk/numpy_717adc4dac3e4268ac40ff583ce5715b/.mesonpy-0b0zxh5d
          Build type: native build
          Project name: NumPy
          Project version: 2.3.0
          C compiler for the host machine: cc (gcc 7.3.1 "cc (GCC) 7.3.1 20180712 (Red Hat 7.3.1-17)")
          C linker for the host machine: cc ld.bfd 2.29.1-31
          C++ compiler for the host machine: c++ (gcc 7.3.1 "c++ (GCC) 7.3.1 20180712 (Red Hat 7.3.1-17)")
          C++ linker for the host machine: c++ ld.bfd 2.29.1-31
          Cython compiler for the host machine: cython (cython 3.1.2)
          Host machine cpu family: x86_64
          Host machine cpu: x86_64
          
          ../meson.build:28:4: ERROR: Problem encountered: NumPy requires GCC >= 9.3
    

    Our build step uses public.ecr.aws/sam/build-python3.11:latest-x86_64 to 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

  3. mattip commented on Jun 9, 2025

    @mattip
    Member

    We provide wheels for manylinux_2_28. Perhaps you are using an older amazon linux2 image, which does not support manylinux_2_28?

  4. cedricfarinazzo commented on Jun 9, 2025

    @cedricfarinazzo

    I had the same error with the image public.ecr.aws/lambda/python:3.11 and numpy==2.3.0.

    I temporarily fixed it by installing GCC 10:

    RUN yum install -y make cmake libc-dev gcc10.$(uname -m) gcc10-c++.$(uname -m)
    ENV CC=/usr/bin/gcc10-gcc
    ENV CXX=/usr/bin/gcc10-g++
    ENV AR=/usr/bin/gcc10-ar
    ENV AS=/usr/bin/gcc10-as
    

    Now numpy==2.3.0 installs correctly, but the build takes 10 minutes because it compiles NumPy from source.

    When using numpy==2.2.6, the wheel filename is numpy-2.2.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
    The job building wheel for manylinux_2_17_x86_64: https://github.com/numpy/numpy/actions/runs/15086533833/job/42411405542

    On numpy==2.3.0, i can only see build job for manylinux_2_28 wheels.

    So I think manylinux_2_17 wheel is missing for numpy==2.3.0 and must be kept for retrocompatibility.

  5. andyfaff commented on Jun 9, 2025

    @andyfaff
    Member

    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

  6. mattip commented on Jun 9, 2025

    @mattip
    Member

    The 2_17 target is end of life

    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?

  7. piscoTech commented on Jun 11, 2025

    @piscoTech

    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.

  8. changed the title [-]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[/+] on Jun 11, 2025
  9. changed the title [-]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[/+] on Jun 11, 2025
  10. mattip commented on Jul 22, 2025

    @mattip
    Member

    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.

  11. dyaskur commented on Jul 29, 2025

    @dyaskur

    What --platform value 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:

    pip install \
    --platform manylinux2014_x86_64 \
    --target=package \
    --implementation cp \
    --python-version 3.13 \
    --only-binary=:all: --upgrade \
     pandas==2.3.1 numpy==2.2.6 -t python
    

    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.

  12. dyaskur commented on Jul 29, 2025

    @dyaskur

    By the way, I tested AWS Lambda with Python 3.13 by running the following code:

    import platform
    
    def lambda_handler(event, context):
        return {
            "platform_release: platform.release()
        }
    

    The output returned:

      "platform_release": "5.10.238-254.954.amzn2.x86_64",
    

    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:

    Image

  13. mattip commented on Jul 29, 2025

    @mattip
    Member

    I can't comment on why AWS lambda for python3.13 uses the older version.

    Using --platform in pip install is 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 --platform flag, you will need to use the pip install command twice: once for numpy, and again for pandas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    32 - Installation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions