How to update bench 5.0 to 5.x?

Hi, I have ERPNext from v8, migrated to v11 in 2018, and to v12 in 2019. I am having issue on lets encrypt and may want to migrate to v13, so I want to make everything up to date.
Now my bench is stuck on version 5.0.0

frappe@localhost:~/frappe-bench$ bench --version
5.0.0

I tried to install bench using pip install frappe-bench using frappe user but no result.
as mentioned on the bench v5.0 release note I have to remove any editable install, but I don’t find any guide to remove bench.

Is there a guide to update bench from 5.0 to 5.x?

Here is install from pip console:

frappe@localhost:~/frappe-bench$ pip3 install --upgrade frappe-bench
Collecting frappe-bench
  Using cached https://files.pythonhosted.org/packages/77/83/0ffeb23c4871102f1c42a41751b269a761b090b86cd6c0d1e6308e91efd2/frappe_bench-5.5.0-py2.py3-none-any.whl
Collecting Jinja2==2.11.3 (from frappe-bench)
  Using cached https://files.pythonhosted.org/packages/7e/c2/1eece8c95ddbc9b1aeb64f5783a9e07a286de42191b7204d67b7496ddf35/Jinja2-2.11.3-py2.py3-none-any.whl
Collecting requests==2.22.0 (from frappe-bench)
  Using cached https://files.pythonhosted.org/packages/51/bd/23c926cd341ea6b7dd0b2a00aba99ae0f828be89d72b2190f27c11d4b7fb/requests-2.22.0-py2.py3-none-any.whl
Collecting Click==7.0 (from frappe-bench)
  Using cached https://files.pythonhosted.org/packages/fa/37/45185cb5abbc30d7257104c434fe0b07e5a195a6847506c074527aa599ec/Click-7.0-py2.py3-none-any.whl
Collecting honcho==1.0.1 (from frappe-bench)
  Using cached https://files.pythonhosted.org/packages/12/c2/95faf9e062e37f50fb685972692395bef019a554c08447282a81e35bf031/honcho-1.0.1-py2.py3-none-any.whl
Collecting setuptools (from frappe-bench)
  Using cached https://files.pythonhosted.org/packages/bd/25/5bdf7f1adeebd4e3fa76b2e2f045ae53ee208e40a4231ad0f0c3007e4353/setuptools-57.4.0-py3-none-any.whl
Collecting GitPython==2.1.15 (from frappe-bench)
  Using cached https://files.pythonhosted.org/packages/7a/c9/6e1aec0893efe66f407d2e14a3daba73dbb39bbeeb72142b037c4a224d40/GitPython-2.1.15-py2.py3-none-any.whl
Collecting python-crontab==2.4.0 (from frappe-bench)
Collecting virtualenv (from frappe-bench)
  Using cached https://files.pythonhosted.org/packages/ab/9f/a0d49dcde93f27125f011f8ce60f86840bc69c95695ed8ed2d77adb2cb8c/virtualenv-20.7.2-py2.py3-none-any.whl
Collecting semantic-version==2.8.2 (from frappe-bench)
  Using cached https://files.pythonhosted.org/packages/0f/3b/8fee26649a86c71df159ed0ae7ac5f9ac38829bccd8a7404e116f903929b/semantic_version-2.8.2-py2.py3-none-any.whl
Collecting MarkupSafe>=0.23 (from Jinja2==2.11.3->frappe-bench)
  Using cached https://files.pythonhosted.org/packages/fc/d6/57f9a97e56447a1e340f8574836d3b636e2c14de304943836bd645fa9c7e/MarkupSafe-2.0.1-cp36-cp36m-manylinux1_x86_64.whl
Collecting urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 (from requests==2.22.0->frappe-bench)
  Using cached https://files.pythonhosted.org/packages/56/aa/4ef5aa67a9a62505db124a5cb5262332d1d4153462eb8fd89c9fa41e5d92/urllib3-1.25.11-py2.py3-none-any.whl
Collecting certifi>=2017.4.17 (from requests==2.22.0->frappe-bench)
  Using cached https://files.pythonhosted.org/packages/05/1b/0a0dece0e8aa492a6ec9e4ad2fe366b511558cdc73fd3abc82ba7348e875/certifi-2021.5.30-py2.py3-none-any.whl
Collecting chardet<3.1.0,>=3.0.2 (from requests==2.22.0->frappe-bench)
  Using cached https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl
Collecting idna<2.9,>=2.5 (from requests==2.22.0->frappe-bench)
  Using cached https://files.pythonhosted.org/packages/14/2c/cd551d81dbe15200be1cf41cd03869a46fe7226e7450af7a6545bfc474c9/idna-2.8-py2.py3-none-any.whl
Collecting gitdb2<3,>=2 (from GitPython==2.1.15->frappe-bench)
  Using cached https://files.pythonhosted.org/packages/03/6c/99296f89bad2ef85626e1df9f677acbee8885bb043ad82ad3ed4746d2325/gitdb2-2.0.6-py2.py3-none-any.whl
Collecting python-dateutil (from python-crontab==2.4.0->frappe-bench)
  Using cached https://files.pythonhosted.org/packages/36/7a/87837f39d0296e723bb9b62bbb257d0355c7f6128853c78955f57342a56d/python_dateutil-2.8.2-py2.py3-none-any.whl
Collecting importlib-metadata>=0.12; python_version < "3.8" (from virtualenv->frappe-bench)
  Using cached https://files.pythonhosted.org/packages/c0/72/4512a88e402d4dc3bab49a845130d95ac48936ef3a9469b55cc79a60d84d/importlib_metadata-4.6.4-py3-none-any.whl
Collecting backports.entry-points-selectable>=1.0.4 (from virtualenv->frappe-bench)
  Using cached https://files.pythonhosted.org/packages/0c/cd/1e156227cad9f599524eb10af62a2362f872910a49402dbd2bea2dedc91c/backports.entry_points_selectable-1.1.0-py2.py3-none-any.whl
Collecting distlib<1,>=0.3.1 (from virtualenv->frappe-bench)
  Using cached https://files.pythonhosted.org/packages/87/26/f6a23dd3e578132cf924e0dd5d4e055af0cd4ab43e2a9f10b7568bfb39d9/distlib-0.3.2-py2.py3-none-any.whl
Collecting six<2,>=1.9.0 (from virtualenv->frappe-bench)
  Using cached https://files.pythonhosted.org/packages/d9/5a/e7c31adbe875f2abbb91bd84cf2dc52d792b5a01506781dbcf25c91daf11/six-1.16.0-py2.py3-none-any.whl
Collecting importlib-resources>=1.0; python_version < "3.7" (from virtualenv->frappe-bench)
  Using cached https://files.pythonhosted.org/packages/f2/6c/2f3b930513bb971172ffceb63cf4e910944e57451724e69b1dec97cfefa6/importlib_resources-5.2.2-py3-none-any.whl
Collecting filelock<4,>=3.0.0 (from virtualenv->frappe-bench)
  Using cached https://files.pythonhosted.org/packages/93/83/71a2ee6158bb9f39a90c0dea1637f81d5eef866e188e1971a1b1ab01a35a/filelock-3.0.12-py3-none-any.whl
Collecting platformdirs<3,>=2 (from virtualenv->frappe-bench)
  Using cached https://files.pythonhosted.org/packages/a5/a6/45f6d6b848d7ac273f261b35ed048ea8f301d2ec0594fbcf7616b4012f45/platformdirs-2.2.0-py3-none-any.whl
Collecting smmap2>=2.0.0 (from gitdb2<3,>=2->GitPython==2.1.15->frappe-bench)
  Using cached https://files.pythonhosted.org/packages/3e/11/2dae3df2f19c43e156cce8e02c0080b46821faf816b839a2023ef7b6b84f/smmap2-3.0.1-py3-none-any.whl
Collecting typing-extensions>=3.6.4; python_version < "3.8" (from importlib-metadata>=0.12; python_version < "3.8"->virtualenv->frappe-bench)
  Using cached https://files.pythonhosted.org/packages/2e/35/6c4fff5ab443b57116cb1aad46421fb719bed2825664e8fe77d66d99bcbc/typing_extensions-3.10.0.0-py3-none-any.whl
Collecting zipp>=0.5 (from importlib-metadata>=0.12; python_version < "3.8"->virtualenv->frappe-bench)
  Using cached https://files.pythonhosted.org/packages/92/d9/89f433969fb8dc5b9cbdd4b4deb587720ec1aeb59a020cf15002b9593eef/zipp-3.5.0-py3-none-any.whl
Collecting smmap>=3.0.1 (from smmap2>=2.0.0->gitdb2<3,>=2->GitPython==2.1.15->frappe-bench)
  Using cached https://files.pythonhosted.org/packages/68/ee/d540eb5e5996eb81c26ceffac6ee49041d473bc5125f2aa995cf51ec1cf1/smmap-4.0.0-py2.py3-none-any.whl
Installing collected packages: MarkupSafe, Jinja2, urllib3, certifi, chardet, idna, requests, Click, honcho, setuptools, smmap, smmap2, gitdb2, GitPython, six, python-dateutil, python-crontab, typing-extensions, zipp, importlib-metadata, backports.entry-points-selectable, distlib, importlib-resources, filelock, platformdirs, virtualenv, semantic-version, frappe-bench
Successfully installed Click-7.0 GitPython-2.1.15 Jinja2-2.11.3 MarkupSafe-2.0.1 backports.entry-points-selectable-1.1.0 certifi-2021.5.30 chardet-3.0.4 distlib-0.3.2 filelock-3.0.12 frappe-bench-5.5.0 gitdb2-2.0.6 honcho-1.0.1 idna-2.8 importlib-metadata-4.6.4 importlib-resources-5.2.2 platformdirs-2.2.0 python-crontab-2.4.0 python-dateutil-2.8.2 requests-2.22.0 semantic-version-2.8.2 setuptools-57.4.0 six-1.16.0 smmap-4.0.0 smmap2-3.0.1 typing-extensions-3.10.0.0 urllib3-1.25.11 virtualenv-20.7.2 zipp-3.5.0
frappe@localhost:~/frappe-bench$ bench --version
5.0.0

This is most likely a $PATH issue. You can figure out which version of bench is running by typing which bench. It’s a good bet that you have a second install not under management by pip3.

yes, it is still called from /usr/local/bin/bench

frappe@localhost:~/frappe-bench$ which bench
/usr/local/bin/bench

do you mind to tell me where the PATH is? Also I will highly appreciate on how to change the PATH.

$PATH is a variable that linux systems use to decide execution priorities for different disk locations. You can view it via the command echo $PATH, and it gets created by your shell on login.

/usr/local/bin/bench would be a normal place for pip3 to install. The question is where pip is actually installing. What output do you get from pip3 show frappe-bench?

1 Like

Thank you for quick reply, highly appreciated.
Here is the result

frappe@localhost:~/frappe-bench$ pip3 show frappe-bench
Name: frappe-bench
Version: 5.5.0
Summary: Metadata driven, full-stack web framework
Home-page: UNKNOWN
Author: Frappe Technologies
Author-email: info@frappe.io
License: UNKNOWN
Location: /home/frappe/.local/lib/python3.6/site-packages
Requires: python-crontab, GitPython, honcho, requests, Jinja2, Click, semantic-version, virtualenv, setuptools

and here is echo $PATH

frappe@localhost:~/frappe-bench$  echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

This is one aspect of why manual installs are so challenging. Each distro does things slightly differently, so it’s tough to troubleshoot. It’s worth considering a containerized install if you can.

I don’t have a great understanding of pip or how it manages package paths, but the problem is clear. Your system is setup to run bench globally from /usr, but pip3 is installing it to the user’s /home directory. I would try uninstalling and then reinstalling (via pip). Otherwise, you can always specify the bench path manually. It’s probably something like /home/frappe/.local/bin/bench.

I am completely agree. In my country’s ERPnext community, I already suggested everyone who asked on how to install to use docker container instead of install script/manual install.

You said that you are not expert in $PATH, I hope others can help.

I can run bench from specified location

frappe@localhost:~$ bench --version
WARN: Command not being executed in bench directory
5.0.0
frappe@localhost:~$ ./.local/bin/bench --version
WARN: Command not being executed in bench directory
5.5.0

and I see that I may have to select $PATH from .profile file here

frappe@localhost:~$ cat .profile
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.

# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
	. "$HOME/.bashrc"
    fi
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
    PATH="$HOME/.local/bin:$PATH"
fi

All looks normal, and I can see PATH="$HOME/.local/bin:$PATH" but bench still called from /usr/local/bin/bench

It doesn’t look like the .profile is being read, which is consistent with what the comment says at the top. You could always add your home path to .bash_profile, or just use the full path to invoke bench. It’s hard to say what exactly would be the best practice here, since each distro does things a bit differently (and I’m no expert in any of them).

If I were in your shoes, I’d probably just add my home binary directory to path in .bash_profile.

I have to ssh directly to frappe user, not from other user that su ed to frappe user.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.