[Solved] What changed in install.py today?!? Worked this morning, Fails now. (v13.1.1 & v13.2.x)

  • Today I purchased 5 VPS servers all from the same provider.

  • All 5 using identical hardware

  • All 5 apt-get update apt-get upgrade Ubuntu v20.04 at the same time

  • Started installing ERPNext (v13.1.1) using the easy install method (followed these steps from new user):

    export LC_ALL=C.UTF-8

    sudo apt install python3-minimal build-essential python3-setuptools

    wget https://raw.githubusercontent.com/frappe/bench/develop/install.py

    sudo python3 install.py --verbose --production --user erp_jmi --mariadb-version 10.5 --frappe-branch version-13 --erpnext-branch version13

  • The first two installed just fine this morning

  • Went to lunch

  • Came back and started installing the last 3 after lunch

  • All 3 installs failed this afternoon!!!

  • I even tried installing on another VPS Ubunutu 20.04on another provider and it fails also.

Something changed in the install functions while I was out to lunch today. Here is the traceback (identical for all the failed installs):

`<127.0.0.1> EXEC /bin/sh -c ‘rm -f -r /var/tmp/ansible-tmp-1619572702.3654318-65640-49925154946279/ > /dev/null 2>&1 && sleep 0’
fatal: [localhost]: FAILED! => {
“changed”: true,
“cmd”: [
“bench”,
“–site”,
“site1.local”,
“install-app”,
“erpnext”
],
“delta”: “0:00:01.214234”,
“end”: “2021-04-28 03:18:23.935446”,
“invocation”: {
“module_args”: {
“_raw_params”: “bench --site site1.local install-app erpnext”,
“_uses_shell”: false,
“argv”: null,
“chdir”: “/home/erp_jmi/frappe-bench”,
“creates”: null,
“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-04-28 03:18:22.721212”,
“stderr”: “”,
“stderr_lines”: [],
“stdout”: “Could not find app "erpnext"”,
“stdout_lines”: [
“Could not find app "erpnext"”
]
}

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

Traceback (most recent call last):
File “install.py”, line 498, in
install_bench(args)
File “install.py”, line 279, in install_bench
run_playbook(‘site.yml’, sudo=True, extra_vars=extra_vars)
File “install.py”, line 414, 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=bkm_erp’]’ returned non-zero exit status 2.
bkm_erp@v13b:~$`

It appears that the install script could not find the erpnext app when it was time to install it.

Any ideas how to fix this?

BKM

EDIT For some reason when redis installs on the latest Ubuntu 20.04 LTS version it has an altered redis.conf file that causes the error that started this thread. The change actually happened to the redis distro while I was out to lunch that day and when I began installing upon returning all of the errors started.

Many Thanks to @manasan for the hint about how to fix this!!

edit the redis.conf file, search for bind 127.0.0.1 : :1 and change it to just bind 127.0.0.1 then reinstall and it works.

Can you diff out the before v. after lunch downloads? The ansible playbooks maybe?

Possibly…

Where would I find the playbooks in the server after the install and during the install?

If you can tell me that much, I will see if I can get them out to a different location and run the compare.

BKM

TBH I haven’t used the easy install method in some time. See if there’s a ~/bench-repo folder. Also ~/.ansible.

Still failing with the following trace:

fatal: [localhost]: FAILED! => {
    "changed": true,
    "cmd": [
        "bench",
        "--site",
        "site1.local",
        "install-app",
        "erpnext"
    ],
    "delta": "0:00:01.444647",
    "end": "2021-05-02 17:27:14.834357",
    "invocation": {
        "module_args": {
            "_raw_params": "bench --site site1.local install-app erpnext",
            "_uses_shell": false,
            "argv": null,
            "chdir": "/home/erp_jmi/frappe-bench",
            "creates": null,
            "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-05-02 17:27:13.389710",
    "stderr": "",
    "stderr_lines": [],
    "stdout": "Could not find app \"erpnext\"",
    "stdout_lines": [
        "Could not find app \"erpnext\""
    ]
}

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

Traceback (most recent call last):
  File "install.py", line 498, in <module>
    install_bench(args)
  File "install.py", line 279, in install_bench
    run_playbook('site.yml', sudo=True, extra_vars=extra_vars)
  File "install.py", line 414, 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=erp_jmi']' returned non-zero exit status 2.
erp_jmi@v13c:~$

Does anyone know a way around this?!?

BKM

I don’t like install.py anymore.
Hitchhiker is simpler, more stable, and more reliable.

1 Like

Got a link to it?

BKM

1 Like

Skip the python 2 part. The key part is pip3 install frappe-bench.

Tried several passes through the Hitchhiker’s Guide and it fails on the mariadb installation. The error says something about broken packages.

Re-tried and replaced the mariadb v10.3 part with a separate mariadb 10.5 installation and got past the database install portion only to have the nginx part fail at the very end.

Made several passes through the guide and fail at the nginx part. Cannot ever get the site to wake-up using the ip address in the browser address bar. Either get the site not found error or the “Oops Sorry” message.

So… Still looking for a valid installation method.

  • easy install method is broken
  • Hitchhikers Guide is also broken

~BKM

Can you write the sequence of your process? Once you get the sequence right, you will have a fuller and better understanding of how Frappe, ERPNext, and bench work.

Sure… here it is:

  • Start with a fresh Ubuntu 20.04 LTS - VPS cloud server as root user
  • adduser [myuser]
  • usermod -aG sudo [myuser]
  • reboot
  • Login as [myuser]
  • sudo apt-get update
  • sudo apt-get upgrade
  • sudo apt-get install git
  • sudo apt-get install python3-dev python3-setuptools python3-pip wkhtmltopdf
  • sudo apt-get install virtualenv
  • alias python=python3
  • alias pip=pip3
    (MairaDB v10.5 install)
  • sudo apt -y install software-properties-common
  • sudo apt-key adv --fetch keys ‘https://mariadb.org/mariadb_release_signing_key,asc’
  • sudo add-apt-repository ‘deb [arch=amd64] http://mariadb.mirror.globo.tech/repo/10.5/ubuntu focal main’
  • sudo apt update
  • sudo apt install mariadb-server mariadb-client
  • sudo mysql_secure_installation
    Enter current password for root (enter for none): hit enter
    Switch to unix_socket authentication [Y/n] y
    Change the root password? [Y/n] y
    Remove anonymous users? [Y/n] y
    Disallow root login remotely? [Y/n] n
    Remove test database and access to it? [Y/n] y
    Reload privilege tables now? [Y/n] y
  • sudo apt-get install libmysqlclient-dev
  • sudo nano /etc/mysql/my.cnf
    (add the following lines to the file then save)

[mysqld]
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
[mysql]
default-character-set = utf8mb4

  • sudo service mysql restart
  • sudo apt-get install redis-server
  • sudo apt-get install curl
  • curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
  • sudo apt-get install -y nodejs
  • sudo npm install -g yarn
  • sudo pip3 install frappe-bench
  • bench init --frappe-branch version-13 --python /usr/bin/python3 frappe-bench
  • cd frappe-bench
  • bench new-site site1.local
  • bench get-app --branch version-13 erpnext
  • bench --site site1.local install-app erpnext
  • sudo bench setup production [myuser]
  • sudo apt-get install nginx
  • bench setup nginx
  • sudo rm -f /etc/nginx/sites-enabled/*
  • sudo ln -s /home/my_user_id/my_bench_folder/config/nginx.conf /etc/nginx/sites-enabled/frappe.conf
  • sudo service nginx restart

There you have it. My complete list of activities and commands from the Hitchhikers Guide that I used to get this far. Sadly, It does not work.

~BKM

Don’t install virtualenv that is for python2. Python 3 has venv.
Don’t use --python /usr/bin/python3 because the python to be used is in your local venv

Only more reason to distrust the Hitchhikers Guide.

The discrepencies you mentioned are not obvious in the guide. They are just given as the next step, period.

I may try it gain tomorrow, but that does not explain the problem with getting the site to come up in a browser. So, if the virtualenv is in there when it is not needed, then that may explain why the nginx didn’t feel right either. It almost seems like the nginx part should have been installed at the beginning of the process.

Additionally, it is not likely the virtualenv installation affected the ability of nginx to work properly.

BKM

Been there.

Do you assign a valid dns name to your vps setup? You also have to do sudo certbot --nginx to provide ssl.

One thing I do is to bench init for every site I have (I don’t host multiple sites under one bench, even if I the dns_multitenant is on. This allows me to do specific customization for every site.

Hitchhiker is not perfect because the software environment is a moving target. The reason why I prefer to manually install these lines over easy install is sometimes, the ansible of install.py take too long to update to recent versions (like Node which is now ver 14 and 16). When you have the recipe lines - based on Hitchhiker, you can quickly react and tinker.

I do not assign the URL until i have the ERPNext installation working from the ip address. Once it works that far, then I use the bench add-domain command to assign the URL to the erpnext instance. This get recorded in the site_config.json file. Doing it this way lets me change the URL at any time if I need to without having to alter the site itself.

I usually have all the DNS pointers setup immediately after spinning up the VPS. Than way, by the time I am finished with the ERPNext install, all of the worldwide DNS servers are usually updated and working.

I do not worry about ssl certificates until everything else is working. setting up Let’s Encrypt is the last thing I do before adding users and configuring the system for use.

I prefer to use the install.py script because it is “supposed” to be the proper approach according to the frappe github site. So I look for workarounds sometimes, but I still want to use install.py until the frappe team publishes a better way to do the install.

BTW… IT is still not working this morning.

BKM

Hello,

Please check if you have a Python 3.8. For some reason, there are problems installing pandas library in Python 3.8.

If yes, downgrade it to python3.6. Install it using:

sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt install python3.6

Go to your frappe-bench and then

bench migrate-env python3.6
bench setup requirements

Regards,

Ivan

Easier said than done…

When I tried to install it, Ubuntu does not let me because it already has version 3.8.5 installed.

I have no idea how to get around it.

Also, I do not believe that is the cause the install.py script failure. When I go back to the sites that installed properly that morning and look at the python version I also get v3.8.5 so that tells me the python version is NOT the problem.

BKM

BTW… The easy install method is still NOT working this morning. :unamused:

Neither does the Hitchhikers Guide.

So, how are people actually getting v13 installed on fresh Ubuntu 20.04 LTS servers?

BKM

Spun a VPS with 18.04 ran the easy install instructons from :
GitHub - frappe/bench: CLI to manage Multi-tenant deployments for Frappe apps and
https://github.com/frappe/bench/blob/develop/docs/easy_install.md
Get Error :
Passwords saved at ~/passwords.txt
Initializing bench frappe-bench:
Frappe Branch: version-12
ERPNext Branch: version-12
[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]: Updating cache and auto-installing missing dependency: python3-apt
[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 498, in
install_bench(args)
File “install.py”, line 279, in install_bench
run_playbook(‘site.yml’, sudo=True, extra_vars=extra_vars)
File “install.py”, line 414, 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=erpnxtadmin’]’ returned non-zero exit status 2.