Python-barcode error while installing with erpnext v14

I’m facing this issue after installing “india-compliance” app


Also tried setting up the new site without any custom app of mine
Python version: 3.10.4
python-barcode 0.13.1
Apps installed : erpnext, payments, hrms and india-compliance
while installation it showed above mention output and after that, it start appearing in almost every bench command.

In addition to the points I already mentioned in the Github issue:

  • Which version of bench are you using?
  • Do you have modifications in frappe or erpnext?
  • Do you see anything in ~/frappe-bench/logs/bench.log?
  • Does bench --help work within your bench directory? If not, does it work outside it?
  • Does bench setup requirements work for you?
  • Bench version 5.14.0
  • Didn’t change anything in any app
  • Everything seems normal in bench.log
  • bench --help worked but it’s not showing frappe framwork commands anymore
  • bench setup requirements gives the following error
~/frappe-bench$ bench setup requirements
$ /home/frappe/frappe-bench/env/bin/python-barcode -m pip install --quiet --upgrade pip
usage: python-barcode [-h] [-v] {create,list} ...
python-barcode: error: argument {create,list}: invalid choice: 'pip' (choose from 'create', 'list')
ERROR: 
Traceback (most recent call last):
  File "/home/frappe/.local/bin/bench", line 8, in <module>
    sys.exit(cli())
  File "/home/frappe/.local/lib/python3.10/site-packages/bench/cli.py", line 127, in cli
    bench_command()
  File "/usr/lib/python3/dist-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/home/frappe/.local/lib/python3.10/site-packages/bench/commands/setup.py", line 228, in setup_requirements
    bench.setup.requirements(apps=apps)
  File "/home/frappe/.local/lib/python3.10/site-packages/bench/utils/render.py", line 105, in wrapper_fn
    return fn(*args, **kwargs)
  File "/home/frappe/.local/lib/python3.10/site-packages/bench/bench.py", line 435, in requirements
    self.pip()
  File "/home/frappe/.local/lib/python3.10/site-packages/bench/utils/render.py", line 126, in wrapper_fn
    return fn(*args, **kwargs)
  File "/home/frappe/.local/lib/python3.10/site-packages/bench/bench.py", line 389, in pip
    return self.run(
  File "/home/frappe/.local/lib/python3.10/site-packages/bench/bench.py", line 47, in run
    return exec_cmd(cmd, cwd=cwd or self.cwd)
  File "/home/frappe/.local/lib/python3.10/site-packages/bench/utils/__init__.py", line 155, in exec_cmd
    raise CommandFailedError
bench.exceptions.CommandFailedError

even tried reinstalling python-barcode package as well still no luck.

Your virtual environment is broken. Primary evidence of that is the Frappe Framework commands are not showing and pip upgrade failed.

You can just setup a new one:

mv env env-old # for backup
python3.10 -m venv env
source env/bin/activate
pip install -e apps/frappe
bench setup requirements

See also:

Tried creating a new environment with both methods and also tried uninstalling india_compliance app but what I observed is once I install python-barcode in the environment (even without india_compliance) bench starts behaving like this.

Can you try installing python barcode v0.14.0 manually?

env/bin/pip install --upgrade python-barcode

Already tried this. Any idea about the second line of the error I shared earlier:

/home/frappe/frappe-bench/env/bin/python-barcode -m pip install --quiet --upgrade pip

it should be python, not python-barcode

Ok that makes a lot of sense :joy:

Tell you what, a simple trick for now might be deleting env/bin/python-barcode - it’s not needed at all.

Can you show me the contents of env/bin?

Bench seems to be getting the wrong python for you:


Removed python-barcode from here and everything worked for now

2 Likes

I will raise a fix to bench shortly. Thanks for reporting this issue!

1 Like

:melting_face: That took my whole day. :confused:
Thanks for the help :slight_smile:

2 Likes
3 Likes

This issue has been fixed in bench v5.14.1

Thanks for the report @Dpk404

2 Likes