Guide: Manual Install ERPNext on Ubuntu 17.xx & 18.xx

I’ll add that I had to apt-get install python3-distutils because I was getting this:

bench@localhost:~$ bench init erpnext && cd erpnext

INFO:bench.utils:virtualenv -q env -p /usr/bin/python3
Traceback (most recent call last):
File “/usr/local/lib/python2.7/dist-packages/virtualenv.py”, line 24, in
import distutils.spawn
ModuleNotFoundError: No module named ‘distutils.spawn’
Traceback (most recent call last):
File “/usr/local/bin/bench”, line 11, in
load_entry_point(‘bench’, ‘console_scripts’, ‘bench’)()
File “/opt/bench/bench-repo/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 “/opt/bench/bench-repo/bench/commands/make.py”, line 31, in init
python = python)
File “/opt/bench/bench-repo/bench/utils.py”, line 65, in init
setup_env(bench_path=path, python = python)
File “/opt/bench/bench-repo/bench/utils.py”, line 178, in setup_env
exec_cmd(‘virtualenv -q {} -p {}’.format(‘env’, python), cwd=bench_path)
File “/opt/bench/bench-repo/bench/utils.py”, line 161, in exec_cmd
raise CommandFailedError(cmd)
bench.utils.CommandFailedError: virtualenv -q env -p /usr/bin/python3

However now after bench init erpnext && cd erpnext
I’m getting

INFO:bench.app:getting app frappe
INFO:bench.utils:git clone https://github.com/frappe/frappe.git   --origin upstream
Cloning into 'frappe'...
remote: Enumerating objects: 10, done.
remote: Counting objects: 100% (10/10), done.
remote: Compressing objects: 100% (10/10), done.
remote: Total 186444 (delta 1), reused 1 (delta 0), pack-reused 186434
Receiving objects: 100% (186444/186444), 205.08 MiB | 11.71 MiB/s, done.
Resolving deltas: 100% (142852/142852), done.
installing frappe
INFO:bench.app:installing frappe
INFO:bench.utils:erpnext/env/bin/pip install -q  -e erpnext/apps/frappe
WARNING: The directory '/opt/bench/.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 '/opt/bench/.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 markdown2 failed: [Errno 13] Permission denied: '/opt/bench/.cache/pip/wheels/07'
  WARNING: Building wheel for maxminddb-geolite2 failed: [Errno 13] Permission denied: '/opt/bench/.cache/pip/wheels/94'
  WARNING: Building wheel for rauth failed: [Errno 13] Permission denied: '/opt/bench/.cache/pip/wheels/7b'
  WARNING: Building wheel for html2text failed: [Errno 13] Permission denied: '/opt/bench/.cache/pip/wheels/eb'
  WARNING: Building wheel for email-reply-parser failed: [Errno 13] Permission denied: '/opt/bench/.cache/pip/wheels/d1'
  WARNING: Building wheel for watchdog failed: [Errno 13] Permission denied: '/opt/bench/.cache/pip/wheels/e2'
  WARNING: Building wheel for bleach-whitelist failed: [Errno 13] Permission denied: '/opt/bench/.cache/pip/wheels/be'
  WARNING: Building wheel for zxcvbn-python failed: [Errno 13] Permission denied: '/opt/bench/.cache/pip/wheels/0d'
  WARNING: Building wheel for PyPDF2 failed: [Errno 13] Permission denied: '/opt/bench/.cache/pip/wheels/53'
  WARNING: Building wheel for openpyxl failed: [Errno 13] Permission denied: '/opt/bench/.cache/pip/wheels/82'
  WARNING: Building wheel for pyqrcode failed: [Errno 13] Permission denied: '/opt/bench/.cache/pip/wheels/54'
  WARNING: Building wheel for pypng failed: [Errno 13] Permission denied: '/opt/bench/.cache/pip/wheels/41'
  WARNING: Building wheel for googlemaps failed: [Errno 13] Permission denied: '/opt/bench/.cache/pip/wheels/3c'
  WARNING: Building wheel for future failed: [Errno 13] Permission denied: '/opt/bench/.cache/pip/wheels/0c'
  WARNING: Building wheel for maxminddb failed: [Errno 13] Permission denied: '/opt/bench/.cache/pip/wheels/58'
  WARNING: Building wheel for backcall failed: [Errno 13] Permission denied: '/opt/bench/.cache/pip/wheels/98'
  WARNING: Building wheel for PyYAML failed: [Errno 13] Permission denied: '/opt/bench/.cache/pip/wheels/16'
  WARNING: Building wheel for pathtools failed: [Errno 13] Permission denied: '/opt/bench/.cache/pip/wheels/0b'
  WARNING: Building wheel for et-xmlfile failed: [Errno 13] Permission denied: '/opt/bench/.cache/pip/wheels/2a'
  WARNING: Building wheel for pycparser failed: [Errno 13] Permission denied: '/opt/bench/.cache/pip/wheels/f2'
ERROR: frontmatter 3.0.5 has requirement PyYAML==3.13, but you'll have pyyaml 5.1.1 which is incompatible.
Updating node packages...
INFO:bench.utils:yarn install
yarn install v1.17.3
warning Skipping preferred cache folder "/opt/bench/.cache/yarn" because it is not writable.
warning Selected the next writable cache folder in the list, will be "/tmp/.yarn-cache-1000".
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning " > bootstrap@4.3.1" has unmet peer dependency "jquery@1.9.1 - 3".
warning " > bootstrap@4.3.1" has unmet peer dependency "popper.js@^1.14.7".
[4/4] Building fresh packages...
[1/2] ⠈ cypress
error /opt/bench/erpnext/apps/frappe/node_modules/cypress: Command failed.
Exit code: 1
Command: node index.js --exec install
Arguments:
Directory: /opt/bench/erpnext/apps/frappe/node_modules/cypress
Output:
Cypress cannot write to the cache directory due to file permissions
----------

Failed to access /opt/bench/.cache/Cypress:

EACCES: permission denied, mkdir '/opt/bench/.cache/Cypress'
----------

Platform: linux (Ubuntu Linux - 18.04)
Cypress Version: 3.1.5

Traceback (most recent call last):
  File "/usr/local/bin/bench", line 11, in <module>
load_entry_point('bench', 'console_scripts', 'bench')()
  File "/opt/bench/bench-repo/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 "/opt/bench/bench-repo/bench/commands/make.py", line 31, in init
python               = python)
  File "/opt/bench/bench-repo/bench/utils.py", line 84, in init
update_node_packages(bench_path=path)
  File "/opt/bench/bench-repo/bench/utils.py", line 454, in update_node_packages
update_yarn_packages(bench_path)
  File "/opt/bench/bench-repo/bench/utils.py", line 467, in update_yarn_packages
exec_cmd('yarn install', cwd=app_path)
  File "/opt/bench/bench-repo/bench/utils.py", line 161, in exec_cmd
raise CommandFailedError(cmd)
bench.utils.CommandFailedError: yarn install

Is there an update to this guide?

Please help my eyes:

  • edit your comment
  • select all error lines
  • hit the “</>” symbol in the editor
  • save

This will format it in a way that people can read. Thanks! :slight_smile:

Done sorry… thought I did that :stuck_out_tongue:

I’m trying to go through the whole process again… =[

1 Like

Looks like you don’t have the necessary permissions.

Try

cd /opt/bench
# own your home directory
chown -cR bench:bench /opt/bench
# correct file permissions
find . -type f -exec chmod 0644 {} \;
# correct folder permissions
find . -type d -exec chmod 0755 {} \;