question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Rendering HoloMap as GIF with matplotlib/pillow fails under Windows

See original GitHub issue

I am trying to create an animated gif image from a series of heat maps with HoloViews. I need to do this in a Python script, i. e. specifically not in a Jupyter notebook. I am using Python 3.7 under Windows 10.

When saving the image, Python throws a PermissionError originating from PIL\Image.py line 1966 while manipulating a temporary file. However, it doesn’t seem like a user permission problem, as it happens also for users with unrestricted rights. At the point the exception happens, the temporary file has already been created on the file system.

The same code runs as expected under CentOS 7. Here’s an SSCE

Here’s another minimal example by ImportanceOfBeingErnest that removes holoviews from the picture by making a direct call to matplotlib’s FuncAnimation.save("fname", writer="pillow", fps=5). That works OK under Windows. So it looks like the holoviews save function might be broken.

ImportanceOfBeingErnest also played around a bit in the source code of holoviews and it also fails to save via imagemagick or imagemagick_file. (Although fixing this part of the issue is probably not a priority in view of #2460)

The source of this issue is this discussion on StackOverflow.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
xavArtleycommented, Nov 8, 2018

On Bokeh a small hack is performed to make NamedTemporaryFile works on windows

test_themes.py

class TestThemes(object):

def test_construct_empty_theme_from_file(self):
      # windows will throw permissions error with auto-delete
      with (tempfile.NamedTemporaryFile(delete=False)) as file:
          # create and apply empty theme with no exception thrown
          file.file.write("".encode('utf-8'))
          file.file.flush()
          theme = Theme(filename=file.name)
          theme.apply_to_model(ThemedModel())
      file.close()
      os.remove(file.name)
1reaction
Vikkiechauhancommented, Jul 17, 2019

hello, i want to use render the holoviews output as gif on windows. I am facing this issue as below and now i waited a long time for the output but nothing is showing up :

WARNING:root:Points05279: Setting non-parameter attribute width=500 using a mechanism intended only for parameters WARNING:root:Points05279: Setting non-parameter attribute height=475 using a mechanism intended only for parameters WARNING:root:Points05279: Setting non-parameter attribute size=12 using a mechanism intended only for parameters WARNING:root:Points05279: Setting non-parameter attribute color=black using a mechanism intended only for parameters INFO:matplotlib.animation:Animation.save using <class ‘matplotlib.animation.PillowWriter’> ​

Read more comments on GitHub >

github_iconTop Results From Across the Web

Rendering HoloMap as GIF with matplotlib/pillow fails under ...
I am trying to create an animated gif image from a series of heat maps with HoloViews. I need to do this in...
Read more >
PermissionError: [Errno 13] Permission denied when saving ...
When saving the image, Python throws an error because it cannot create ... line 69, in <module> renderer.save(holo, 'holo', fmt='gif') File ...
Read more >
Releases — HoloViews v1.15.3
Pin freetype on Windows to avoid matplotlib error (#5109) ... Support GIF rendering with Bokeh and Plotly backends (#2956, #4017). Support for Plotly...
Read more >
Holoviews Changelog - pyup.io
Pin freetype on Windows to avoid matplotlib error ... Support GIF rendering with Bokeh and Plotly backends ... Ensure .apply work correctly on...
Read more >
Data Animation with Python on Windows (Fixing Permission ...
I recently was trying to animate (through time) some plots of temperature(x, y, z) and found out that creating a .gif or .mpeg...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found