being on bench version 5.0 currently (where 5.3 is the latest version apparently) I am wondering whether bench will update itself to 5.3 in that process above or whether it was recommended to update bench manually?
if that needs to be done separately …
is it a bench update ran in a folder one level above the frappe-bench folder which updates bench?
should I do that prior to updating frappe/erpnext or after?
I have a running version-11 site. Are you sure this would not do any harm to that?
where do I have to run this from? the home folder of my frappe user?
pip3 --version gives me an pip3 can be installed with apt install python3-pip error. I am running on p3 though there is an ~/env/lib/python3.6/ folder which I believe proves that.
about my instance:
… installed via the easy install script about 2.5 years ago (version-11), python2
… migrated to python 3 (Dec 2019 I believe)
pip --version returns pip 9.0.1 from /usr/lib/python2.7/dist-packages (python 2.7)
it is hard to ensure no problem, as check from forum it seem many conditions can cause update or change failure.
I haven’t try v11 yet, I use v12 and upgrade to v13 without issue
at the home user directory, eg. if user is frappe
/home/frappe
it depend on the OS I think, co-exist with python and python3 is possible.
pip seems out-of-date, you may get another warning of pip version.
if possible I always recommend do a DR backup before any action, since error can’t eliminate and no guarantee “error-free” in all environments.
I think the answer to that may be that it was during the python 2 era when I installed the instance (using the easy install script). I have updated to python 3 when the time came.
I have noted, there is a pip3 entry in frappe-bench/env/bin there actually is a pip3 and a pip3.6 entry. Maybe I have to address that with the complete path and not just pip3 ...
Gotcha. For any machine, there are 3 possible locations where Python saves packages.
If you install as normal user, Python packages are in $HOME/.local/lib/python3.x/site-packages/
If you install as root, packages are in /usr/local/lib/python3.x/site-packages/
(note: this may vary slightly between Linux distributions, or if you installed Python manually)
When using Python Virtual Environments (which Frappe does), you’ll find them inside whatever virtual environment directory was created. In your case, ../frappe-bench/env/
You don’t want to mess with ../frappe-bench/env. That is ERPNext’s virtual environment. While Bench created that for you, the contents have nothing to do with “Bench code”.
My advice is this.
Find your current Bench installation. You can identify where it’s located using
which bench
Take a backup. Then remove that older Bench.
Remember not to touch your frappe-bench directory or contents at all!
Install a fresh Bench app using Python3 and pip3:
pip3 install frappe-bench
Verify it installed correctly
which bench
bench --version
Change your working directory to your ../frappe-bench/ directory.
Carry on and use Bench normally. All commands should be working fine. But Frappe and ERPNext themselves should be untouched.
Hopefully this makes sense. It’s a bit confusing because “Bench” is a separate app. But the default name of Frappe and ERPNext’s working directory is “frappe-bench”. Which is neither Bench, nor Frappe.
I sometimes install my environment with a completely different name, instead of “frappe-bench”, to avoid confusion.
returns /usr/local/bin/bench (which is a file) and 4.1.0 as then bench version
installing bench with sudo /frappe-bench/env/pip3 install frappe-bench results into a new bench file in ~/frappe-bench/env/bin owned by root (same ownership as previous bench in /usr/local/bin)
however the verification with
which bench
bench --version
does not return any values besides Command ‘bench’ not found
$ sudo env/bin/bench --version
5.3.0
whithout sudo the installation did not go through and without sudo I get an error for env/bin/bench --version
I am wondering whether is just making the file location known but wouldn’t know how exacly. Or would it make sense to provide a specific location (like /usr/local/bin) with the installation?
Also I have noted, that there is a pip3.6 also available (not referred to by pip3). Does it make sense to use that instead pip3?
bench should run from the frappe-user (who has no root permissions) so I guess there may be something wrong with the installation via root to begin with
TLDR → I believe that Bench now must be installed twice. First as a regular user. Then again as root user.
Explanation: @bkm and I were discussing this last month. We discovered several challenges during v13 installation.
In Bench 4.0 and earlier, the official instructions for installing Bench was using pip’s “editable mode”. This was the 'pip3 install -e .' command.
Now, Bench is available on PyPi.org. So we install using pip3 install frappe-bench. This command downloads Bench from PyPi, and installs on our machines.
Here is the problem:
Bench sometimes must be root (because it does things with apt, systemd, ansible)
Bench sometimes must be a regular user (all the other commands)
Python’s package system can be…painful. Partly because interpretive languages have more moving parts. But also because Python does some magic with symlinks, PATH changes, has no .lock file, virtual environments, etc.
When I installed Bench as a regular user, I could not make it run successfully as root. I tried changing my PATH variables. I even tried manually installing Bench inside a virtual environment. No luck. Even when it appeared like I was successful, Bench would always fail later with a “module not found” error.
Nothing I tried allowed for installing Bench once. But running both as regular and root.
Recommendations
Until someone provides a workaround, I think the easiest solution for you is installing Bench twice. Once as root, once as a regular user. I think this is awful, but it’s the only solution I have when installing from PyPi.
Alternately, you can still install Bench the old way, in pip’s editable mode. Bench 5.0 will raise warnings about this, and tell you editable mode is not recommended. But it does work.
sorry, I made a simple mistake. And I actually can access bench (without AND with sudo) by just addressing it right (~/frappe-bench/env/bin/bench instead of just bench). I guess that could be solved by editing the PATH as well.
I installed bench with sudo pip3 install frappe-bench
however I am running into toubles in the upgrade process (v11 → v12) then. I guess they are out of scope of this Topic.
Just one final thing … do you believe you need bench 5.x to upgrade v11 → v12 at all (which was the actual reason for this Topic to begin with)
I stepped back to the orignal point and did not do the manual bench upgrade, but tried the regular ERPNext upgrade process … in the middle of it I checked on which bench and got 5.0. It seems to be upgrage in the process as well at some point.
The last time I installed bench, I did this out of confusion. Because I can’t do sudo bench setup production (err: ‘bench is not found’ when sudo).
So I did: