我在部署到Heroku时遇到了一个错误。错误:无法为pycrypto构建wheels,这是安装基于pyproject.toml的项目所必需的。但是,我的项目没有指定使用pycrypto。是什么导致了这个问题?我的requirements.txt看起来像:
- python==3.10.9
- firebase_admin
- 耐热碱
- Pyerbase4
- 破折号
- dash_auth
- 破折号引导组件
- Dash_DAQ
- Pandas
- 阴谋地
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)
任何可能的解决方案或推理背后的这个问题将是有帮助的
1条答案
按热度按时间lnvxswe21#
请在安装requirements.txt之前尝试运行
pip install setuptools wheel
。一些遗留项目需要这些包来为基于pyproject.toml的项目构建wheel。如果这不起作用,你可以考虑使用pycyptodome来替代这个依赖,就像这个线程中提到的那样。https://stackoverflow.com/a/50099842/19581102