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

Bug: cannot use pycrypto with python3.11 #105

Closed
mims92 opened this issue Oct 18, 2023 · 2 comments
Closed

Bug: cannot use pycrypto with python3.11 #105

mims92 opened this issue Oct 18, 2023 · 2 comments
Labels
blocked/close-if-inactive Blocked for >14 days with no response, will be closed if still inactive after 7 days blocked/more-info-needed More info is needed from the requester. If no response in 14 days, it will become stale. python

Comments

@mims92
Copy link

mims92 commented Oct 18, 2023

Description:

When trying to build/test an 3.11 Python application that requires pycrypto, there is this issue:

[...]
    gcc -pthread -Wsign-compare -fwrapv -Wall -fPIC -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/usr/include/ -I/var/lang/include/python3.11 -c src/_fastmath.c -o build/temp.linux-x
86_64-cpython-311/src/_fastmath.o
      In file included from /var/lang/include/python3.11/Python.h:12:0,
                       from src/_fastmath.c:31:
      /var/lang/include/python3.11/pyconfig.h:1784:0: warning: "_POSIX_C_SOURCE" redefined
       #define _POSIX_C_SOURCE 200809L
     
      In file included from /usr/include/bits/libc-header-start.h:33:0,
                       from /usr/include/stdio.h:27,
                       from src/_fastmath.c:29:
      /usr/include/features.h:289:0: note: this is the location of the previous definition
       # define _POSIX_C_SOURCE 199506L
     
      src/_fastmath.c:33:10: fatal error: longintrepr.h: No such file or directory
       #include <longintrepr.h>    /* for conversions */
                ^~~~~~~~~~~~~~~
      compilation terminated.
      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]

The issue doesn't occur with Python3.9 image.

Steps to reproduce:

  1. Create an application with SAM using Python3.11 runtime
  2. add pycrypto in the requirements.txt file
  3. Build the application

Observed result:

      error: command '/usr/bin/gcc' failed with exit code 1
      [end of output]

Expected result:

The application build correctly.

Additional environment details (Ex: Windows, Mac, Amazon Linux etc)

  1. OS: Docker
  2. If using SAM CLI, sam --version: 23.1.2
  3. AWS region: /
@mims92 mims92 added the stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. label Oct 18, 2023
@mims92 mims92 changed the title Bug: cannot use pycrypto with python3.11 version Bug: cannot use pycrypto with python3.11 Oct 18, 2023
@mndeveci
Copy link
Contributor

Hi there,

It looks like it is trying to compile the c bindings and it is failing with new python3.11 image. It is probably caused by gcc version (or other libraries related to gcc). Some python libraries provide their compiled c bindings but for this one, it needs to be compiled from scratch.

When I search for the library it seems that it is not been maintained anymore, so I assume it is not updating its source code for newer tools https://www.pycrypto.org/

You can create your own image which will contain a combination of the python version you need and the other tooling that this library requires. And then you can provide the custom image during build with --build-image option. Or, you can also create and Image based Lambda function which then can be build from different base images.

@mndeveci mndeveci added python blocked/more-info-needed More info is needed from the requester. If no response in 14 days, it will become stale. and removed stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. labels Oct 20, 2023
@hawflau hawflau added the blocked/close-if-inactive Blocked for >14 days with no response, will be closed if still inactive after 7 days label Nov 9, 2023
@hnnasit
Copy link
Contributor

hnnasit commented Dec 16, 2023

Closing this issue since it's been inactive for a while now. Feel free to create a new issue if you have any questions or concerns.

@hnnasit hnnasit closed this as completed Dec 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked/close-if-inactive Blocked for >14 days with no response, will be closed if still inactive after 7 days blocked/more-info-needed More info is needed from the requester. If no response in 14 days, it will become stale. python
Projects
None yet
Development

No branches or pull requests

4 participants