ERPNext Conference 2019* ERPNext.com Blog

Cannot run bench command


#1

Hi
I 'm having trouble installing the Erpnext using bench.
I followed all the instuction from The Hitchhiker’s Guide to Installing Frappe on Linux. But I failed at step $ bench --version.

““You should not run this command as root”” How can I get away from this and be able to use “BENCH” ?
I deployed on Digitalocean with Ubuntu 18.04

Thanks


#2

You are logged in as user root - this is not advisable. Rather login as your frappe or erpnext user, and run commands as that user.
You also need to be in the right subdir/folder. Try this… (I assume your user for the ERPNext system is “frappe”)

su frappe
cd ~/frappe-bench
bench version


#3

I added frappe user , but when I run bench version ,it showed following error.

Traceback (most recent call last):
File “/usr/local/bin/bench”, line 6, in
from pkg_resources import load_entry_point
File “/usr/lib/python3/dist-packages/pkg_resources/init.py”, line 3088, in
@_call_aside
File “/usr/lib/python3/dist-packages/pkg_resources/init.py”, line 3072, in _call_aside
f(*args, **kwargs)
File “/usr/lib/python3/dist-packages/pkg_resources/init.py”, line 3101, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File “/usr/lib/python3/dist-packages/pkg_resources/init.py”, line 574, in _build_master
ws.require(requires)
File “/usr/lib/python3/dist-packages/pkg_resources/init.py”, line 892, in require
needed = self.resolve(parse_requirements(requirements))
File “/usr/lib/python3/dist-packages/pkg_resources/init.py”, line 778, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The ‘bench’ distribution was not found and is required by the application


#4

If you have installed as user=root, then the files will be owned (incorrectly) by that user. To fix this, you need to do

sudo chown -R frappe:frappe ~/frappe-bench/*


#5

Still not work.

frappe@ubuntu-s-1vcpu-1gb-sgp1-01:/root$ sudo chown -R frappe:frappe ~/frappe-bench/*
[sudo] password for frappe:
frappe is not in the sudoers file. This incident will be reported.
frappe@ubuntu-s-1vcpu-1gb-sgp1-01:/root$

Maybe, could you advise in the command line interface, how can I install bench as a non root user ? what command do I need to go tru before start git clone and pip install ?


#6

Install bench by following Easy Steps from link


#7

You do have access to the root user, so you can do one of a few things…

  1. chown -R frappe:frappe /home/frappe/frappe-bench/*
  2. As root, edit the /etc/sudoers file and add in the frappe user, and then run the sudo version of this command

I normally do a manual install