Install script and V11

$ python install.py --help
usage: install.py [-h] [--develop | --production] [--site SITE]
                  [--without-site] [--verbose] [--user USER]
                  [--bench-branch BENCH_BRANCH] [--repo-url REPO_URL]
                  [--frappe-repo-url FRAPPE_REPO_URL]
                  [--frappe-branch FRAPPE_BRANCH]
                  [--erpnext-repo-url ERPNEXT_REPO_URL]
                  [--erpnext-branch ERPNEXT_BRANCH] [--without-erpnext]
                  [--overwrite] [--mysql-root-password MYSQL_ROOT_PASSWORD]
                  [--admin-password ADMIN_PASSWORD] [--bench-name BENCH_NAME]

Frappe Installer

optional arguments:
  -h, --help            show this help message and exit
  --develop             Install developer setup
  --production          Setup Production environment for bench
  --site SITE           Specifiy name for your first ERPNext site
  --without-site
  --verbose             Run the script in verbose mode
  --user USER           Install frappe-bench for this user
  --bench-branch BENCH_BRANCH
                        Clone a particular branch of bench repository
  --repo-url REPO_URL   Clone bench from the given url
  --frappe-repo-url FRAPPE_REPO_URL
                        Clone frappe from the given url
  --frappe-branch FRAPPE_BRANCH
                        Clone a particular branch of frappe
  --erpnext-repo-url ERPNEXT_REPO_URL
                        Clone erpnext from the given url
  --erpnext-branch ERPNEXT_BRANCH
                        Clone a particular branch of erpnext
  --without-erpnext     Prevent fetching ERPNext
  --overwrite           Whether to overwrite an existing bench
  --mysql-root-password MYSQL_ROOT_PASSWORD
                        Set mysql root password
  --admin-password ADMIN_PASSWORD
                        Set admin password
  --bench-name BENCH_NAME
                        Create bench with specified name. Default name is
                        frappe-bench

2 Likes
  --mysql-root-password MYSQL_ROOT_PASSWORD
                    Set mysql root password
  --admin-password ADMIN_PASSWORD
                     Set admin password

How can I input the password if, for example, it has space or an installation keyword? can I put it between quotations such as --mysql-root-password 'my password'?

thx…
Updated my fresh ubuntu 16 server

sudo bash -c 'for i in update {,dist-}upgrade auto{remove,clean}; do apt-get $i -y; done'

Downloaded the script

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

Used these parameters in the script

sudo python install.py --production --user frappe --bench-branch master --frappe-branch staging --erpnext-branch staging --mysql-root-password PASSWORD --admin-password PASSWORD

With that, my life is easier now, I can just paste it and get back after few minutes

4 Likes

Password in clear-text and without quotes, it will be stored in shell history (bash_history) make sure to clean it up later.

To clear the history, just run any one of the following commands:

history -c
# The above command will clear the entire executed commands in the Terminal.
####### OR
history -cw
# The above command will clear the recently-executed command in the Terminal.
2 Likes

After run your suggested command.

frappe@VBox:~/frappe-bench$ bench version
erpnext 12.x.x-develop
foundation 0.0.1
frappe 11.0.3

Did i miss sth?

Edit:
I downgrade from frappe/erpnext V12

What are you trying to achieve and where are you stuck?

I installed erpnext development which is v12. Then I downgrade to v11 but erpnext still v12. It’s working fine anyways. Just wondering why frappe v11 and erpnext v12

That is quite messy also when you’re caught up migrating to a new environment and your packup is on 10.x :smiley:
Geez…

Maybe confirm the two repos are on the same expected branch - v11 and v12 refer I think to staging and develop so you have a mismatch?

I think erpnext staging and development was the same when I switched Branch from development v12 to staging v11 by command below.

bench switch-to-branch staging frappe erpnext
bench  update --requirements
bench update --patch

Ok but if I’m not mistaken, for example this suggests the branches mismatch

frappe@VBox:~/frappe-bench$ bench version
erpnext 12.x.x-develop
foundation 0.0.1
frappe 11.0.3

Here below both repos are on staging and so V11

(env) frappe@ubuntu:~/frappe-bench$ cd apps/erpnext/
(env) frappe@ubuntu:~/frappe-bench/apps/erpnext$ git status
On branch staging
Your branch is up-to-date with 'upstream/staging'.
nothing to commit, working directory clean
(env) frappe@ubuntu:~/frappe-bench/apps/erpnext$ cd ../frappe/
(env) frappe@ubuntu:~/frappe-bench/apps/frappe$ git status
On branch staging
Your branch is up-to-date with 'upstream/staging'.
(env) frappe@ubuntu:~/frappe-bench/apps/frappe$ cd ../..
(env) frappe@ubuntu:~/frappe-bench$ bench version
erpnext 11.0.3-beta.2
frappe 11.0.0-beta
1 Like

HI, can u please tell why this error is coming … thanks

Hi,

Im also getting an error on a fresh install of Ubuntu 16 virtual machine


TASK [bench : install bench] *********************************************************************************************
changed: [localhost]

TASK [bench : Overwrite bench if required] *******************************************************************************
skipping: [localhost]

TASK [bench : Check whether bench exists] ********************************************************************************
ok: [localhost]

TASK [bench : python3 bench init for develop] ****************************************************************************
skipping: [localhost]

TASK [bench : python2 bench init for production] *************************************************************************
fatal: [localhost]: FAILED! => {"changed": true, "cmd": ["bench", "init", "/home/hemant/frappe-bench", "--frappe-path", "https://github.com/frappe/frappe", "--frappe-branch", "master"], "delta": "0:14:13.765212", "end": "2019-02-01 12:39:17.378529", "msg": "non-zero return code", "rc": 1, "start": "2019-02-01 12:25:03.613317", "stderr": "INFO:bench.utils:virtualenv -q env -p /usr/bin/python\nINFO:bench.utils:env/bin/pip -q install --upgrade pip\nDEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.\nINFO:bench.utils:env/bin/pip -q install wheel\nDEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.\nINFO:bench.utils:env/bin/pip -q install six\nDEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.\nINFO:bench.utils:env/bin/pip -q install -e git+https://github.com/frappe/python-pdfkit.git#egg=pdfkit\nDEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.\nINFO:bench.app:getting app frappe\nINFO:bench.utils:git clone https://github.com/frappe/frappe --branch master  --origin upstream\nCloning into 'frappe'...\nwarning: unable to access '/home/hemant/.config/git/attributes': Permission denied\nINFO:bench.app:installing frappe\nINFO:bench.utils:/home/hemant/frappe-bench/env/bin/pip install -q  -e /home/hemant/frappe-bench/apps/frappe \nDEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.\nINFO:bench.utils:yarn install\nerror An unexpected error occurred: \"EACCES: permission denied, scandir '/home/hemant/.config/yarn/link'\".\nTraceback (most recent call last):\n  File \"/usr/local/bin/bench\", line 11, in <module>\n    load_entry_point('bench', 'console_scripts', 'bench')()\n  File \"/home/hemant/.bench/bench/cli.py\", line 40, in cli\n    bench_command()\n  File \"/usr/local/lib/python2.7/dist-packages/click/core.py\", line 764, in __call__\n    return self.main(*args, **kwargs)\n  File \"/usr/local/lib/python2.7/dist-packages/click/core.py\", line 717, in main\n    rv = self.invoke(ctx)\n  File \"/usr/local/lib/python2.7/dist-packages/click/core.py\", line 1137, in invoke\n    return _process_result(sub_ctx.command.invoke(sub_ctx))\n  File \"/usr/local/lib/python2.7/dist-packages/click/core.py\", line 956, in invoke\n    return ctx.invoke(self.callback, **ctx.params)\n  File \"/usr/local/lib/python2.7/dist-packages/click/core.py\", line 555, in invoke\n    return callback(*args, **kwargs)\n  File \"/home/hemant/.bench/bench/commands/make.py\", line 30, in init\n    python \t\t = python)\n  File \"/home/hemant/.bench/bench/utils.py\", line 83, in init\n    update_node_packages(bench_path=path)\n  File \"/home/hemant/.bench/bench/utils.py\", line 449, in update_node_packages\n    update_yarn_packages(bench_path)\n  File \"/home/hemant/.bench/bench/utils.py\", line 462, in update_yarn_packages\n    exec_cmd('yarn install', cwd=app_path)\n  File \"/home/hemant/.bench/bench/utils.py\", line 159, in exec_cmd\n    raise CommandFailedError(cmd)\nbench.utils.CommandFailedError: yarn install", "stderr_lines": ["INFO:bench.utils:virtualenv -q env -p /usr/bin/python", "INFO:bench.utils:env/bin/pip -q install --upgrade pip", "DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.", "INFO:bench.utils:env/bin/pip -q install wheel", "DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.", "INFO:bench.utils:env/bin/pip -q install six", "DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.", "INFO:bench.utils:env/bin/pip -q install -e git+https://github.com/frappe/python-pdfkit.git#egg=pdfkit", "DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.", "INFO:bench.app:getting app frappe", "INFO:bench.utils:git clone https://github.com/frappe/frappe --branch master  --origin upstream", "Cloning into 'frappe'...", "warning: unable to access '/home/hemant/.config/git/attributes': Permission denied", "INFO:bench.app:installing frappe", "INFO:bench.utils:/home/hemant/frappe-bench/env/bin/pip install -q  -e /home/hemant/frappe-bench/apps/frappe ", "DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.", "INFO:bench.utils:yarn install", "error An unexpected error occurred: \"EACCES: permission denied, scandir '/home/hemant/.config/yarn/link'\".", "Traceback (most recent call last):", "  File \"/usr/local/bin/bench\", line 11, in <module>", "    load_entry_point('bench', 'console_scripts', 'bench')()", "  File \"/home/hemant/.bench/bench/cli.py\", line 40, in cli", "    bench_command()", "  File \"/usr/local/lib/python2.7/dist-packages/click/core.py\", line 764, in __call__", "    return self.main(*args, **kwargs)", "  File \"/usr/local/lib/python2.7/dist-packages/click/core.py\", line 717, in main", "    rv = self.invoke(ctx)", "  File \"/usr/local/lib/python2.7/dist-packages/click/core.py\", line 1137, in invoke", "    return _process_result(sub_ctx.command.invoke(sub_ctx))", "  File \"/usr/local/lib/python2.7/dist-packages/click/core.py\", line 956, in invoke", "    return ctx.invoke(self.callback, **ctx.params)", "  File \"/usr/local/lib/python2.7/dist-packages/click/core.py\", line 555, in invoke", "    return callback(*args, **kwargs)", "  File \"/home/hemant/.bench/bench/commands/make.py\", line 30, in init", "    python \t\t = python)", "  File \"/home/hemant/.bench/bench/utils.py\", line 83, in init", "    update_node_packages(bench_path=path)", "  File \"/home/hemant/.bench/bench/utils.py\", line 449, in update_node_packages", "    update_yarn_packages(bench_path)", "  File \"/home/hemant/.bench/bench/utils.py\", line 462, in update_yarn_packages", "    exec_cmd('yarn install', cwd=app_path)", "  File \"/home/hemant/.bench/bench/utils.py\", line 159, in exec_cmd", "    raise CommandFailedError(cmd)", "bench.utils.CommandFailedError: yarn install"], "stdout": "Already using interpreter /usr/bin/python\nwarning: unable to access '/home/hemant/.config/git/attributes': Permission denied\nyarn install v1.13.0\ninfo If you think this is a bug, please open a bug report with the information provided in \"/home/hemant/frappe-bench/apps/frappe/yarn-error.log\".\ninfo Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.\n('installing', u'frappe')\nUpdating node packages...", "stdout_lines": ["Already using interpreter /usr/bin/python", "warning: unable to access '/home/hemant/.config/git/attributes': Permission denied", "yarn install v1.13.0", "info If you think this is a bug, please open a bug report with the information provided in \"/home/hemant/frappe-bench/apps/frappe/yarn-error.log\".", "info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.", "('installing', u'frappe')", "Updating node packages..."]}
        to retry, use: --limit @/tmp/.bench/playbooks/site.retry

PLAY RECAP ***************************************************************************************************************
localhost                  : ok=68   changed=42   unreachable=0    failed=1

Traceback (most recent call last):
  File "install.py", line 425, in <module>
    install_bench(args)
  File "install.py", line 122, in install_bench
    run_playbook('site.yml', sudo=True, extra_vars=extra_vars)
  File "install.py", line 338, in run_playbook
    success = subprocess.check_call(args, cwd=os.path.join(cwd, 'playbooks'))
  File "/usr/lib/python2.7/subprocess.py", line 541, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['ansible-playbook', '-c', 'local', 'site.yml', '-e', '@/tmp/extra_vars.json', '--become', '--become-user=hemant']' returned non-zero exit status 2
hemant@erpnextdev:~$

Any ideas on how to get v11 fresh install. Unless I get install v10 and upgrade?

Kind regards
Hemant

Are you installing on local machine, VM or VPS? either way this simple unattended has worked for me countless times. I setup and delete test vps instances almost on a daily basis and i have set up 2 already today.

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

sudo python install.py --production --bench-branch master --frappe-branch master --erpnext-branch master --mysql-root-password “password” --admin-password “password”

Note: This is for fresh installs only.
Remember to change the “password” to your password and remove the “” from each side.

1 Like

Im using vmare workstation and created a fresh install on ubuntu on my local windows 10 machine.

Never had issues in the past, just today tried to install v11. Usually I upgrade from the vm I created many moons ago.

Will try again.

kind regards
Hemant

Looks like the easy install script works when leaving out the USER option to the default frappe user, but if I want to install as a specific user that fails. Worked in v10 so not sure if something was missed when trying to install with USER option other then frappe

Hi.

I did clean V11 install on Debian via the install scripts and it worked perfectly… If could be the user.

So for Debian:

Create new user (example user123):
sudo adduser user123

Give sudo permission for user:
sudo usermod -aG sudo user123

Login as user123

Run a quick system update:
sudo apt-get update -y && sudo apt-get upgrade -y

Install python:
sudo apt-get install python-minimal build-essential python-setuptools python-dev build-essential python-setuptools -y

Get the install script:
wget https://raw.githubusercontent.com/frappe/bench/master/playbooks/install.py

sudo python install.py --production --site site.domain.com --user user123 --mysql-root-password mySQLROOTPAssword --admin-password ADMINPassword --bench-name NewBENCHName

Copy and paste exactly and replace the user123, mySQLROOTPAssword, ADMINPassword and NewBenchName with your respective details.

Thanks.

2 Likes

Given that ERPNext 11 is now the official master release. Is the script updated to install ERPNext using Python 3??

No. The install script still installs python 2.7. My best guess is because python 3 still has a few issues or it could just be deliberate as 2.7 still works.

I suppose that yarn is also the cause of the style error on an upgrade to v11. Tried to fix by checking permission problems with .yarn & .npm & also tried to clean cache, and followed the general advice in forum. Unable to track problem down. No particular error in logs. Intermittent error, more particularly if any project is opened then style issue start. On restart fine, until Project form is opened. The default font also is not loaded but replaced by a font appearing to be Roman. Issue appeared on update to 11.1.3.

Any further ideas to troubleshoot?