Closed Bug 1831442 Opened 2 years ago Closed 2 years ago

Installing moz-phab externally-managed-environment error on ubuntu 23.04

Categories

(Conduit :: moz-phab, defect)

All
Linux
defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: ahale, Assigned: ahochheiden)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

Trying to bootstrap on a fresh install of ubuntu 23.04 to work on another bug, and I first encountered problems with pip3 being unable to install Mercurial, I worked around that by installing Mercurial system-wide, so far so good, but then I encounter the same problem with moz-phab and there is no python3-MozPhab package on ubuntu to work around this error.

Attached the most relevant part of the output.

There is arguably a bug on the Ubuntu side: the command that is being run is only asking to list what is installed, it's not trying to install things. (/usr/bin/python3 -m pip show -f MozPhab)

Duplicate of this bug: 1834087
Duplicate of this bug: 1839419

(In reply to Mike Hommey [:glandium] from comment #1)

There is arguably a bug on the Ubuntu side: the command that is being run is only asking to list what is installed, it's not trying to install things. (/usr/bin/python3 -m pip show -f MozPhab)

To test this I spun up a clean Ubuntu Lunar image, installed python3-pip, and ran pip show:

glob@ubuntu:~$ /usr/bin/python3 -m pip show -f MozPhab
WARNING: Package(s) not found: MozPhab

I was only able to trigger the warning with pip install:

glob@ubuntu:~$ /usr/bin/python3 -m pip install MozPhab
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.11/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.

Having encountered this myself now, what's failing is the pip install --user that precedes the pip show. I don't know why they made --user fail... a work around is to set the PIP_BREAK_SYSTEM_PACKAGES environment variable to 1 (or changing the pip install command to pass --break-system-packages).

Component: Bootstrap Configuration → moz-phab
Product: Firefox Build System → Conduit

This is a problem in how bootstrap installs moz-phab, not in moz-phab itself.

Component: moz-phab → Bootstrap Configuration
Product: Conduit → Firefox Build System

The install-moz-phab command is in tools/phabricator, not python/mozboot. The moz-phab component is the closest wrt ownership.

Component: Bootstrap Configuration → moz-phab
Product: Firefox Build System → Conduit
Severity: -- → S2
Assignee: nobody → ahochheiden
Status: NEW → ASSIGNED
Attachment #9341778 - Attachment description: Bug 1831442 - Fix an issue with `./mach install-moz-phab` on Ubuntu `23.04` r?#build → Bug 1831442 - Fix an issue with `./mach install-moz-phab` on `Ubuntu 23.04` and `Debian 12` r?#build
Pushed by ahochheiden@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/61380efc6f72 Fix an issue with `./mach install-moz-phab` on `Ubuntu 23.04` and `Debian 12` r=firefox-build-system-reviewers,glandium
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Blocks: 1876182
See Also: → 1924916

Should the install instructions at
https://moz-conduit.readthedocs.io/en/latest/mozphab-linux.html
also mention that it's necessary to set
PIP_BREAK_SYSTEM_PACKAGES=1 ?

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: