kislyuk / yq

Command-line YAML, XML, TOML processor - jq wrapper for YAML/XML/TOML documents
https://kislyuk.github.io/yq/
Apache License 2.0
2.53k stars 81 forks source link

Ubuntu 23.04 disallows `pip install yq` by default #173

Closed johantiden closed 10 months ago

johantiden commented 10 months ago

I just upgraded to Ubuntu 23.04 and yq broke for me. I tried to reinstall it using pip install yq, which spews out the following:

❯ pip install yq      
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.

This means that your installation guides should probably be updated to reflect this. It might also make sense to distribute yq via apt (as a python-yq package), which seems to be the recommended way. Currently users are left with workarounds, e.g. using pipx.

johantiden commented 10 months ago

For now, I used

sudo apt install pipx
pipx ensurepath
pipx install yq
kislyuk commented 10 months ago

Thanks for reporting this! Since this issue is not specific to yq and (to the extent the user is not willing to follow the instructions you pasted) breaks the installation instructions of almost all Python packages, and also only affects a non-LTS Ubuntu release, I'm not currently planning any work to address this issue, and will close it for now.

It might also make sense to distribute yq via apt (as a python-yq package)

PRs and contributions are welcome to make this happen.