Installing matplotlib documentation

Continued from github: https://github.com/matplotlib/matplotlib/issues/14966#issuecomment-557629015

I am inside matplotlib/doc/ when I do the make html.

What are the contents of doc/Makefile? How did you get the source tree?

Actually there seems to be no Makefile there…

How did you get the source tree? You should clone the github repo.

Could you please follow the matplotlib contribution doc page linked in the post? I followed it but apparently over time the file structure seems to have changed and the (old) doc instructions doesn’t work anymore.

The link is: https://matplotlib.org/3.1.1/devel/documenting_mpl.html#building-the-docs

You should be using these instructions:
https://matplotlib.org/devdocs/devel/documenting_mpl.html#building-the-docs

if they don’t work, please let us know.

From what I see, the documentation looks same. Issue I notice is that there is no makefile in the doc folder

Can some developers make a fresh pull and verify if documentation is up to date?

The file exists in the git tree: https://github.com/matplotlib/matplotlib/blob/master/doc/Makefile

1 Like

Sorry to bother, but there is no Makefile file inside matplotlib/doc/ inside the repo pulled from github. Shouldn’t there be a Makefile there?

Confirming what @tacaswell posted, I’m also seeing the file in the current tree https://github.com/matplotlib/matplotlib/tree/master/doc

Can you print the output of git remote --verbose

origin https://github.com/SKPsanjeevi/matplotlib.git (fetch)
origin https://github.com/SKPsanjeevi/matplotlib.git (push)

That fork of Matplotlib is a couple of years out of date, which is why the current install instructions are not matching up with the code in the repository. You’re going to want to update your fork to a current version of the code.

git remote add upstream git@github.com:matplotlib/matplotlib.git
git fetch upstream master
git merge upstream/master

You can find more detailed instructions at https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/working-with-forks

1 Like

Thanks! I am now able to start building html but having issue at following location (image_transparency_blend.py):

generating gallery for gallery/images_contours_and_fields... [ 45%] image_transparency_blend.py                                                                                                             
Exception occurred:
  File "/home/sathish/anaconda3/lib/python3.7/site-packages/matplotlib/image.py", line 469, in _make_image
    if alpha is not None and alpha != 1.0:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

The following was the header from the log file:

# Sphinx version: 2.2.1
# Python version: 3.7.5 (CPython)
# Docutils version: 0.15.2 release
# Jinja2 version: 2.10.3

I could not exactly understand the error due to the alpha values. I wonder if there needs to be modification to image_transparency_blend.py or should I change the version of the python that I am using to compile the doc?

What version of Matplotlib and numpy are you building the docs against?

matplotlib:
>>> matplotlib._ _ version _ _
‘2.0.0+4174.g3e2e31e’

numpy:
>>> numpy._ _ version _ _
‘1.17.4’

matplotlib seems too old for me. I am updating both matplotlib and numpy.

I updated the matplotlib to 3.1.2. Still there is issue with the same gallery example. This time however the error message is slightly different but still to do with alpha values. I am getting the following error message:

generating gallery for gallery/images_contours_and_fields... [ 45%] image_transparency_blend.py                                                                                                             
Exception occurred:
  File "/home/sathish/anaconda3/lib/python3.7/site-packages/matplotlib/image.py", line 530, in _make_image
    np.asarray(alpha_channel, np.float32) * out_alpha * alpha,
ValueError: operands could not be broadcast together with shapes (370,370) (100,100)

Inside your code repository, please type git log -1 and paste the output here/verify that you have a reasonably recent version of the code. If the last commit was within the last week or two, please try reinstalling from source using the instructions provided here:
https://matplotlib.org/devdocs/devel/contributing.html#retrieving-and-installing-the-latest-version-of-the-code

1 Like