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

Trouble saving images during build #4661

Closed
t-makaro opened this issue Sep 22, 2018 · 18 comments
Closed

Trouble saving images during build #4661

t-makaro opened this issue Sep 22, 2018 · 18 comments
Labels
Needed: more information A reply from issue author is required Status: stale Issue will be considered inactive soon Support Support question

Comments

@t-makaro
Copy link

Details

Sphinx-gallery is trying to add support for images that are saved to disk when an example is run:sphinx-gallery/sphinx-gallery#417 (comment)

I am trying to get a prototype of this to work over at: t-makaro/animatplot#14

My docs build works perfectly locally or on cirleci, but for some reason when run on RTD the image files do not seem to be produced properly. (This would be much easier to debug if I could download the built source off RTD). The images are being saved to disk using matplotlib's PillowWriter, but for some reason on RTD only the first frame is saved.

Expected Result

Two images are produced, and there are both animated. See:

https://145-87026896-gh.circle-artifacts.com/0/home/circleci/project/docs/build/html/auto_examples/plot_sqwell.html

Actual Result

Two images are produced, but they are static.

https://animatplot.readthedocs.io/en/latest/auto_examples/plot_sqwell.html#sphx-glr-auto-examples-plot-sqwell-py

@t-makaro
Copy link
Author

If I switch to using matplotlib's imagemagickwriter to save the gif. Then the build fails completely: https://readthedocs.org/projects/animatplot/builds/7828320/

with:

outfile must be *.htm or *.html

@stsewd
Copy link
Member

stsewd commented Sep 22, 2018

What are the requirements to use this feature? Maybe there is something that needs to be installed?

@stsewd
Copy link
Member

stsewd commented Sep 22, 2018

I'll take a look on Monday

@t-makaro
Copy link
Author

t-makaro commented Sep 23, 2018

The features are still under development I'm installing a dev version of sphinx-gallery by listing the git branch in the requirements file. As far as I can tell, it is installed properly it does run my example code and produces an image which it then adds to the auto-generated documents. (Ultimately, it uses matplotlib and Pillow to save the image to disk). The problem is that the gif isn't produced properly on RTD, yet local builds and circleci work fine.

@stsewd
Copy link
Member

stsewd commented Sep 24, 2018

I'm not familiar with the libs you are using, neither the process that they follow to generate the images, so I can't tell if this is a rtd problem. What commands are you using to build the docs locally?

@stsewd stsewd added Support Support question Needed: more information A reply from issue author is required labels Sep 24, 2018
@stsewd
Copy link
Member

stsewd commented Sep 24, 2018

Ok, I have investigated this a little more, I found this happens when building with the rtd-sphinx-extension. Maybe the lib is relying on the builder to always be html? If not, maybe it's something happening with the rtd-sphinx-extension.

You can test this locally with:

pip install readthedocs-sphinx-ext

Adding to your cong.py file this

extensions = [
    'readthedocs_ext.readthedocs',
]

And building your docs with

sphinx-build -b readthedocs -d _build/doctrees-readthedocs -D language=en . _build/html

@stsewd
Copy link
Member

stsewd commented Sep 24, 2018

Nevermind about the above comment, I don't think the extension is the problem (looks like I just needed to refresh the page to trigger the gif). I'm thinkgin something related to the libs installed locally. Maybe the pandoc version?

@stsewd
Copy link
Member

stsewd commented Sep 24, 2018

Our latest image is using pandoc 1.16.0.2

@stsewd
Copy link
Member

stsewd commented Sep 24, 2018

Ok, I was able to build the docs correctly inside the docker container, still not sure what is happening inside the rtd code. But something must be failing silently.

@stsewd
Copy link
Member

stsewd commented Sep 24, 2018

Just adding that the generated git is half the size from the one generated outside rtd. Maybe a permissions issue?

@stsewd
Copy link
Member

stsewd commented Sep 25, 2018

So, I finally was able to replicate this inside the container, if I do all the steps using a virtualenv, the generated gif is static (one frame, half the original size, etc). If I do all the steps using the global python interpreter, then the gif is generated correctly. I'm not really sure why is this happening. Locally, I was able to generate the correct gif using a virtualenv.

@choldgraf
Copy link
Contributor

Hello! I'm one of the devs working with Sphinx Gallery. Could it be a difference in dependency versions? I think that there are some other ways to create gifs using matplotlib (with imagemagick I believe) so maybe that'll get it working

@t-makaro
Copy link
Author

@stsewd Thank you for taking the time to replicate the issue.

How could I install imagemagick for use on RTD? I did make one attempt to use imagemagick, but the build failed completely on RTD. (Imagemagick is also less good for my workflow).

@stsewd
Copy link
Member

stsewd commented Sep 26, 2018

We have an open issue about adding imagemagick to the rtd docker images readthedocs/readthedocs-docker-images#70

@t-makaro
Copy link
Author

I presume that would require me to use the latest docker image (once it's added), but I was having trouble building on the latest docker image. #4446 Though I think that I may know away around it. I'll try to test that later.

@stale
Copy link

stale bot commented Jan 10, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Status: stale Issue will be considered inactive soon label Jan 10, 2019
@no-response
Copy link

no-response bot commented Jan 10, 2019

This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further. Thanks!

@no-response no-response bot closed this as completed Jan 10, 2019
@stsewd
Copy link
Member

stsewd commented Jan 10, 2019

If readthedocs/readthedocs-docker-images#70 works to solve this issus, we can keep this closed, if there is something else we should do let us know, so we can re-open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needed: more information A reply from issue author is required Status: stale Issue will be considered inactive soon Support Support question
Projects
None yet
Development

No branches or pull requests

3 participants