Dropping python <=3.9 support for next version of Frappe/ERPNext

Ok thank you, I have followed your suggesting to the tee, but am still getting the same error, I have even set python 3.10 on auto mode;

here are 2 choices for the alternative python (providing /usr/bin/python).

Selection Path Priority Status

  • 0 /usr/bin/python3.10 2 auto mode
    1 /usr/bin/python3.10 2 manual mode
    2 /usr/bin/python3.8 1 manual mode

am not sure if I should also change the enviroment, please take note this is a fresh installation and am failing to bench init

This problem took me few days also and I fix it by follow this link

Upgrade Python to latest version (3.10) on Ubuntu Linux (cloudbytes.dev)

Thank you this worked for me very well until I started hit a snag when now try to ran bench setup production (username) : I am getting an error associated with python3-apt, let me paste the error below

TASK [fail2ban : Install fail2ban] *****************************************************************************************************************************
task path: /usr/local/lib/python3.10/dist-packages/bench/playbooks/roles/fail2ban/tasks/main.yml:6
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: root
<127.0.0.1> EXEC /bin/sh -c ‘echo ~root && sleep 0’
<127.0.0.1> EXEC /bin/sh -c ‘( umask 77 && mkdir -p “echo /root/.ansible/tmp”&& mkdir “echo /root/.ansible/tmp/ansible-tmp-1658325828.2886786-1834-7555114602888” && echo ansible-tmp-1658325828.2886786-1834-7555114602888=“echo /root/.ansible/tmp/ansible-tmp-1658325828.2886786-1834-7555114602888” ) && sleep 0’
Using module file /usr/local/lib/python3.10/dist-packages/ansible/modules/apt.py
<127.0.0.1> PUT /root/.ansible/tmp/ansible-local-1773cnt95zto/tmpf8oz70cl TO /root/.ansible/tmp/ansible-tmp-1658325828.2886786-1834-7555114602888/AnsiballZ_apt.py
<127.0.0.1> EXEC /bin/sh -c ‘chmod u+x /root/.ansible/tmp/ansible-tmp-1658325828.2886786-1834-7555114602888/ /root/.ansible/tmp/ansible-tmp-1658325828.2886786-1834-7555114602888/AnsiballZ_apt.py && sleep 0’
<127.0.0.1> EXEC /bin/sh -c ‘/usr/bin/python3.10 /root/.ansible/tmp/ansible-tmp-1658325828.2886786-1834-7555114602888/AnsiballZ_apt.py && sleep 0’
<127.0.0.1> EXEC /bin/sh -c ‘rm -f -r /root/.ansible/tmp/ansible-tmp-1658325828.2886786-1834-7555114602888/ > /dev/null 2>&1 && sleep 0’
[WARNING]: Updating cache and auto-installing missing dependency: python3-apt
fatal: [localhost]: FAILED! => {
“changed”: false,
“invocation”: {
“module_args”: {
“allow_change_held_packages”: false,
“allow_downgrade”: false,
“allow_unauthenticated”: false,
“autoclean”: false,
“autoremove”: false,
“cache_valid_time”: 0,
“clean”: false,
“deb”: null,
“default_release”: null,
“dpkg_options”: “force-confdef,force-confold”,
“fail_on_autoremove”: false,
“force”: false,
“force_apt_get”: false,
“install_recommends”: null,
“lock_timeout”: 60,
“name”: “fail2ban”,
“only_upgrade”: false,
“package”: [
“fail2ban”
],
“policy_rc_d”: null,
“purge”: false,
“state”: “present”,
“update_cache”: null,
“update_cache_retries”: 5,
“update_cache_retry_max_delay”: 12,
“upgrade”: “no”
}
},
“msg”: “python3-apt must be installed and visible from /usr/bin/python3.10.”
}

PLAY RECAP *****************************************************************************************************************************************************
localhost : ok=1 changed=0 unreachable=0 failed=1 skipped=1 rescued=0 ignored=0

ERROR: Command ‘[‘ansible-playbook’, ‘-c’, ‘local’, ‘site.yml’, ‘-vvvv’, ‘-e’, ‘{“production”: true, “admin_emails”: “”, “mysql_root_password”: null, “container”: false}’, ‘-t’, ‘fail2ban’]’ returned non-zero exit status 2.
Traceback (most recent call last):
File “/usr/local/bin/bench”, line 8, in
sys.exit(cli())
File “/usr/local/lib/python3.10/dist-packages/bench/cli.py”, line 121, in cli
raise e
File “/usr/local/lib/python3.10/dist-packages/bench/cli.py”, line 111, in cli
bench_command()
File “/usr/local/lib/python3.10/dist-packages/click/core.py”, line 1130, in call
return self.main(*args, **kwargs)
File “/usr/local/lib/python3.10/dist-packages/click/core.py”, line 1055, in main
rv = self.invoke(ctx)
File “/usr/local/lib/python3.10/dist-packages/click/core.py”, line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/local/lib/python3.10/dist-packages/click/core.py”, line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/local/lib/python3.10/dist-packages/click/core.py”, line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/local/lib/python3.10/dist-packages/click/core.py”, line 760, in invoke
return __callback(*args, **kwargs)
File “/usr/local/lib/python3.10/dist-packages/bench/commands/setup.py”, line 273, in setup_roles
run_playbook(“site.yml”, extra_vars=extra_vars, tag=role)
File “/usr/local/lib/python3.10/dist-packages/bench/utils/init.py”, line 322, in run_playbook
subprocess.check_call(args, cwd=os.path.join(bench.path[0], “playbooks”))
File “/usr/lib/python3.10/subprocess.py”, line 369, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command ‘[‘ansible-playbook’, ‘-c’, ‘local’, ‘site.yml’, ‘-vvvv’, ‘-e’, ‘{“production”: true, “admin_emails”: “”, “mysql_root_password”: null, “container”: false}’, ‘-t’, ‘fail2ban’]’ returned non-zero exit status 2.
ERROR:
Traceback (most recent call last):
File “/usr/local/bin/bench”, line 8, in
sys.exit(cli())
File “/usr/local/lib/python3.10/dist-packages/bench/cli.py”, line 121, in cli
raise e
File “/usr/local/lib/python3.10/dist-packages/bench/cli.py”, line 111, in cli
bench_command()
File “/usr/local/lib/python3.10/dist-packages/click/core.py”, line 1130, in call
return self.main(*args, **kwargs)
File “/usr/local/lib/python3.10/dist-packages/click/core.py”, line 1055, in main
rv = self.invoke(ctx)
File “/usr/local/lib/python3.10/dist-packages/click/core.py”, line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/local/lib/python3.10/dist-packages/click/core.py”, line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/local/lib/python3.10/dist-packages/click/core.py”, line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/local/lib/python3.10/dist-packages/click/core.py”, line 760, in invoke
return __callback(*args, **kwargs)
File “/usr/local/lib/python3.10/dist-packages/bench/commands/setup.py”, line 72, in setup_production
setup_production(user=user, yes=yes)
File “/usr/local/lib/python3.10/dist-packages/bench/config/production_setup.py”, line 33, in setup_production
setup_production_prerequisites()
File “/usr/local/lib/python3.10/dist-packages/bench/config/production_setup.py”, line 24, in setup_production_prerequisites
exec_cmd(“bench setup role fail2ban”)
File “/usr/local/lib/python3.10/dist-packages/bench/utils/init.py”, line 153, in exec_cmd
raise CommandFailedError
bench.exceptions.CommandFailedError

I have tried to follow other solutions on the net like

cd /usr/lib/python3/dist-packages

and pasting these two;

sudo ln -s apt_inst.cpython-38m-x86_64-linux-gnu.so apt_inst.so
sudo ln -s apt_pkg.cpython-38m-x86_64-linux-gnu.so apt_pkg.so

since am not sure what version 3.10 uses for these files i left them as for version 3.8

I also did the same on this route

/usr/local/lib/python3.10/dist-packages

Am still getting the same error not sure if you had success. Am using ubuntu 20.04LTS , am considering reinstalling the OS and try again

Hi,

If you decide to start with a fresh OS , consider Ubuntu 22.04 LTS as it has python3.10 as default. That might make things easier.

Thank you let try that will get back

I have managed to get to work thank you for your assistance. This made me document each every step which am going to post, maybe it will help someone in similar situation

I think python 3.9 need to be supported since Debian and one of the RPM based distro Stream has python install defaults with this version. There are upgrade install using tarballs for pyhton version 3.10 but that is another story.

Hi, can you send the step by step instruction to install ERPNext version 14 (stable) on ubuntu 20.04 or 22.04?

You can consider checking this

I am getting started with Frappe Framework, But I am getting this error. Does anybody know how to fix it.

Hi @blaiseAI,

If you installing version 14 then apply it.

bench init frappe-bench --frappe-path https://github.com/frappe/frappe --frappe-branch version-14 --python python3.10
2 Likes

Thanks you, I will bookmark this manual option. I had tried using Docker and I think I prefer that way as I don’t run into dependency issues.