PackageNotFound Error during installation on EC2

Hello all
I am getting an error “PackageNotFoundError(name)\nimportlib.metadata.PackageNotFoundError: frappe-bench” while installing ERPNext 13 on an EC2 instance. Please help me resolve.

The whole error message during the task “bench : python3 bench init for production” is given below. I have successfully installed ERPNext on different servers. This is the first time that I am seeing this message.

TASK [bench : python3 bench init for production] *******************************
task path: /tmp/.bench/bench/playbooks/roles/bench/tasks/main.yml:44
<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 /var/tmp `"&& mkdir /var/tmp/ansible-tmp-1640848637.4078014-45449-185293659464339 && echo ansible-tmp-1640848637.4078014-45449-185293659464339="` echo /var/tmp/ansible-tmp-1640848637.4078014-45449-185293659464339 `" ) && sleep 0'
Using module file /usr/local/lib/python3.8/dist-packages/ansible/modules/commands/command.py
<127.0.0.1> PUT /root/.ansible/tmp/ansible-local-422171ew7skyg/tmp_6528azz TO /var/tmp/ansible-tmp-1640848637.4078014-45449-185293659464339/AnsiballZ_command.py
<127.0.0.1> EXEC /bin/sh -c 'setfacl -m u:ubuntu:r-x /var/tmp/ansible-tmp-1640848637.4078014-45449-185293659464339/ /var/tmp/ansible-tmp-1640848637.4078014-45449-185293659464339/AnsiballZ_command.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'chmod u+x /var/tmp/ansible-tmp-1640848637.4078014-45449-185293659464339/ /var/tmp/ansible-tmp-1640848637.4078014-45449-185293659464339/AnsiballZ_command.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'chown ubuntu /var/tmp/ansible-tmp-1640848637.4078014-45449-185293659464339/ /var/tmp/ansible-tmp-1640848637.4078014-45449-185293659464339/AnsiballZ_command.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'sudo -H -S -n  -u ubuntu /bin/sh -c '"'"'echo BECOME-SUCCESS-adtuxoadsfqhkbmldrfkormokjugewyi ; /usr/bin/python3 /var/tmp/ansible-tmp-1640848637.4078014-45449-185293659464339/AnsiballZ_command.py'"'"' && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /var/tmp/ansible-tmp-1640848637.4078014-45449-185293659464339/ > /dev/null 2>&1 && sleep 0'
fatal: [localhost]: FAILED! => {
    "changed": true,
    "cmd": [
        "bench",
        "init",
        "/home/ubuntu/frappe-bench",
        "--frappe-path",
        "https://github.com/frappe/frappe",
        "--frappe-branch",
        "version-13",
        "--python",
        "python3"
    ],
    "delta": "0:00:00.258755",
    "end": "2021-12-30 12:47:17.864485",
    "invocation": {
        "module_args": {
            "_raw_params": "bench init /home/ubuntu/frappe-bench --frappe-path https://github.com/frappe/frappe --frappe-branch version-13 --python python3",
            "_uses_shell": false,
            "argv": null,
            "chdir": null,
            "creates": "/home/ubuntu/frappe-bench",
            "executable": null,
            "removes": null,
            "stdin": null,
            "stdin_add_newline": true,
            "strip_empty_ends": true,
            "warn": true
        }
    },
    "msg": "non-zero return code",
    "rc": 1,
    "start": "2021-12-30 12:47:17.605730",
    "stderr": "Traceback (most recent call last):\n  File \"/usr/bin/bench\", line 33, in <module>\n    sys.exit(load_entry_point('frappe-bench', 'console_scripts', 'bench')())\n  File \"/usr/bin/bench\", line 22, in importlib_load_entry_point\n    for entry_point in distribution(dist_name).entry_points\n  File \"/usr/lib/python3.8/importlib/metadata.py\", line 503, in distribution\n    return Distribution.from_name(distribution_name)\n  File \"/usr/lib/python3.8/importlib/metadata.py\", line 177, in from_name\n    raise PackageNotFoundError(name)\nimportlib.metadata.PackageNotFoundError: frappe-bench",
    "stderr_lines": [
        "Traceback (most recent call last):",
        "  File \"/usr/bin/bench\", line 33, in <module>",
        "    sys.exit(load_entry_point('frappe-bench', 'console_scripts', 'bench')())",
        "  File \"/usr/bin/bench\", line 22, in importlib_load_entry_point",
        "    for entry_point in distribution(dist_name).entry_points",
        "  File \"/usr/lib/python3.8/importlib/metadata.py\", line 503, in distribution",
        "    return Distribution.from_name(distribution_name)",
        "  File \"/usr/lib/python3.8/importlib/metadata.py\", line 177, in from_name",
        "    raise PackageNotFoundError(name)",
        "importlib.metadata.PackageNotFoundError: frappe-bench"
    ],
    "stdout": "",
    "stdout_lines": []
}

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

Traceback (most recent call last):
  File "install.py", line 500, in <module>
    install_bench(args)
  File "install.py", line 281, in install_bench
    run_playbook('site.yml', sudo=True, extra_vars=extra_vars)
  File "install.py", line 416, in run_playbook
    success = subprocess.check_call(args, cwd=playbooks_folder, stdout=log_stream, stderr=sys.stderr)
  File "/usr/lib/python3.8/subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['ansible-playbook', '-c', 'local', 'site.yml', '-vvvv', '-e', '@/tmp/extra_vars.json', '--become', '--become-user=ubuntu']' returned non-zero exit status 2.

Please check below link.

https://github.com/frappe/bench/issues/1240

4 Likes

Thank you so much. It works.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.