Unable to install ERPNext on Ubuntu 18.04

Hi, I am unable to install erpnext on my HP laptop (i7) , I have tried on another laptop (i5),

sudo python3 install.py --production


pip3 already installed!
Checking System Compatibility...
ubuntu 18 is compatible!
Not cloning already existing Bench repository at /tmp/.bench
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that
the implicit localhost does not match 'all'
Input MySQL and Frappe Administrator passwords:
Passwords saved at ~/passwords.txt
Initializing bench frappe-bench:
	Frappe Branch: version-13
	ERPNext Branch: version-13
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that
the implicit localhost does not match 'all'
Traceback (most recent call last):
  File "install.py", line 497, in <module>
    install_bench(args)
  File "install.py", line 278, in install_bench
    run_playbook('site.yml', sudo=True, extra_vars=extra_vars)
  File "install.py", line 413, in run_playbook
    success = subprocess.check_call(args, cwd=playbooks_folder, stdout=log_stream, stderr=sys.stderr)
  File "/usr/lib/python3.6/subprocess.py", line 311, 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=frappe']' returned non-zero exit status 2.

Try running these commands and run the install script again:

sudo apt-get install curl
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt-get install -y nodejs

That used to do the trick for me, but for the last week or so, it’s still failing with the same error you reported.

You need to switch over to Manual install to make progress. Check if all the dependencies are installed (they should by the time you encounter the error) and you may just need to install bench, init bench and complete the commands.

Hope this helps.

Thanks

Jay

I got the same error message using instally.py script few days ago. Tried the manual method and got errors but got it to work some how fixing them. Most likely the issue is with ansible.

I tried the following and fixed it.

sudo python3 -m pip install --upgrade pip

sudo -H pip install ansible

Always better to install the dependencies manually before using install script in my opinion.

This is not working now.

python3 install.py --production
Logs are saved under /tmp/logs/easy-install__2022-03-17__07-30.log
curl already installed!
wget already installed!
git already installed!
pip3 already installed!
/usr/lib/python3/dist-packages/secretstorage/dhcrypto.py:15: CryptographyDeprecationWarning: int_from_bytes is deprecated, use int.from_bytes instead
  from cryptography.utils import int_from_bytes
/usr/lib/python3/dist-packages/secretstorage/util.py:19: CryptographyDeprecationWarning: int_from_bytes is deprecated, use int.from_bytes instead
  from cryptography.utils import int_from_bytes
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
/usr/lib/python3/dist-packages/secretstorage/dhcrypto.py:15: CryptographyDeprecationWarning: int_from_bytes is deprecated, use int.from_bytes instead
  from cryptography.utils import int_from_bytes
/usr/lib/python3/dist-packages/secretstorage/util.py:19: CryptographyDeprecationWarning: int_from_bytes is deprecated, use int.from_bytes instead
  from cryptography.utils import int_from_bytes
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
pip3 already installed!
Checking System Compatibility...
ubuntu 18 is compatible!
Cloning bench repository branch develop into /tmp/.bench
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
Input MySQL and Frappe Administrator passwords:
Please enter mysql root password: 
Re-enter mysql root password: 
Please enter the default Administrator user password: 
Re-enter Administrator password: 
Passwords saved at ~/passwords.txt
Initializing bench frappe-bench:
        Frappe Branch: version-13
        ERPNext Branch: version-13
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
[WARNING]: Consider using the get_url or uri module rather than running 'curl'.  If you need to use command because get_url or uri is insufficient you can add 'warn: false' to this command task or set
'command_warnings=False' in ansible.cfg to get rid of this message.
Traceback (most recent call last):
  File "install.py", line 497, in <module>
    install_bench(args)
  File "install.py", line 278, in install_bench
    run_playbook('site.yml', sudo=True, extra_vars=extra_vars)
  File "install.py", line 413, in run_playbook
    success = subprocess.check_call(args, cwd=playbooks_folder, stdout=log_stream, stderr=sys.stderr)
  File "/usr/lib/python3.6/subprocess.py", line 311, 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=frappe']' returned non-zero exit status 2.
sudo python3 -m pip install --upgrade pip
/usr/lib/python3/dist-packages/secretstorage/dhcrypto.py:15: CryptographyDeprecationWarning: int_from_bytes is deprecated, use int.from_bytes instead
  from cryptography.utils import int_from_bytes
/usr/lib/python3/dist-packages/secretstorage/util.py:19: CryptographyDeprecationWarning: int_from_bytes is deprecated, use int.from_bytes instead
  from cryptography.utils import int_from_bytes
Requirement already satisfied: pip in /usr/local/lib/python3.6/dist-packages (21.3.1)
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv

Manual installation is not that bad. I installed this 3 times on diff systems without any error. So may be you should try it once.

Which version of ubuntu are you trying to install on?

Ubuntut 18.04

try installing using

sudo python3 install.py --production

If it still fails then try upgrading to python 3.7 and install again.

If this is a new installation it might be better to start with Ubuntu 20.04.4-LTS , python3.8 or higher.

After upgrading to python 3.7

python3 install.py --production
Logs are saved under /tmp/logs/easy-install__2022-03-18__06-52.log
Traceback (most recent call last):
  File "/usr/lib/cnf-update-db", line 8, in <module>
    from CommandNotFound.db.creator import DbCreator
  File "/usr/lib/python3/dist-packages/CommandNotFound/db/creator.py", line 11, in <module>
    import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
E: Problem executing scripts APT::Update::Post-Invoke-Success 'if /usr/bin/test -w /var/lib/command-not-found/ -a -e /usr/lib/cnf-update-db; then /usr/lib/cnf-update-db > /dev/null; fi'
E: Sub-process returned an error code
Traceback (most recent call last):
  File "install.py", line 492, in <module>
    install_prerequisites()
  File "install.py", line 158, in install_prerequisites
    'sudo yum install -y epel-release redhat-lsb-core git python-setuptools python-devel openssl-devel libffi-devel'
  File "install.py", line 143, in run_os_command
    returncode = subprocess.check_call(command, shell=True, stdout=log_stream, stderr=sys.stderr)
  File "/usr/lib/python3.7/subprocess.py", line 363, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'sudo apt-get update' returned non-zero exit status 100.

use the below and see if it resolves the apt_pkg error

sudo update-alternatives --remove-all python3
sudo ln -sf /usr/bin/python3.6 /usr/bin/python3