Externally managed environment while installing frappe-bench

Hello everyone, i tried almost everything but stuck at this error while installing erpnext v14.

I’m using UBUNTU 24 LATEST AS A OS in my system.

frappe@Rahul:~$ sudo pip3 install frappe-bench
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.

If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.

If you wish to install a non-Debian packaged Python application,
it may be easiest to use pipx install xyz, which will manage a
virtual environment for you. Make sure you have pipx installed.

See /usr/share/doc/python3.12/README.venv for more information.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.

Any help appreciated, Thank You

1 Like

issue has been sorted out after installing ubuntu 22 and erpnext scripts

Can you explain more?
How was the problem resolved?

Thank you

I deleted everything and re-installed ubuntu and then use the script to install the ERPNEXT.

Script - GitHub - flexcomng/erpnext_quick_install: Unattended install script for ERPNext Versions, 13, 14 and 15

To explain more … The repos for Ubuntu 23.10 install python 3.11 & for 24.04 that’s 3.12. Starting in 3.11 there’s now a requirement to use a venv when installing stuff - otherwise “sudo pip3 install frappe-bench” should give “error: externally-managed-environment”

See: python - pip install -r requirements.txt is failing: “This environment is externally managed” - Stack Overflow
and: PEP 668 – Marking Python base environments as “externally managed” | peps.python.org

/usr/lib/python3.12/EXTERNALLY-MANAGED is just an empty marker file and removing it causes Python to revert to the way it behaves in 3.10. See also: Installing ERPNext version 15 on Ubuntu 23+

You should see in the erpnext_quick_install script at line 338 it does just that.

1 Like

correct

Is this script is secure to use?

Yes totally