Fresh install version-14 on Centos 7

I am hosting my own ERPNext site on Centos 7.

I have successfully installed it for version-12 after several attempts, but all the instructions I have do not talk about versions 13 or 14.

So I did a snapshot of my working version 12 and am attempting a fresh install of version-16. It seems that version 14 requires python 3 and nodejs 16 whic I am installing. However I cannot get past the

“bench init --frappe-branch version-14 frappe-bench”

I get the following error:

[frappe@powergps ~]$ bench init --frappe-branch version-14 frappe-bench
Setting Up Environment
$ /usr/bin/python3.6 -m venv env
$ /home/frappe/frappe-bench/env/bin/python -m pip install --quiet --upgrade pip
Cache entry deserialization failed, entry ignored
Getting frappe
$ git clone https://github.com/frappe/frappe.git --branch version-14  --origin upstream
Cloning into 'frappe'...
remote: Enumerating objects: 383648, done.
remote: Counting objects: 100% (190/190), done.
remote: Compressing objects: 100% (115/115), done.
remote: Total 383648 (delta 104), reused 135 (delta 75), pack-reused 383458
Receiving objects: 100% (383648/383648), 329.50 MiB | 64.98 MiB/s, done.
Resolving deltas: 100% (295263/295263), done.
Installing frappe
$ /home/frappe/frappe-bench/env/bin/python -m pip install --quiet --upgrade -e /home/frappe/frappe-bench/apps/frappe
  ERROR: Command errored out with exit status 1:
   command: /home/frappe/frappe-bench/env/bin/python /home/frappe/frappe-bench/env/lib64/python3.6/site-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_editable /tmp/tmp83a6w2gl
       cwd: /home/frappe/frappe-bench/apps/frappe
  Complete output (17 lines):
  Traceback (most recent call last):
    File "/home/frappe/frappe-bench/env/lib64/python3.6/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
      main()
    File "/home/frappe/frappe-bench/env/lib64/python3.6/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/home/frappe/frappe-bench/env/lib64/python3.6/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 144, in get_requires_for_build_editable
      return hook(config_settings)
    File "/tmp/pip-build-env-la3wqaay/overlay/lib/python3.6/site-packages/flit_core/buildapi.py", line 32, in get_requires_for_build_wheel
      docstring, version = get_docstring_and_version_via_ast(module)
    File "/tmp/pip-build-env-la3wqaay/overlay/lib/python3.6/site-packages/flit_core/common.py", line 132, in get_docstring_and_version_via_ast
      node = ast.parse(f.read())
    File "/usr/lib64/python3.6/ast.py", line 35, in parse
      return compile(source, filename, mode, PyCF_ONLY_AST)
    File "<unknown>", line 1081
      if key := can_cache_doc(args):
              ^
  SyntaxError: invalid syntax
  ----------------------------------------
WARNING: Discarding file:///home/frappe/frappe-bench/apps/frappe. Command errored out with exit status 1: /home/frappe/frappe-bench/env/bin/python /home/frappe/frappe-bench/env/lib64/python3.6/site-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_editable /tmp/tmp83a6w2gl Check the logs for full command output.
ERROR: Command errored out with exit status 1: /home/frappe/frappe-bench/env/bin/python /home/frappe/frappe-bench/env/lib64/python3.6/site-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_editable /tmp/tmp83a6w2gl Check the logs for full command output.
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/bench/commands/make.py", line 83, in init
    verbose=verbose,
  File "/usr/local/lib/python3.6/site-packages/bench/utils/render.py", line 95, in wrapper_fn
    return fn(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/bench/utils/system.py", line 85, in init
    resolve_deps=False,
  File "/usr/local/lib/python3.6/site-packages/bench/app.py", line 433, in get_app
    app.install(verbose=verbose, skip_assets=skip_assets, restart_bench=restart_bench)
  File "/usr/local/lib/python3.6/site-packages/bench/utils/render.py", line 110, in wrapper_fn
    return fn(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/bench/app.py", line 239, in install
    resolution=self.local_resolution
  File "/usr/local/lib/python3.6/site-packages/bench/app.py", line 553, in install_app
    bench.run(f"{bench.python} -m pip install {quiet_flag} --upgrade -e {app_path} {cache_flag}")
  File "/usr/local/lib/python3.6/site-packages/bench/bench.py", line 47, in run
    return exec_cmd(cmd, cwd=cwd or self.cwd)
  File "/usr/local/lib/python3.6/site-packages/bench/utils/__init__.py", line 153, in exec_cmd
    raise CommandFailedError
bench.exceptions.CommandFailedError

ERROR: There was a problem while creating frappe-bench
Do you want to rollback these changes? [y/N]: y

I have also tried setting python 3 as the default with this:

# Start by registering python2 as an alternative
alternatives --install /usr/bin/python python /usr/bin/python2 50

# Register python3.5 as an alternative
alternatives --install /usr/bin/python python /usr/bin/python3.5 60

# Select which Python version to use
alternatives --config python

Also, below are my steps from a fresh centos image:

sudo yum update -y &&
sudo yum upgrade -y

sudo adduser frappe &&
sudo usermod -aG wheel frappe &&
passwd frappe

su frappe
cd /home/frappe/frappe-bench

sudo yum install -y redhat-lsb-core git python3-setuptools python3-devel python3.10-devel python3-pip openssl-devel libffi-devel python3-distutils

sudo yum install -y python3.10-venv

sudo yum groupinstall -y “Development tools” &&
sudo yum install -y redhat-lsb-core git python3-setuptools python3-devel openssl-devel libffi-devel

sudo yum install epel-release

sudo yum -y install mariadb mariadb-server mysql-devel

sudo nano /etc/my.cnf
Add the following lines under the symbolic-links=0 line.
innodb-file-format=barracuda
innodb-file-per-table=1
innodb-large-prefix=1
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci

[mysql]
default-character-set = utf8mb4

sudo pip3 install --upgrade pip setuptools &&
sudo pip3 install ansible

sudo systemctl start mariadb.service &&
sudo systemctl enable mariadb.service &&
sudo mysql_secure_installation &&
sudo systemctl start mariadb.service &&
sudo systemctl enable mariadb.service &&
sudo service mariadb.service restart

sudo sh -c “firewall-cmd --permanent --zone=public --add-service=http && firewall-cmd --permanent --zone=public --add-service=https && firewall-cmd --reload” &&
sudo firewall-cmd --permanent --add-port=8000/tcp &&
sudo firewall-cmd --permanent --add-port=9000/tcp

firewall-cmd --reload **RUN IN ROOT

sudo curl --silent --location https://rpm.nodesource.com/setup_16.x | sudo bash -
sudo yum -y install nginx nodejs redis

sudo systemctl start nginx &&
sudo systemctl enable nginx &&
sudo systemctl start redis &&
sudo systemctl enable redis

curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | sudo tee /etc/yum.repos.d/yarn.repo &&
sudo rpm --import https://dl.yarnpkg.com/rpm/pubkey.gpg &&
sudo yum install yarn

sudo yum -y install libXrender libXext xorg-x11-fonts-75dpi xorg-x11-fonts-Type1 &&
wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz &&
sudo tar -xf wkhtmltox-0.12.4_linux-generic-amd64.tar.xz -C /opt &&
sudo ln -s /opt/wkhtmltox/bin/wkhtmltopdf /usr/bin/wkhtmltopdf &&
sudo ln -s /opt/wkhtmltox/bin/wkhtmltoimage /usr/bin/wkhtmltoimage

sudo pip3 install frappe-bench

bench init --frappe-branch version-14 frappe-bench

Not sure what the next step is.

Regarding this part of the error above:

   File "/tmp/pip-build-env-vvntjhyu/overlay/lib/python3.6/site-packages/flit_core/common.py", line 132, in get_docstring_and_version_via_ast
      node = ast.parse(f.read())
    File "/usr/lib64/python3.6/ast.py", line 35, in parse
      return compile(source, filename, mode, PyCF_ONLY_AST)
    File "<unknown>", line 1081
      if key := can_cache_doc(args):
              ^
  SyntaxError: invalid syntax
  ----------------------------------------

I read that the syntax “:=” was introduced in Python3.8 so I have also installed 3.8 to see if it helps but it shows for that section of the output that it is still trying to use python 3.6.

Here is the output after installing Python 3.8:


[frappe@powergps ~]$ bench init --frappe-branch version-14 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 https://github.com/frappe/frappe.git --branch version-14  --origin upstream
Cloning into 'frappe'...
remote: Enumerating objects: 383885, done.
remote: Counting objects: 100% (427/427), done.
remote: Compressing objects: 100% (229/229), done.
remote: Total 383885 (delta 268), reused 291 (delta 198), pack-reused 383458
Receiving objects: 100% (383885/383885), 328.89 MiB | 45.66 MiB/s, done.
Resolving deltas: 100% (295519/295519), done.
Installing frappe
$ /home/frappe/frappe-bench/env/bin/python -m pip install --quiet --upgrade -e /home/frappe/frappe-bench/apps/frappe
  ERROR: Command errored out with exit status 1:
   command: /home/frappe/frappe-bench/env/bin/python /home/frappe/frappe-bench/env/lib64/python3.6/site-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_editable /tmp/tmpawlsa1g9
       cwd: /home/frappe/frappe-bench/apps/frappe
  Complete output (17 lines):
  Traceback (most recent call last):
    File "/home/frappe/frappe-bench/env/lib64/python3.6/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
      main()
    File "/home/frappe/frappe-bench/env/lib64/python3.6/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/home/frappe/frappe-bench/env/lib64/python3.6/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 144, in get_requires_for_build_editable
      return hook(config_settings)
    File "/tmp/pip-build-env-vvntjhyu/overlay/lib/python3.6/site-packages/flit_core/buildapi.py", line 32, in get_requires_for_build_wheel
      docstring, version = get_docstring_and_version_via_ast(module)
    File "/tmp/pip-build-env-vvntjhyu/overlay/lib/python3.6/site-packages/flit_core/common.py", line 132, in get_docstring_and_version_via_ast
      node = ast.parse(f.read())
    File "/usr/lib64/python3.6/ast.py", line 35, in parse
      return compile(source, filename, mode, PyCF_ONLY_AST)
    File "<unknown>", line 1081
      if key := can_cache_doc(args):
              ^
  SyntaxError: invalid syntax
  ----------------------------------------
WARNING: Discarding file:///home/frappe/frappe-bench/apps/frappe. Command errored out with exit status 1: /home/frappe/frappe-bench/env/bin/python /home/frappe/frappe-bench/env/lib64/python3.6/site-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_editable /tmp/tmpawlsa1g9 Check the logs for full command output.
ERROR: Command errored out with exit status 1: /home/frappe/frappe-bench/env/bin/python /home/frappe/frappe-bench/env/lib64/python3.6/site-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_editable /tmp/tmpawlsa1g9 Check the logs for full command output.
subprocess.CalledProcessError: Command '/home/frappe/frappe-bench/env/bin/python -m pip install --quiet --upgrade -e /home/frappe/frappe-bench/apps/frappe ' returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/frappe/.local/lib/python3.8/site-packages/bench/commands/make.py", line 68, in init
    init(
  File "/home/frappe/.local/lib/python3.8/site-packages/bench/utils/render.py", line 105, in wrapper_fn
    return fn(*args, **kwargs)
  File "/home/frappe/.local/lib/python3.8/site-packages/bench/utils/system.py", line 79, in init
    get_app(
  File "/home/frappe/.local/lib/python3.8/site-packages/bench/app.py", line 444, in get_app
    app.install(verbose=verbose, skip_assets=skip_assets, restart_bench=restart_bench)
  File "/home/frappe/.local/lib/python3.8/site-packages/bench/utils/render.py", line 126, in wrapper_fn
    return fn(*args, **kwargs)
  File "/home/frappe/.local/lib/python3.8/site-packages/bench/app.py", line 242, in install
    install_app(
  File "/home/frappe/.local/lib/python3.8/site-packages/bench/app.py", line 573, in install_app
    bench.run(
  File "/home/frappe/.local/lib/python3.8/site-packages/bench/bench.py", line 48, in run
    return exec_cmd(cmd, cwd=cwd or self.cwd, _raise=_raise)
  File "/home/frappe/.local/lib/python3.8/site-packages/bench/utils/__init__.py", line 158, in exec_cmd
    raise CommandFailedError from subprocess.CalledProcessError(return_code, cmd)
bench.exceptions.CommandFailedError

ERROR: There was a problem while creating frappe-bench
Do you want to rollback these changes? [y/N]: y
INFO: Rolling back Bench "frappe-bench"

hi

the minimum python requirement for V14 erpnext is 3.10+

You would most probably need to install 3.10 or 3.11 from source in centos 7

secondly you cannot jump version when upgrading from erpnext V12… first upgrade to V13 and then to V14