Facing Error "pkg_resources.DistributionNotFound: The 'bench' distribution was not found and is required by the application"

hi there,

Server is live from last 6 month. But today while starting bench using bench start, i am getting an error pkg_resources.DistributionNotFound: The ‘bench’ distribution was not found and is required by the application.
Now the server is not working. while trying which bench, it says /usr/local/bin/bench
Kindly advise me to solve this problem??

Try doing this :

sudo pip install -e ~/.bench or sudo pip install -e ~./frappe-bench

Question :

Why are you doing bench start on your server? That is only for development.

1 Like

thanks @vjFaLk, actually one of my colleague did this by mistake.

any solution for this problem i am facing same problem in cent os 7.

On a recent system, I used

pip install --user -e bench-repo

instead of

sudo pip install -e bench-repo

and had the same problem as you. It seems you need the sudo to make it work properly

Just do,

sudo -H pip install -e /home/then_your_path

~home/frappe/frappe-bench$ bench version
    Traceback (most recent call last):
      File "/usr/local/bin/bench", line 6, in <module>
        from pkg_resources import load_entry_point
      File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3123, in <module>
        @_call_aside
      File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3107, in _call_aside
        f(*args, **kwargs)
      File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3136, in _initialize_master_working_set
        working_set = WorkingSet._build_master()
      File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 578, in _build_master
        ws.require(__requires__)
      File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 895, in require
        needed = self.resolve(parse_requirements(requirements))
      File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 781, in resolve
        raise DistributionNotFound(req, requirers)
    pkg_resources.DistributionNotFound: The 'bench' distribution was not found and is required by the application

Hi, I’m facing this problem and I can’t seem to resolve this. My site is running just fine. I’m not sure what did I do wrong! I’ve tried few commands; but nothing is working for executing bench command.

Thanks

Try

pip3 install -e bench-repo

I have the same problem but when i use the command “pip3 install -e bench-repo” i still get another error
ERROR: bench-repo is not a valid editable requirement. It should either be a path to a local project or a VCS URL (beginning with svn+, git+, hg+, or bzr+).

I installed erpnext from google cloud marketplace, do i have to first clone the git repo be fore i run the install command?

I was facing the same issue of DistributionNotFound. I started a tmux session and it was working fine.

Are you starting the application in frappe bench directory?