Strange warning "WARN: Command not being executed in bench directory"

Hello, I tried to backup all sites but this error occurs and it does not allow me to do anything:

[bench@node4037 ~]$ bench backup-all-sites
WARN: bench is installed in editable mode!

This is not the recommended mode of installation for production. Instead, install the package from PyPI with: pip install frappe-bench

WARN: Command not being executed in bench directory
INFO: A newer version of bench is available: 5.3.0 → 5.5.0
[bench@node4037 ~]$

bench folder is in fact, /opt/bench

What is it going on?

Thanks
Jaime

Hi Jaime,

The names and terminology can be confusing.

  • There is the Python program named 'bench', which is a standalone application.

  • When you install the Frappe Framework, a directory is created that is (usually) named 'frappe-bench'

    • To know for certain you’re in the right one, examine its subdirectories. You should see ‘apps’, ‘config’, ‘env’, ‘logs’ and more.

The error message means your current, working directory should be 'frappe-bench' (or the equivalent, if you happened to name it something different when you installed ERPNext)

2 Likes

Hello… this is curious. The frappe-bench folder in my case is named erpnext.

I tried to update erpnext from v12 to v13, so first I ran pip3 install --upgrade erpnext, however, an error telling that “ERROR: No matching distribution found for erpnext”, however, when I used “pip3 install --upgrade frappe-bench”, it did not show any erro, showing thisr:

[bench@node4037 erpnext]$ pip3 install --upgrade frappe-bench
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: frappe-bench in /opt/bench/.local/lib/python3.6/site-packages (5.5.0)
Requirement already satisfied: python-crontab==2.4.0 in /usr/local/lib/python3.6/site-packages (from frappe-bench) (2.4.0)
Requirement already satisfied: requests==2.22.0 in /usr/local/lib/python3.6/site-packages (from frappe-bench) (2.22.0)
Requirement already satisfied: setuptools in /usr/local/lib/python3.6/site-packages (from frappe-bench) (40.8.0)
Requirement already satisfied: GitPython==2.1.15 in /usr/local/lib/python3.6/site-packages (from frappe-bench) (2.1.15)
Requirement already satisfied: semantic-version==2.8.2 in /usr/local/lib/python3.6/site-packages (from frappe-bench) (2.8.2)
Collecting Jinja2==2.11.3
  Using cached Jinja2-2.11.3-py2.py3-none-any.whl (125 kB)
Requirement already satisfied: Click==7.0 in /usr/local/lib/python3.6/site-packages (from frappe-bench) (7.0)
Requirement already satisfied: honcho==1.0.1 in /usr/local/lib/python3.6/site-packages (from frappe-bench) (1.0.1)
Requirement already satisfied: virtualenv in /usr/local/lib/python3.6/site-packages (from frappe-bench) (16.6.0)
Requirement already satisfied: gitdb2<3,>=2 in /usr/local/lib/python3.6/site-packages (from GitPython==2.1.15->frappe-bench) (2.0.6)
Requirement already satisfied: MarkupSafe>=0.23 in /usr/local/lib64/python3.6/site-packages (from Jinja2==2.11.3->frappe-bench) (1.1.1)
Requirement already satisfied: python-dateutil in /usr/local/lib/python3.6/site-packages (from python-crontab==2.4.0->frappe-bench) (2.8.1)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.6/site-packages (from requests==2.22.0->frappe-bench) (2020.11.8)
Requirement already satisfied: idna<2.9,>=2.5 in /usr/local/lib/python3.6/site-packages (from requests==2.22.0->frappe-bench) (2.8)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/local/lib/python3.6/site-packages (from requests==2.22.0->frappe-bench) (3.0.4)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /usr/local/lib/python3.6/site-packages (from requests==2.22.0->frappe-bench) (1.25.11)
Requirement already satisfied: smmap2>=2.0.0 in /usr/local/lib/python3.6/site-packages (from gitdb2<3,>=2->GitPython==2.1.15->frappe-bench) (3.0.1)
Requirement already satisfied: smmap>=3.0.1 in /usr/local/lib/python3.6/site-packages (from smmap2>=2.0.0->gitdb2<3,>=2->GitPython==2.1.15->frappe-bench) (3.0.4)
Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.6/site-packages (from python-dateutil->python-crontab==2.4.0->frappe-bench) (1.12.0)
Installing collected packages: Jinja2
  Attempting uninstall: Jinja2
    Found existing installation: Jinja2 2.10.3
    Uninstalling Jinja2-2.10.3:
      Successfully uninstalled Jinja2-2.10.3
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
bench 5.0.0 requires Jinja2==2.10.3, but you have jinja2 2.11.3 which is incompatible.
Successfully installed Jinja2-2.11.3
[bench@node4037 erpnext]$

Why is this?

by the way, if you see last messages:

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
bench 5.0.0 requires Jinja2==2.10.3, but you have jinja2 2.11.3 which is incompatible.
Successfully installed Jinja2-2.11.3

i don’t understand why that error is shown since I have bench 5.5.0.

I am running this command as bench user because when running as root, a warning was shown.

Thanks
Jaime

For the purposes of this discussion, think of ERPNext as 2 separate “installed programs”:

  1. Bench
  2. Frappe Framework + ERPNext

Upgrading Bench

To upgrade the Python program named ‘Bench’ you would run this:

sudo -H pip3 install --upgrade frappe-bench

That command downloads the latest Bench from PyPi.org, and upgrades your installed version. It’s usually harmless to do this. Bench stands alone, and doesn’t share dependencies with the rest of Frappe and ERPNext.

Upgrading Frappe + ERPNext

To update this, do the following:

  1. Change your current, working directory to 'frappe-bench' (or in your case, sounds like it’s named 'erpnext')
  2. Run this command using Bench:
bench update

This does a ton of things.

  • Pulls the latest Frappe and ERPNext code from GitHub.
  • Installs Python dependencies.
  • Installs Node.js dependencies
  • Synchronizes your SQL database to the new schema.

Finally, this error here:

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
bench 5.0.0 requires Jinja2==2.10.3, but you have jinja2 2.11.3 which is incompatible.
Successfully installed Jinja2-2.11.3

The error is because Bench 5.0.0 wants to see Jinja2 2.10.3 on your machine. But it didn’t find that. Instead, it found something newer: Jinja2 2.11.3

Pip is warning you that maybe Bench will have problems. Because your Jinja2 is newer than what Bench v5 was coded with.

Realistically, it’s probably fine. That’s a very minor difference in versions (no pun intended). Unless Bench crashes when you execute it, you’re probably okay as-is.

Hope this helps explain things a bit more!

2 Likes

Hello… thanks for clarifying further. Now, when running bench update, this message appears:

[bench@node4037 erpnext]$ bench update
WARN: bench is installed in editable mode!

This is not the recommended mode of installation for production. Instead, install the package from PyPI with: `pip install frappe-bench`

remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
From https://github.com/frappe/frappe
 * branch                  version-12 -> FETCH_HEAD
WARN: shallow_clone is set in your bench config.
However without passing the --reset flag, your repositories will be unshallowed.
To avoid this, cancel this operation and run `bench update --reset`.

Consider the consequences of `git reset --hard` on your apps before you run that.
To avoid seeing this warning, set shallow_clone to false in your common_site_config.json

When running with reset parameter, nothing happens. That message appears always. Every command I run I got different strange messages, but at least I am sure the cause of the messages is not due to running the commands from the wrong directories.

Regards
Jaime