Ubuntu init bench - Permission denied

erpnext@VM-42-254-ubuntu:/opt/erpnext$ bench init erpnext
INFO:bench.utils:virtualenv -q env -p /usr/bin/python3
Already using interpreter /usr/bin/python3
INFO:bench.utils:env/bin/pip -q install --upgrade pip
WARNING: The directory ‘/home/erpnext/.cache/pip/http’ or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.
WARNING: The directory ‘/home/erpnext/.cache/pip’ or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.
INFO:bench.utils:env/bin/pip -q install wheel
WARNING: The directory ‘/home/erpnext/.cache/pip/http’ or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.
WARNING: The directory ‘/home/erpnext/.cache/pip’ or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.
INFO:bench.utils:env/bin/pip -q install six
WARNING: The directory ‘/home/erpnext/.cache/pip/http’ or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.
WARNING: The directory ‘/home/erpnext/.cache/pip’ or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.
INFO:bench.utils:env/bin/pip -q install -e git+https://github.com/frappe/python-pdfkit.git#egg=pdfkit
WARNING: The directory ‘/home/erpnext/.cache/pip/http’ or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.
WARNING: The directory ‘/home/erpnext/.cache/pip’ or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.
INFO:bench.app:getting app frappe
INFO:bench.utils:git clone GitHub - frappe/frappe: Low code web framework for real world applications, in Python and Javascript --depth 1 --origin upstream
Cloning into ‘frappe’…
remote: Enumerating objects: 2603, done.
remote: Counting objects: 100% (2603/2603), done.
remote: Compressing objects: 100% (2449/2449), done.
remote: Total 2603 (delta 370), reused 874 (delta 101), pack-reused 0
Receiving objects: 100% (2603/2603), 12.41 MiB | 405.00 KiB/s, done.
Resolving deltas: 100% (370/370), done.
warning: unable to access ‘/home/erpnext/.config/git/attributes’: Permission denied
installing frappe
INFO:bench.app:installing frappe
INFO:bench.utils:erpnext/env/bin/pip install -q -U -e erpnext/apps/frappe
WARNING: The directory ‘/home/erpnext/.cache/pip/http’ or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.
WARNING: The directory ‘/home/erpnext/.cache/pip’ or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo’s -H flag.
WARNING: Building wheel for bleach-whitelist failed: [Errno 13] Permission denied: ‘/home/erpnext/.cache/pip/wheels/be’
WARNING: Building wheel for email-reply-parser failed: [Errno 13] Permission denied: ‘/home/erpnext/.cache/pip/wheels/d1’
WARNING: Building wheel for future failed: [Errno 13] Permission denied: ‘/home/erpnext/.cache/pip/wheels/8b’
WARNING: Building wheel for google-api-python-client failed: [Errno 13] Permission denied: ‘/home/erpnext/.cache/pip/wheels/b8’
WARNING: Building wheel for html2text failed: [Errno 13] Permission denied: ‘/home/erpnext/.cache/pip/wheels/eb’
WARNING: Building wheel for markdown2 failed: [Errno 13] Permission denied: ‘/home/erpnext/.cache/pip/wheels/e1’
WARNING: Building wheel for maxminddb-geolite2 failed: [Errno 13] Permission denied: ‘/home/erpnext/.cache/pip/wheels/94’
WARNING: Building wheel for openpyxl failed: [Errno 13] Permission denied: ‘/home/erpnext/.cache/pip/wheels/58’
WARNING: Building wheel for PyPDF2 failed: [Errno 13] Permission denied: ‘/home/erpnext/.cache/pip/wheels/53’
WARNING: Building wheel for pypng failed: [Errno 13] Permission denied: ‘/home/erpnext/.cache/pip/wheels/41’
WARNING: Building wheel for PyQRCode failed: [Errno 13] Permission denied: ‘/home/erpnext/.cache/pip/wheels/54’
WARNING: Building wheel for PyYAML failed: [Errno 13] Permission denied: ‘/home/erpnext/.cache/pip/wheels/ad’
WARNING: Building wheel for rauth failed: [Errno 13] Permission denied: ‘/home/erpnext/.cache/pip/wheels/7b’
WARNING: Building wheel for watchdog failed: [Errno 13] Permission denied: ‘/home/erpnext/.cache/pip/wheels/e2’
WARNING: Building wheel for zxcvbn-python failed: [Errno 13] Permission denied: ‘/home/erpnext/.cache/pip/wheels/0d’
WARNING: Building wheel for simplegeneric failed: [Errno 13] Permission denied: ‘/home/erpnext/.cache/pip/wheels/a9’
WARNING: Building wheel for maxminddb failed: [Errno 13] Permission denied: ‘/home/erpnext/.cache/pip/wheels/25’
WARNING: Building wheel for et-xmlfile failed: [Errno 13] Permission denied: ‘/home/erpnext/.cache/pip/wheels/2a’
WARNING: Building wheel for pathtools failed: [Errno 13] Permission denied: ‘/home/erpnext/.cache/pip/wheels/0b’
WARNING: Building wheel for pycparser failed: [Errno 13] Permission denied: ‘/home/erpnext/.cache/pip/wheels/f2’
ERROR: botocore 1.13.34 has requirement python-dateutil<2.8.1,>=2.1; python_version >= “2.7”, but you’ll have python-dateutil 2.8.1 which is incompatible.
Updating node packages…
INFO:bench.utils:yarn install
yarn install v1.21.0
error An unexpected error occurred: “EACCES: permission denied, scandir ‘/home/erpnext/.config/yarn/link’”.
info If you think this is a bug, please open a bug report with the information provided in “/opt/erpnext/erpnext/apps/frappe/yarn-error.log”.
info Visit yarn install | Yarn for documentation about this command.
Traceback (most recent call last):
File “/usr/local/bin/bench”, line 11, in
load_entry_point(‘bench’, ‘console_scripts’, ‘bench’)()
File “/opt/erpnext/bench-repo/bench/cli.py”, line 40, in cli
bench_command()
File “/usr/local/lib/python3.6/dist-packages/click/core.py”, line 764, in call
return self.main(*args, **kwargs)
File “/usr/local/lib/python3.6/dist-packages/click/core.py”, line 717, in main
rv = self.invoke(ctx)
File “/usr/local/lib/python3.6/dist-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/local/lib/python3.6/dist-packages/click/core.py”, line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/local/lib/python3.6/dist-packages/click/core.py”, line 555, in invoke
return callback(*args, **kwargs)
File “/opt/erpnext/bench-repo/bench/commands/make.py”, line 31, in init
python = python)
File “/opt/erpnext/bench-repo/bench/utils.py”, line 84, in init
update_node_packages(bench_path=path)
File “/opt/erpnext/bench-repo/bench/utils.py”, line 456, in update_node_packages
update_yarn_packages(bench_path)
File “/opt/erpnext/bench-repo/bench/utils.py”, line 469, in update_yarn_packages
exec_cmd(‘yarn install’, cwd=app_path)
File “/opt/erpnext/bench-repo/bench/utils.py”, line 161, in exec_cmd
raise CommandFailedError(cmd)
bench.utils.CommandFailedError: yarn install

You can do away with this problem if you try bench init in the home folder instead. Try bench init in /home/erpnext/ folder where your current user has full access.