Error install ERPNext14 on CentOS7

system: CentOS Linux release 7.9.2009
I have installed python3.10.9 and have executed sudo yum install python3-devel python3-setuptools

can not install frappe14 with “bench init --frappe-branch v14.21.1 frappe-bench”

[frappe@localhost ~]$ bench init --frappe-branch v14.21.1 frappe-bench
Setting Up Environment
$ python3 -m venv env
$ /home/frappe/frappe-bench/env/bin/python -m pip install --quiet --upgrade pip
$ /home/frappe/frappe-bench/env/bin/python -m pip install --quiet wheel

Getting frappe
$ git clone GitHub - frappe/frappe: Low code web framework for real world applications, in Python and Javascript --branch v14.21.1 --origin upstream
正克隆到 ‘frappe’…
remote: Enumerating objects: 373254, done.
remote: Counting objects: 100% (704/704), done.
remote: Compressing objects: 100% (382/382), done.
remote: Total 373254 (delta 422), reused 529 (delta 322), pack-reused 372550
接收对象中: 100% (373254/373254), 325.27 MiB | 3.87 MiB/s, done.
处理 delta 中: 100% (287207/287207), done.
Note: checking out ‘aa9d5e4c9b4677a2549200045dfcab506d1e5ce0’.

You are in ‘detached HEAD’ state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

git checkout -b new_branch_name

Installing frappe
$ /home/frappe/frappe-bench/env/bin/python -m pip install --quiet --upgrade -e /home/frappe/frappe-bench/apps/frappe
error: subprocess-exited-with-error

× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [30 lines of output]
/tmp/pip-install-7fnzv0ut/hiredis_76d0c79b59dc4c87a64400a7d232ad75/setup.py:7: DeprecationWarning: the imp module is deprecated in favour of importlib and slated for removal in Python 3.12; see the module’s documentation for alternative uses
import sys, imp, os, glob, io
/home/frappe/frappe-bench/env/lib/python3.10/site-packages/setuptools/dist.py:771: UserWarning: Usage of dash-separated ‘description-file’ will not be supported in future versions. Please use the underscore name ‘description_file’ instead
warnings.warn(
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-cpython-310
creating build/lib.linux-x86_64-cpython-310/hiredis
copying hiredis/init.py → build/lib.linux-x86_64-cpython-310/hiredis
copying hiredis/version.py → build/lib.linux-x86_64-cpython-310/hiredis
copying hiredis/hiredis.pyi → build/lib.linux-x86_64-cpython-310/hiredis
copying hiredis/py.typed → build/lib.linux-x86_64-cpython-310/hiredis
running build_ext
building ‘hiredis.hiredis’ extension
creating build/temp.linux-x86_64-cpython-310
creating build/temp.linux-x86_64-cpython-310/src
creating build/temp.linux-x86_64-cpython-310/vendor
creating build/temp.linux-x86_64-cpython-310/vendor/hiredis
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -I/usr/include/openssl11 -I/usr/include/openssl11 -fPIC -Ivendor -I/home/frappe/frappe-bench/env/include -I/usr/local/include/python3.10 -c src/hiredis.c -o build/temp.linux-x86_64-cpython-310/src/hiredis.o
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -I/usr/include/openssl11 -I/usr/include/openssl11 -fPIC -Ivendor -I/home/frappe/frappe-bench/env/include -I/usr/local/include/python3.10 -c src/reader.c -o build/temp.linux-x86_64-cpython-310/src/reader.o
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -I/usr/include/openssl11 -I/usr/include/openssl11 -fPIC -Ivendor -I/home/frappe/frappe-bench/env/include -I/usr/local/include/python3.10 -c vendor/hiredis/alloc.c -o build/temp.linux-x86_64-cpython-310/vendor/hiredis/alloc.o
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -I/usr/include/openssl11 -I/usr/include/openssl11 -fPIC -Ivendor -I/home/frappe/frappe-bench/env/include -I/usr/local/include/python3.10 -c vendor/hiredis/read.c -o build/temp.linux-x86_64-cpython-310/vendor/hiredis/read.o
vendor/hiredis/read.c: 在函数‘redisReaderFree’中:
vendor/hiredis/read.c:646:9: 错误:只允许在 C99 模式下使用‘for’循环初始化声明
for (int i = 0; i < r->tasks; i++) {
^
vendor/hiredis/read.c:646:9: 附注:使用 -std=c99 或 -std=gnu99 来编译您的代码
error: command ‘/usr/bin/gcc’ failed with exit code 1
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for hiredis
error: subprocess-exited-with-error

× Running setup.py install for hiredis did not run successfully.
│ exit code: 1
╰─> [32 lines of output]
/tmp/pip-install-7fnzv0ut/hiredis_76d0c79b59dc4c87a64400a7d232ad75/setup.py:7: DeprecationWarning: the imp module is deprecated in favour of importlib and slated for removal in Python 3.12; see the module’s documentation for alternative uses
import sys, imp, os, glob, io
/home/frappe/frappe-bench/env/lib/python3.10/site-packages/setuptools/dist.py:771: UserWarning: Usage of dash-separated ‘description-file’ will not be supported in future versions. Please use the underscore name ‘description_file’ instead
warnings.warn(
running install
/home/frappe/frappe-bench/env/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build
running build_py
creating build
creating build/lib.linux-x86_64-cpython-310
creating build/lib.linux-x86_64-cpython-310/hiredis
copying hiredis/init.py → build/lib.linux-x86_64-cpython-310/hiredis
copying hiredis/version.py → build/lib.linux-x86_64-cpython-310/hiredis
copying hiredis/hiredis.pyi → build/lib.linux-x86_64-cpython-310/hiredis
copying hiredis/py.typed → build/lib.linux-x86_64-cpython-310/hiredis
running build_ext
building ‘hiredis.hiredis’ extension
creating build/temp.linux-x86_64-cpython-310
creating build/temp.linux-x86_64-cpython-310/src
creating build/temp.linux-x86_64-cpython-310/vendor
creating build/temp.linux-x86_64-cpython-310/vendor/hiredis
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -I/usr/include/openssl11 -I/usr/include/openssl11 -fPIC -Ivendor -I/home/frappe/frappe-bench/env/include -I/usr/local/include/python3.10 -c src/hiredis.c -o build/temp.linux-x86_64-cpython-310/src/hiredis.o
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -I/usr/include/openssl11 -I/usr/include/openssl11 -fPIC -Ivendor -I/home/frappe/frappe-bench/env/include -I/usr/local/include/python3.10 -c src/reader.c -o build/temp.linux-x86_64-cpython-310/src/reader.o
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -I/usr/include/openssl11 -I/usr/include/openssl11 -fPIC -Ivendor -I/home/frappe/frappe-bench/env/include -I/usr/local/include/python3.10 -c vendor/hiredis/alloc.c -o build/temp.linux-x86_64-cpython-310/vendor/hiredis/alloc.o
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -I/usr/include/openssl11 -I/usr/include/openssl11 -fPIC -Ivendor -I/home/frappe/frappe-bench/env/include -I/usr/local/include/python3.10 -c vendor/hiredis/read.c -o build/temp.linux-x86_64-cpython-310/vendor/hiredis/read.o
vendor/hiredis/read.c: 在函数‘redisReaderFree’中:
vendor/hiredis/read.c:646:9: 错误:只允许在 C99 模式下使用‘for’循环初始化声明
for (int i = 0; i < r->tasks; i++) {
^
vendor/hiredis/read.c:646:9: 附注:使用 -std=c99 或 -std=gnu99 来编译您的代码
error: command ‘/usr/bin/gcc’ failed with exit code 1
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> hiredis

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
Traceback (most recent call last):
File “/usr/local/lib/python3.10/site-packages/bench/commands/make.py”, line 68, in init
init(
File “/usr/local/lib/python3.10/site-packages/bench/utils/render.py”, line 105, in wrapper_fn
return fn(*args, **kwargs)
File “/usr/local/lib/python3.10/site-packages/bench/utils/system.py”, line 79, in init
get_app(
File “/usr/local/lib/python3.10/site-packages/bench/app.py”, line 444, in get_app
app.install(verbose=verbose, skip_assets=skip_assets, restart_bench=restart_bench)
File “/usr/local/lib/python3.10/site-packages/bench/utils/render.py”, line 126, in wrapper_fn
return fn(*args, **kwargs)
File “/usr/local/lib/python3.10/site-packages/bench/app.py”, line 242, in install
install_app(
File “/usr/local/lib/python3.10/site-packages/bench/app.py”, line 573, in install_app
bench.run(
File “/usr/local/lib/python3.10/site-packages/bench/bench.py”, line 48, in run
return exec_cmd(cmd, cwd=cwd or self.cwd, _raise=_raise)
File “/usr/local/lib/python3.10/site-packages/bench/utils/init.py”, line 158, in exec_cmd
raise CommandFailedError
bench.exceptions.CommandFailedError

you need other packages installed as well.

you need mariadb, redis

check this gist: Frappe/ERPNext version 14 on RHEL 8 · GitHub

If this is a clean server maybe you’d better install AlmaLinux 8 (or other spin off of CentOS) for ERPNext version 13 up.

Thanks, I have installed oter packages, but the error still exists.
This error does not seem to be related to erpnext, because I directly install “hiredis==2.0.0” will also report an this error with python3.10 on CentOS7.
Here is the issue for hiredis: C99 errors with older gcc · Issue #127 · redis/hiredis-py · GitHub, and they havd fixed it in 2.1.0.
Maybe the hiredis package that frappe depends on can be upgraded to 2.1.0?

get, thank you for your reply

sudo apt-get install python3-apt python3-dev build-essential
sudo apt-get install python3.11-dev
bench init frappe-bench --frappe-branch version-14