Homit Dalia
Homit Dalia

Reputation: 308

Could not build wheels for pycrypto, which is required to install pyproject.toml-based projects - ERROR

I'm facing an error while deploying to Heroku. ERROR: Could not build wheels for pycrypto, which is required to install pyproject.toml-based projects. However, my project does not specify use for pycrypto. What is causing this issue? My requirements.txt looks like:

Heroku CLI output
 Building wheel for pycrypto (setup.py): started
remote:          Building wheel for pycrypto (setup.py): finished with status 'error'
remote:          error: subprocess-exited-with-error
remote:
remote:          × python setup.py bdist_wheel did not run successfully.
remote:          │ exit code: 1
remote:          ╰─> [71 lines of output]
remote:              checking for gcc... gcc
remote:              checking whether the C compiler works... yes
remote:              checking for C compiler default output file name... a.out
remote:              checking for suffix of executables...
remote:              checking whether we are cross compiling... no
remote:              checking for suffix of object files... o
remote:              checking whether we are using the GNU C compiler... yes
remote:              checking whether gcc accepts -g... yes
remote:              checking for gcc option to accept ISO C89... none needed
remote:              checking for __gmpz_init in -lgmp... yes
remote:              checking for __gmpz_init in -lmpir... no
remote:              checking whether mpz_powm is declared... yes
remote:              checking whether mpz_powm_sec is declared... yes
remote:              checking how to run the C preprocessor... gcc -E
remote:              checking for grep that handles long lines and -e... /usr/bin/grep
remote:              checking for egrep... /usr/bin/grep -E
remote:              checking for ANSI C header files... yes
remote:              checking for sys/types.h... yes
remote:              checking for sys/stat.h... yes
remote:              checking for stdlib.h... yes
remote:              checking for string.h... yes
remote:              checking for memory.h... yes
remote:              checking for strings.h... yes
remote:              checking for inttypes.h... yes
remote:              checking for stdint.h... yes
remote:              checking for unistd.h... yes
remote:              checking for inttypes.h... (cached) yes
remote:              checking limits.h usability... yes
remote:              checking limits.h presence... yes
remote:              checking for limits.h... yes
remote:              checking stddef.h usability... yes
remote:              checking stddef.h presence... yes
remote:              checking for stddef.h... yes
remote:              checking for stdint.h... (cached) yes
remote:              checking for stdlib.h... (cached) yes
remote:              checking for string.h... (cached) yes
remote:              checking wchar.h usability... yes
remote:              checking wchar.h presence... yes
remote:              checking for wchar.h... yes
remote:              checking for inline... inline
remote:              checking for int16_t... yes
remote:              checking for int32_t... yes
remote:              checking for int64_t... yes
remote:              checking for int8_t... yes
remote:              checking for size_t... yes
remote:              checking for uint16_t... yes
remote:              checking for uint32_t... yes
remote:              checking for uint64_t... yes
remote:              checking for uint8_t... yes
remote:              checking for stdlib.h... (cached) yes
remote:              checking for GNU libc compatible malloc... yes
remote:              checking for memmove... yes
remote:              checking for memset... yes
remote:              configure: creating ./config.status
remote:              config.status: creating src/config.h
remote:              In file included from /app/.heroku/python/include/python3.11/Python.h:86,
remote:                               from src/_fastmath.c:31:
remote:              /app/.heroku/python/include/python3.11/cpython/pytime.h:208:60: warning: ‘struct timespec’ declared inside parameter list will not be visible outside of this definition or declaratio 
remote:                208 | PyAPI_FUNC(int) _PyTime_FromTimespec(_PyTime_t *tp, struct timespec *ts);
remote:                    |                                                            ^~~~~~~~
remote:              /app/.heroku/python/include/python3.11/cpython/pytime.h:213:56: warning: ‘struct timespec’ declared inside parameter list will not be visible outside of this definition or declaratio 
remote:                213 | PyAPI_FUNC(int) _PyTime_AsTimespec(_PyTime_t t, struct timespec *ts);
remote:                    |                                                        ^~~~~~~~
remote:              /app/.heroku/python/include/python3.11/cpython/pytime.h:217:63: warning: ‘struct timespec’ declared inside parameter list will not be visible outside of this definition or declaratio 
remote:                217 | PyAPI_FUNC(void) _PyTime_AsTimespec_clamp(_PyTime_t t, struct timespec *ts);
remote:                    |                                                               ^~~~~~~~
remote:              src/_fastmath.c:33:10: fatal error: longintrepr.h: No such file or directory
remote:                 33 | #include <longintrepr.h>                                /* for conversions */
remote:                    |          ^~~~~~~~~~~~~~~
remote:              compilation terminated.
remote:              error: command '/usr/bin/gcc' failed with exit code 1
remote:              [end of output]
remote:
remote:          note: This error originates from a subprocess, and is likely not a problem with pip.
remote:          ERROR: Failed building wheel for pycrypto
remote:          Running setup.py clean for pycrypto
remote:          Building wheel for sseclient (setup.py): started
remote:          Building wheel for sseclient (setup.py): finished with status 'done'
remote:          Created wheel for sseclient: filename=sseclient-0.0.27-py3-none-any.whl size=5565 sha256=30988661931e8740f4a7ee87948f5f69e2803cb6d31179cbe4cb6e9bbea1241e
remote:          Stored in directory: /tmp/pip-ephem-wheel-cache-ivcb6vdl/wheels/7c/54/eb/a223b1599728ecaf0528281c17c96c503aa7d18a752a4e4e3a
remote:          Building wheel for jwcrypto (setup.py): started
remote:          Building wheel for jwcrypto (setup.py): finished with status 'done'
remote:          Created wheel for jwcrypto: filename=jwcrypto-1.4.2-py3-none-any.whl size=90472 sha256=b9d97dca4df5d53e6f69d6e0c7c0406fdb519a521a08f8e15d02bcfff20c8cb3
remote:          Stored in directory: /tmp/pip-ephem-wheel-cache-ivcb6vdl/wheels/42/b6/e3/23d953d3b1a939d81aa460121597ac050eaf99d04578eb4340
remote:        Successfully built dash_daq gcloud sseclient jwcrypto
remote:        Failed to build pycrypto
remote:        ERROR: Could not build wheels for pycrypto, which is required to install pyproject.toml-based projects
remote:  !     Push rejected, failed to compile Python app.
remote: 
remote:  !     Push failed
remote:
remote: Verifying deploy...
remote:
remote: !       Push rejected to acuradyne.
remote:
To ##app link 
 ! [remote rejected] master -> master (pre-receive hook declined)

Any possible solutions or reasoning behind this problem will be helpful

Upvotes: 10

Views: 109349

Answers (3)

Hikmetli
Hikmetli

Reputation: 13

I had same error. First, look for the longintrepr.h file. For me, it was in the usr/include/python3.x/cpython/ folder. Next, copy it to the parent level folder, which in my case was usr/include/python3.x/. This fixed my problem.

Upvotes: 0

Homit Dalia
Homit Dalia

Reputation: 308

The problem occurred because I had both pyrebase and pyrebase4 inside the requirements.txt

I removed pyrebase and kept pyrebase4. It solved the problem

Upvotes: 0

alenzo-pinc
alenzo-pinc

Reputation: 131

Try running pip install setuptools wheel before installing requirements.txt. Some legacy projects require these packages to build wheels for pyproject.toml based projects. If that doesn't work, you might look into pycryptodome as a replacement for this dependency as mentioned in this thread.

https://stackoverflow.com/a/50099842/19581102

Upvotes: 8

Related Questions