motioneye icon indicating copy to clipboard operation
motioneye copied to clipboard

New error when installing motioneye

Open Bluscream opened this issue 1 year ago • 3 comments

root@minopia:/tmp# pip install motioneye
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.

    For more information visit http://rptl.io/venv

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.

this didnt happen when i set up motioneye last time

Bluscream avatar Apr 14 '24 15:04 Bluscream

It's in the readme

On recent Debian (Bookworm ant later) and Ubuntu (Lunar and later) versions, the libpython3.*-stdlib package ships a file /usr/lib/python3.*/EXTERNALLY-MANAGED, which prevents the installation of Python modules outside of venv environments. motionEye however has a small number of dependencies with no strict version requirements and hence is very unlikely to break any Python package you might have installed via APT. To bypass this block, add break-system-packages=true to the [global] section of your pip.conf:

grep -q '\[global\]' /etc/pip.conf 2> /dev/null || printf '%b' '[global]\n' | sudo tee -a /etc/pip.conf > /dev/null
sudo sed -i '/^\[global\]/a\break-system-packages=true' /etc/pip.conf

Kvrnn avatar Apr 14 '24 16:04 Kvrnn

It's in the readme

You know there are about ~50 tutorials and readmes official or not and only one mentions this ...

Bluscream avatar Apr 14 '24 19:04 Bluscream

I have a suggestion: in the README.md, omit the part about grep'ing and chaning the pip.conf file and just add the --break-system-packages argument to pip like so:

sudo python3 -m pip install --break-system-packages --pre motioneye

Makes the installation easy again.

xandark avatar Jul 25 '24 23:07 xandark

I just reinstalled motioneye and this is even easier as I'm pulling the latest from git:

sudo python3 -m pip install --break-system-packages git+https://github.com/motioneye-project/motioneye.git

xandark avatar Apr 04 '25 00:04 xandark

In the end we need to rework install instructions and service files to use a venv.

I'll close this issue as answered regarding the break-system-packages option needed to install anything via pip outside of a venv on most modern distros.

MichaIng avatar Apr 19 '25 10:04 MichaIng