Skip to content

DOC: document the issues with overlaying new mpl on old mpl #29673

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

Merged
merged 4 commits into from
May 2, 2025

Conversation

tacaswell
Copy link
Member

closes #26827

@story645
Copy link
Member

Can this maybe get added to the FAQ since it's relatively common?
Maybe https://matplotlib.org/devdocs/users/faq.html or

of a version of Matplotlib < 3.8 (e.g. via ``pip install --local`` or
``python -m venv --system-site-packages ...``) will fail because the old
`matplotlib.mpl_toolkits` files will be found where as the newer files will be
found for all other modules. This will result in errors due to the version
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there anything we can do about this? eg somehow clean out the old files on pip install, I guess by overwriting them with empty files?

Or barring that, it would be helpful if we suggested to users what they should do about this. I'm not even sure pip uninstall matplotlib will clean the mpl_toolkits files out.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue is the "overlaying". If the old version of Matplotlib is in the venv (and hence the users has write) then pip takes care of itself, but if you are exposed to a read-only set of files then there is nothing we can do.

Even if there was something to do, it would be pip's job not ours.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still a bit mysterious, and I don't think I am in a low percentile of our user's sophistication in installing python packages, so can we be more clear? Is this primarily happening when the operating system has packaged matplotlib as part of the distribution (or apt-install etc), and then the user's pip-install doesn't replace mpl-toolkits in the distribution's version of Matplotlib? If that is the most common case, can we just say something like that, while leaving open the possibility that the installation got crossed other ways.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this primarily happening when the operating system has packaged matplotlib as part of the distribution (or apt-install etc), and then the user's pip-install doesn't replace mpl-toolkits in the distribution's version of Matplotlib?

Yes, that is the common (and likely only?) case.

Co-authored-by: Jody Klymak <jklymak@gmail.com>
Comment on lines 183 to 185
As a consequence using ``pip`` to install a version of Matplotlib >= 3.8 on top
of a version of Matplotlib < 3.8 (e.g. via ``pip install --local`` or
``python -m venv --system-site-packages ...``) will fail because the old
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe:

Suggested change
As a consequence using ``pip`` to install a version of Matplotlib >= 3.8 on top
of a version of Matplotlib < 3.8 (e.g. via ``pip install --local`` or
``python -m venv --system-site-packages ...``) will fail because the old
As a consequence using ``pip`` to install a version of Matplotlib >= 3.8 on top
of a version of Matplotlib < 3.8 (e.g. installed using a system package manager
like ``apt install ...``, or via ``pip install --local`` or
``python -m venv --system-site-packages ...``) will fail because the old

where as -> whereas

miss-match -> mismatch

Thanks to @Mecanerd for these suggestions

Co-authored-by: Mecanerd <joshdonath23@hotmail.com>
Copy link
Member

@ksunden ksunden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd tend to agree with some of the review comments that this could be made even more clear, but having it is better than not having it, so going to move forward with what we have. I'd happily consider a reword on this submitted later.

@ksunden ksunden merged commit cfe41d4 into matplotlib:main May 2, 2025
22 checks passed
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request May 2, 2025
rcomer added a commit that referenced this pull request May 2, 2025
…673-on-v3.10.x

Backport PR #29673 on branch v3.10.x (DOC: document the issues with overlaying new mpl on old mpl)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation: API files in lib/ and doc/api
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: ImportError when using Matplotlib v3.8.0 in Python package tests
6 participants