Update to v12.3.0 failed on pip3 command


I’m trying to do update today but failed on one of process.

Updating Python libraries…
INFO:bench.utils:./env/bin/pip install -q -U pip
INFO:bench.utils:/opt/frappe-bench/env/bin/pip3 install --user -q -U -r /opt/bench-repo/requirements.txt
ERROR: Can not perform a ‘–user’ install. User site-packages are not visible in this virtualenv.
Traceback (most recent call last):
File “/usr/bin/bench”, line 11, in
load_entry_point(‘bench’, ‘console_scripts’, ‘bench’)()
File “/opt/bench-repo/bench/cli.py”, line 40, in cli
File “/usr/lib/python3.6/site-packages/click/core.py”, line 764, in call
return self.main(*args, **kwargs)
File “/usr/lib/python3.6/site-packages/click/core.py”, line 717, in main
rv = self.invoke(ctx)
File “/usr/lib/python3.6/site-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/lib/python3.6/site-packages/click/core.py”, line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/lib/python3.6/site-packages/click/core.py”, line 555, in invoke
return callback(*args, **kwargs)
File “/opt/bench-repo/bench/commands/update.py”, line 68, in update
_update(pull, patch, build, bench, auto, restart_supervisor, restart_systemd, requirements, no_backup, force=force, reset=reset)
File “/opt/bench-repo/bench/commands/update.py”, line 91, in _update
File “/opt/bench-repo/bench/utils.py”, line 462, in update_requirements
File “/opt/bench-repo/bench/utils.py”, line 448, in update_bench_requirements
install_requirements(user_pip, bench_req_file, user=True)
File “/opt/bench-repo/bench/utils.py”, line 534, in install_requirements
exec_cmd("{pip} install {user_flag} -q -U -r {req_file}".format(pip=pip, user_flag=user_flag, req_file=req_file))
File “/opt/bench-repo/bench/utils.py”, line 173, in exec_cmd
raise CommandFailedError(cmd)
bench.utils.CommandFailedError: /opt/frappe-bench/env/bin/pip3 install --user -q -U -r /opt/bench-repo/requirements.txt
[bench@tc-erpnext-1 frappe-bench]$

If I run pip3 command manually, I got error
ERROR: Can not perform a ‘–user’ install. User site-packages are not visible in this virtualenv.

Please advise.

I’m using 12.x.x right now, BTW.

1 Like


There is a workaround I found which is modify utils.py file in bench-repo/bench folder.
goto line 448, change user=True to user=False
after update finished, change back.

1 Like

For me: This was caused by Gitpod/Ubuntu 20.04.1 setting environment PIP_USER=yes.
The workaround is to export PIP_USER=0

@hendy These seem to be different issues altogether. What @ithelpdesk faced back then was related to how bench managed requirements which has changed a lot since. The code you commented about on GitHub doesn’t exist in the codebase in v5.x