Visitar URL original
DOC: add notes about --only-binary to install instructions by tacaswell · Pull Request #20835 · matplotlib/matplotlib · GitHub
The Wayback Machine - https://web.archive.org/web/20260106144025/https://github.com/matplotlib/matplotlib/pull/20835
Skip to content

Conversation

@tacaswell
Copy link
Member

Due to issues some users are having today due to the wheels tweak our install instructions to suggest the usage of --only-binary matplotlib when installing in contexts where the user is sure they do not want to possibly compile the c-extensions from source.

--only-binary matplotlib is preferable to --prefer-binary because the first is limited to only Matplotlib where as the second will apply to all packages that pip tries to install.

closes #20834

@tacaswell tacaswell added this to the v3.5.0 milestone Aug 13, 2021
@timhoffm
Copy link
Member

timhoffm commented Aug 17, 2021 •

While technically correct, I'm not quite happy with the form.

I put in some effort to boil the installation instructions down from lengthy explanations to a concise instruction. Long installation instructions are scary and most of the time also not helpful. When I install, I want to run the one installation command and get startet with using the library, not read long explanations on variations of installation and edge cases.

The one-sentence --prefer-binary was ok. IMHO this is now too much volume for an edge case.

Some possible ways out:

  • Is it possible to give that information when the install/build fails? That would be much more helpful, because people may not have read the install instructions when they stumble over this problem.
  • Can this still be one sentence only?
  • If not I propose to move this into it's own section in https://matplotlib.org/devdocs/faq/installing_faq.html. While I want to restructure this / melt this down as well, it's the right place for now.

@tacaswell
Copy link
Member Author

IMHO this is now too much volume for an edge case.

Given the volume and almost immediate bug reports to the pypi issue I think this is less of and edge case.

The one-sentence --prefer-binary was ok.

On one hand, I think --prefer-binary is overkill to solve the problem with us, but on the other hand if the user can not compile us, they probably can not compile numpy or scipy and overkill may be the right option.

How about putting --prefer-binary in the default command, changing the text to say "if you are willing to risk compiling remove it" and then move the stuff about the requirements files to the faq (and let it get melted down later)?

@timhoffm
Copy link
Member

How about putting…

Maybe.

I'm wondering though why we need a complicated install command

python -m pip install -U pip
python -m pip install -U —prefer-binary matplotlib

Whereas numpy can get by with pip install numpy https://numpy.org/install/. What do they do differently?

Generally, a standard install should be simple and not need many extra options.

@tacaswell
Copy link
Member Author

I think part of it is how much you trust wheels to existing and pip to "do the right" thing (and a function of how many bug reports you have gotten for " does not install!" that are issues with local environments, missing wheels, or pip).

For example, iirc the "please install pip first" logic was from around the time we were starting to drop python2 support and older versions of pip were not aware of the metadata on the sdist to inform it of the minimum version of Python and would would try to source install an incompatible version. The "fix" for python2 users was to get them to update to a newer pip so then installing us would grab the correct wheel. While that is hopefully (mostly) in the past, there is some on-going issues with versions of pip knowing about versions of the manylinux wheels (when manylinux2010 first appeared I saw issues (not with mpl, but with other packages in my BNL context) where old versions of pip would not see the new wheels and then start building all the things from source (which if you have the compilers just takes a long time which is almost worse than just failing, but I digress).

The python -m... bit is from a wave of bug reports where people ended up with virtual environments that did not have pip installed, but their "base" env did so the would install into the base env and then report we failed to install when they could not import Matplotlib and from the time period where sometimes people would have both pip and pip3 on their path.

In both cases we went with something slightly more complicated that made a bit less assumptions about what your system looked like to make it more likely that it was going to work for more users (on the assumption that they are going to copy-paste anyway!).

My motivation here was to document our way out of the issues that came when pypi had a split brain about what wheels existed. I'm of the view that wheels are provided as a convenience for users on "common" platforms to save them from compiling, but the canonical published version of Matplotlib is the sdist. If users really need to rely on the pre-compiled versions they should either use the pip functionality to enforce that or use a tool (like conda, system packaging, brew, pythonxy, EPD, ...) that only provides pre-built binary versions.

If the concern is that numpy / scipy / pandas 's install instructions look shorter than our I'm happy to go propose making their install instructions more careful!

@timhoffm
Copy link
Member

Are the extra hoops install -U pip and python -m still relevant nowadays? I can't say anything about pip versions but I thought pip is always installed in venvs nowadays, so at least python -m could be removed.

Removing other extra args would make it easier for me to accept --prefer-binary.

If the concern is that numpy / scipy / pandas 's install instructions look shorter than our I'm happy to go propose making their install instructions more careful!

🤣 Good luck!

@jklymak
Copy link
Member

jklymak commented Sep 15, 2021

My issue here is that relegating conda install matplotlib to "Third Party Releases" makes it sound like conda is not the favoured way to install things, whereas for 99.9% of users, they definitely should be using conda. If you tell people to get the "Official" install via pip, we are going to continue to get error reports from folks who cannot install fontconfig, kiwisolver etc.

@timhoffm
Copy link
Member

timhoffm commented Sep 15, 2021 •

@jklymak the question of recommending conda is semi-OT here. This is primarily about the pip install command.

Note, that the new front page announces conda and pip equally, which should be good enough for a general direction on installation. Formally, we don't provide the conda packages, which I think warrants that conda should be in the 3rd party packages. Another question would be if we should still recommend the conda main channel or conda-forge, now that the conda main channel requires a paid license for commercial use.

@jklymak
Copy link
Member

jklymak commented Sep 15, 2021

I guess it's semi off topic, but most of the subtleties discussed here about various pip command options go away.

@jklymak
Copy link
Member

jklymak commented Sep 16, 2021

I will also add that users who need help installing are not going to understand what we mean by the difference between a "first-party" installation and a "third-party" installation. "Third-party" makes it sound like it is not recommended.

@tacaswell tacaswell modified the milestones: v3.5.0, v3.6.0 Sep 16, 2021
@jklymak
Copy link
Member

jklymak commented Sep 24, 2021

I'll bump to draft...

@jklymak jklymak marked this pull request as draft September 24, 2021 07:06
@tacaswell
Copy link
Member Author

I'm going to abandon this PR.

@tacaswell tacaswell closed this Mar 25, 2022
@QuLogic QuLogic removed this from the v3.6.0 milestone Sep 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Matplotlib 3.4.3 wheel unable to build - cannot find Python.h

4 participants