Command "python setup.py egg_info" failed with error code 1

When i try to “bench get-app erpnext”, I’m getting this error.

INFO:bench.utils:git clone https://github.com/frappe/erpnext --branch v5.0.29 --depth 1 --origin upstream
Cloning into 'erpnext'...
remote: Counting objects: 1896, done.
remote: Compressing objects: 100% (1606/1606), done.
remote: Total 1896 (delta 450), reused 746 (delta 195), pack-reused 0
Receiving objects: 100% (1896/1896), 5.18 MiB | 5.88 MiB/s, done.
Resolving deltas: 100% (450/450), done.
Checking connectivity... done.
Note: checking out 'd1605c5cb2bd4e3f54fd710567b5d4d7e3ae91fc'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

('installing', u'erpnext')
INFO:bench.app:installing erpnext
INFO:bench.utils:./env/bin/pip install -q  -e ./apps/erpnext --no-cache-dir
INFO:bench.app:getting app foundation
INFO:bench.utils:git clone https://github.com/erpnext/foundation --branch master --depth 1 --origin upstream
Cloning into 'foundation'...
remote: Counting objects: 2948, done.
remote: Compressing objects: 100% (2807/2807), done.
remote: Total 2948 (delta 113), reused 2106 (delta 87), pack-reused 0
Receiving objects: 100% (2948/2948), 253.13 MiB | 12.32 MiB/s, done.
Resolving deltas: 100% (113/113), done.
Checking connectivity... done.
Checking out files: 100% (3836/3836), done.
('installing', u'foundation')
INFO:bench.app:installing foundation
INFO:bench.utils:./env/bin/pip install -q  -e ./apps/foundation --no-cache-dir
Command "python setup.py egg_info" failed with error code 1 in /home/frappe/sampleBench/apps/foundation/
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 11, in <module>
    load_entry_point('bench', 'console_scripts', 'bench')()
  File "/home/frappe/.bench/bench/cli.py", line 40, in cli
    bench_command()
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/.bench/bench/commands/make.py", line 40, in get_app
    get_app(git_url, branch=branch)
  File "/home/frappe/.bench/bench/app.py", line 145, in get_app
    branch= 'master', postprocess = False)
  File "/home/frappe/.bench/bench/app.py", line 135, in get_app
    install_app(app=app_name, bench_path=bench_path, verbose=verbose)
  File "/home/frappe/.bench/bench/app.py", line 179, in install_app
    find_links=find_links))
  File "/home/frappe/.bench/bench/utils.py", line 159, in exec_cmd
    raise CommandFailedError(cmd)
bench.utils.CommandFailedError: ./env/bin/pip install -q  -e ./apps/foundation --no-cache-dir

I can’t figure out the cause of this error. Please help :smiley: thanks in advance :slight_smile:

This notes your case https://howtogit.net/recipes/getting-out-of-detached-head-state.html

with this advice:

In a nutshell: You’re not on a branch right now. You’re browsing a snapshot of your Git files from a specific commit in your history. To get out of detached HEAD state and go back to master, do git checkout master.

BTW I am not a git master so exercise caution

Thank you so much for your reply @clarkej, i switched to production instead of develop so I managed to install a clean bench :smiley: