Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recommended installation approach broken on Alpine 3.19 #2021

Closed
jnoordsij opened this issue Dec 14, 2023 · 2 comments · Fixed by #2048
Closed

Recommended installation approach broken on Alpine 3.19 #2021

jnoordsij opened this issue Dec 14, 2023 · 2 comments · Fixed by #2048
Labels
documentation Problems or improvements needed on the documentation or on the website
Milestone

Comments

@jnoordsij
Copy link

First of all, thanks for this amazingly useful piece of software!

In the documentation, the installation for Alpine without a virtualenv (see https://doc.courtbouillon.org/weasyprint/stable/first_steps.html#alpine-3-12) is no longer working with Alpine 3.19, as Python’s package directory is now marked as externally managed; see also https://www.alpinelinux.org/posts/Alpine-3.19.0-released.html.

$ docker container run --rm alpine:3.19 /bin/sh -c "apk --no-cache add py3-pip py3-pillow py3-cffi py3-brotli gcc musl-dev python3-dev pango && pip3 --no-cache-dir install weasyprint"
...
error: externally-managed-environment

× This environment is externally managed
╰─>
    The system-wide python installation should be maintained using the system
    package manager (apk) only.

    If the package in question is not packaged already (and hence installable via
    "apk add py3-somepackage"), please consider installing it inside a virtual
    environment, e.g.:

    python3 -m venv /path/to/venv
    . /path/to/venv/bin/activate
    pip install mypackage

    To exit the virtual environment, run:

    deactivate

    The virtual environment is not deleted, and can be re-entered by re-sourcing
    the activate file.

    To automatically manage virtual environments, consider using pipx (from the
    pipx package).

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.

Possible solutions to fix the documentation:

  • point towards the version available through apk
  • update the installation suggestion to use pipx
  • note that for Alpine >= 3.19 installation without virtualenv is not supported
@liZe liZe added the documentation Problems or improvements needed on the documentation or on the website label Dec 14, 2023
@liZe liZe added this to the 61.0 milestone Dec 14, 2023
@liZe
Copy link
Member

liZe commented Dec 14, 2023

Hi!

First of all, thanks for this amazingly useful piece of software!

You’re welcome!

In the documentation, the installation for Alpine without a virtualenv […] is no longer working with Alpine 3.19

Maybe we should remove the sections to install WeasyPrint with no virtualenv for all the distributions.

There’s a paragraph above, in the documentation, asking users to use the distribution’s package if possible, and to use a virtualenv otherwise. But you’re right, it’s not obvious when you reach directly a section for a given distribution.

What we should do is:

  1. remove the "install with no virtualenv" section for all distirbutions,
  2. replace it by a "To install WeasyPrint using your distribution’s package" with the related command line.

What do you think of that? Interested in opening a PR? 😄

@jnoordsij
Copy link
Author

That sounds like a very reasonable approach. I'll see if I can manage to create a PR somewhere in the next few weeks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Problems or improvements needed on the documentation or on the website
Projects
None yet
2 participants