ERPNext Conference 2019* ERPNext.com Blog

'bench' command not found after successful pip install

setup_issues

#1

I successfully installed bench:

$  pip install --user -e bench-master
Obtaining file:///home/sales/Downloads/bench-master
Collecting Click (from bench==4.1.0)
  Downloading click-6.7-py2.py3-none-any.whl (71kB)
    100% |████████████████████████████████| 71kB 2.3MB/s 
Requirement already satisfied: jinja2 in /usr/lib/python3/dist-packages (from bench==4.1.0)
Collecting virtualenv (from bench==4.1.0)
  Downloading virtualenv-15.1.0-py2.py3-none-any.whl (1.8MB)
    100% |████████████████████████████████| 1.8MB 499kB/s 
Requirement already satisfied: requests in /usr/lib/python3/dist-packages (from bench==4.1.0)
Collecting honcho (from bench==4.1.0)
  Downloading honcho-1.0.1-py2.py3-none-any.whl
Requirement already satisfied: psutil in /usr/lib/python3/dist-packages (from bench==4.1.0)
Collecting python-crontab (from bench==4.1.0)
  Downloading python-crontab-2.2.8.tar.gz (40kB)
    100% |████████████████████████████████| 40kB 3.0MB/s 
Collecting semantic_version (from bench==4.1.0)
  Downloading semantic_version-2.6.0-py3-none-any.whl
Collecting GitPython==0.3.2.1 (from bench==4.1.0)
  Downloading GitPython-0.3.2.1.tar.gz (316kB)
    100% |████████████████████████████████| 317kB 1.4MB/s 
Requirement already satisfied: python-dateutil in /usr/lib/python3/dist-packages (from python-crontab->bench==4.1.0)
Collecting gitdb>=0.6.0 (from GitPython==0.3.2.1->bench==4.1.0)
  Downloading gitdb-0.6.4.tar.gz (400kB)
    100% |████████████████████████████████| 409kB 1.3MB/s 
Collecting smmap>=0.8.5 (from gitdb>=0.6.0->GitPython==0.3.2.1->bench==4.1.0)
  Downloading smmap-0.9.0.tar.gz
Building wheels for collected packages: python-crontab, GitPython, gitdb, smmap
  Running setup.py bdist_wheel for python-crontab ... done
  Stored in directory: /home/sales/.cache/pip/wheels/39/8d/2a/2e7687633e7c74bf1477fc6939802001f285c76135ed9e9bb7
  Running setup.py bdist_wheel for GitPython ... done
  Stored in directory: /home/sales/.cache/pip/wheels/7e/aa/2e/fa7cb2a450ae999faa450aa360feb1edee12cd0fb6e0c23f4b
  Running setup.py bdist_wheel for gitdb ... done
  Stored in directory: /home/sales/.cache/pip/wheels/24/af/3c/0dc34fe9f16a057738fe88aee0c794a57755f238c0eaaf70f1
  Running setup.py bdist_wheel for smmap ... done
  Stored in directory: /home/sales/.cache/pip/wheels/f2/8d/a5/d50981a5b89062285700f9aaed87d9ca02f287226f7c0979b2
Successfully built python-crontab GitPython gitdb smmap
Installing collected packages: Click, virtualenv, honcho, python-crontab, semantic-version, smmap, gitdb, GitPython, bench
  Running setup.py develop for bench
Successfully installed Click-6.7 GitPython-0.3.2.1 bench gitdb-0.6.4 honcho-1.0.1 python-crontab-2.2.8 semantic-version-2.6.0 smmap-0.9.0 virtualenv-15.1.0

But running bench command does not yield anything:

$   bench init frappe-bench && cd frappe-bench
No command 'bench' found, did you mean:
 Command 'dbench' from package 'dbench' (universe)
 Command 'tbench' from package 'dbench' (universe)
bench: command not found`

My system is Ubuntu 17.10, I wanted to use install.py script, but it supports “Ubuntu 16” only, whether 16.06 or .10 is unclear.


#2

Do you have ~/.local/bin in your path?

What is the output of

echo $PATH

#3

I installed bench successfully but NONE OF Bench commands working …

Traceback (most recent call last):
File “/bin/bench”, line 6, in
from pkg_resources import load_entry_point
File “/usr/lib/python2.7/site-packages/pkg_resources/init.py”, line 3195, in
@_call_aside
File “/usr/lib/python2.7/site-packages/pkg_resources/init.py”, line 3179, in _call_aside
f(*args, **kwargs)
File “/usr/lib/python2.7/site-packages/pkg_resources/init.py”, line 3208, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File “/usr/lib/python2.7/site-packages/pkg_resources/init.py”, line 683, in _build_master
return cls._build_from_requirements(requires)
File “/usr/lib/python2.7/site-packages/pkg_resources/init.py”, line 696, in _build_from_requirements
dists = ws.resolve(reqs, Environment())
File “/usr/lib/python2.7/site-packages/pkg_resources/init.py”, line 885, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The ‘GitPython==0.3.2.1’ distribution was not found and is required by bench


#4

echo “export PATH=’$HOMEPATH/.local/bin:$PATH’” >> ~/.bashrc

Reset your shell or open a new one and try again. I see you’ve installed bench for the user only.


I cannot install a custom app because of this error
#5
$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

I do not. Documentation should clarify this point, I think.


#7

After pip installation finished. Logout and then log in again so the path gets updated properly. It will work fine then.

Check whether Bench has been installed correctly (you may wish to log out and log back into your terminal before this step, as this will refresh your environment variable, adding ~/.local/bin to your path if it not already there)