In T358412#9633195, @Aixvik wrote:In T358412#9633193, @Abishek_Das wrote:In T358412#9633189, @Aixvik wrote:In T358412#9633183, @MahimaSinghal wrote:In T358412#9633179, @Aixvik wrote:In T358412#9633100, @MahimaSinghal wrote:In T358412#9632678, @Aixvik wrote:Not able to generate video from the data frame? What might the reason be? As we have 7k+ columns and it's taking time can we generate a bar chart race video of only a few columns as an example?
And I read in the documentation that we should have 'ffmpeg' installed on our device as I am working on web paws Jupyter notebook and not locally do I also have to install 'ffmpeg'?Download latest FFmpeg static build.
exist = !which ffmpeg
if not exist:!curl https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz -o ffmpeg.tar.xz \ && tar -xf ffmpeg.tar.xz && rm ffmpeg.tar.xz ffmdir = !find . -iname ffmpeg-*-static path = %env PATH path = path + ':' + ffmdir[0] %env PATH $path!which ffmpeg
Add this code to your notebook , and you will be good to go.Getting same error again.
Can you share the exact error, What are the errors you are getting Exactly?
KeyError Traceback (most recent call last)
File /srv/paws/lib/python3.10/site-packages/PIL/Image.py:2416, in Image.save(self, fp, format, **params)2415 try:-> 2416 format = EXTENSION[ext]
2417 except KeyError as e:KeyError: '.mp4'
The above exception was the direct cause of the following exception:
ValueError Traceback (most recent call last)
File /srv/paws/lib/python3.10/site-packages/bar_chart_race/_make_chart.py:435, in _BarChartRace.make_animation(self)434 else:--> 435 ret_val = anim.save(self.filename, fps=self.fps, writer=self.writer)
436 except Exception as e:File /srv/paws/lib/python3.10/site-packages/matplotlib/animation.py:1089, in Animation.save(self, filename, writer, fps, dpi, codec, bitrate, extra_args, metadata, extra_anim, savefig_kwargs, progress_callback)
1086 # canvas._is_saving = True makes the draw_event animation-starting 1087 # callback a no-op; canvas.manager = None prevents resizing the GUI 1088 # widget (both are likewise done in savefig()).-> 1089 with writer.saving(self._fig, filename, dpi), \
1090 cbook._setattr_cm(self._fig.canvas, _is_saving=True, manager=None): 1091 for anim in all_anim:File /usr/lib/python3.10/contextlib.py:142, in _GeneratorContextManager.exit(self, typ, value, traceback)
141 try:--> 142 next(self.gen)
143 except StopIteration:File /srv/paws/lib/python3.10/site-packages/matplotlib/animation.py:245, in AbstractMovieWriter.saving(self, fig, outfile, dpi, *args, **kwargs)
244 finally:--> 245 self.finish()
File /srv/paws/lib/python3.10/site-packages/matplotlib/animation.py:515, in PillowWriter.finish(self)
514 def finish(self):--> 515 self._frames[0].save(
516 self.outfile, save_all=True, append_images=self._frames[1:], 517 duration=int(1000 / self.fps), loop=0)File /srv/paws/lib/python3.10/site-packages/PIL/Image.py:2419, in Image.save(self, fp, format, **params)
2418 msg = f"unknown file extension: {ext}"-> 2419 raise ValueError(msg) from e
2421 if format.upper() not in SAVE:ValueError: unknown file extension: .mp4
During handling of the above exception, another exception occurred:
Exception Traceback (most recent call last)
Cell In[8], line 114 bcr.bar_chart_race( 5 df=df, 6 filename='AnalysisVideo.mp4', 7 title='Bar Chart Race', 8 writer='matplotlib' 9 ) 10 return 'AnalysisVideo.mp4'---> 11 video = dataframe_to_race_chart(first_20)
12 Video(video, embed=True)Cell In[8], line 4, in dataframe_to_race_chart(df)
3 def dataframe_to_race_chart(df):----> 4 bcr.bar_chart_race(
5 df=df, 6 filename='AnalysisVideo.mp4', 7 title='Bar Chart Race', 8 writer='matplotlib' 9 ) 10 return 'AnalysisVideo.mp4'File /srv/paws/lib/python3.10/site-packages/bar_chart_race/_make_chart.py:783, in bar_chart_race(df, filename, orientation, sort, n_bars, fixed_order, fixed_max, steps_per_period, period_length, interpolate_period, label_bars, bar_size, period_label, period_fmt, period_summary_func, perpendicular_bar_func, figsize, cmap, title, title_size, bar_label_size, tick_label_size, shared_fontdict, scale, writer, fig, dpi, bar_kwargs, filter_column_colors)
461 ''' 462 Create an animated bar chart race using matplotlib. Data must be in 463 'wide' format where each row represents a single time period and each (...) 776 These sizes are relative to plt.rcParams['font.size']. 777 ''' 778 bcr = _BarChartRace(df, filename, orientation, sort, n_bars, fixed_order, fixed_max, 779 steps_per_period, period_length, interpolate_period, label_bars, bar_size, 780 period_label, period_fmt, period_summary_func, perpendicular_bar_func, 781 figsize, cmap, title, title_size, bar_label_size, tick_label_size, 782 shared_fontdict, scale, writer, fig, dpi, bar_kwargs, filter_column_colors)--> 783 return bcr.make_animation()
File /srv/paws/lib/python3.10/site-packages/bar_chart_race/_make_chart.py:446, in _BarChartRace.make_animation(self)
444 else: 445 message = str(e)--> 446 raise Exception(message)
447 finally: 448 plt.rcParams = self.orig_rcParamsException: You do not have ffmpeg installed on your machine. Download
ffmpeg from here: https://www.ffmpeg.org/download.html. Matplotlib's original error message below: unknown file extension: .mp4You do not have ffmpeg installed on your machine. ffmpeg is not install successfully on your system. You can try the steps mentioned by me on how to install ffmpeg its little bit long 😅 but i think will work.
No I have already installed and it's giving same error again.
- Queries
- All Stories
- Search
- Advanced Search
- Transactions
- Transaction Logs
Advanced Search
Mar 15 2024
In T358412#9633189, @Aixvik wrote:In T358412#9633183, @MahimaSinghal wrote:In T358412#9633179, @Aixvik wrote:In T358412#9633100, @MahimaSinghal wrote:In T358412#9632678, @Aixvik wrote:Not able to generate video from the data frame? What might the reason be? As we have 7k+ columns and it's taking time can we generate a bar chart race video of only a few columns as an example?
And I read in the documentation that we should have 'ffmpeg' installed on our device as I am working on web paws Jupyter notebook and not locally do I also have to install 'ffmpeg'?Download latest FFmpeg static build.
exist = !which ffmpeg
if not exist:!curl https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz -o ffmpeg.tar.xz \ && tar -xf ffmpeg.tar.xz && rm ffmpeg.tar.xz ffmdir = !find . -iname ffmpeg-*-static path = %env PATH path = path + ':' + ffmdir[0] %env PATH $path!which ffmpeg
Add this code to your notebook , and you will be good to go.Getting same error again.
Can you share the exact error, What are the errors you are getting Exactly?
KeyError Traceback (most recent call last)
File /srv/paws/lib/python3.10/site-packages/PIL/Image.py:2416, in Image.save(self, fp, format, **params)2415 try:-> 2416 format = EXTENSION[ext]
2417 except KeyError as e:KeyError: '.mp4'
The above exception was the direct cause of the following exception:
ValueError Traceback (most recent call last)
File /srv/paws/lib/python3.10/site-packages/bar_chart_race/_make_chart.py:435, in _BarChartRace.make_animation(self)434 else:--> 435 ret_val = anim.save(self.filename, fps=self.fps, writer=self.writer)
436 except Exception as e:File /srv/paws/lib/python3.10/site-packages/matplotlib/animation.py:1089, in Animation.save(self, filename, writer, fps, dpi, codec, bitrate, extra_args, metadata, extra_anim, savefig_kwargs, progress_callback)
1086 # canvas._is_saving = True makes the draw_event animation-starting 1087 # callback a no-op; canvas.manager = None prevents resizing the GUI 1088 # widget (both are likewise done in savefig()).-> 1089 with writer.saving(self._fig, filename, dpi), \
1090 cbook._setattr_cm(self._fig.canvas, _is_saving=True, manager=None): 1091 for anim in all_anim:File /usr/lib/python3.10/contextlib.py:142, in _GeneratorContextManager.exit(self, typ, value, traceback)
141 try:--> 142 next(self.gen)
143 except StopIteration:File /srv/paws/lib/python3.10/site-packages/matplotlib/animation.py:245, in AbstractMovieWriter.saving(self, fig, outfile, dpi, *args, **kwargs)
244 finally:--> 245 self.finish()
File /srv/paws/lib/python3.10/site-packages/matplotlib/animation.py:515, in PillowWriter.finish(self)
514 def finish(self):--> 515 self._frames[0].save(
516 self.outfile, save_all=True, append_images=self._frames[1:], 517 duration=int(1000 / self.fps), loop=0)File /srv/paws/lib/python3.10/site-packages/PIL/Image.py:2419, in Image.save(self, fp, format, **params)
2418 msg = f"unknown file extension: {ext}"-> 2419 raise ValueError(msg) from e
2421 if format.upper() not in SAVE:ValueError: unknown file extension: .mp4
During handling of the above exception, another exception occurred:
Exception Traceback (most recent call last)
Cell In[8], line 114 bcr.bar_chart_race( 5 df=df, 6 filename='AnalysisVideo.mp4', 7 title='Bar Chart Race', 8 writer='matplotlib' 9 ) 10 return 'AnalysisVideo.mp4'---> 11 video = dataframe_to_race_chart(first_20)
12 Video(video, embed=True)Cell In[8], line 4, in dataframe_to_race_chart(df)
3 def dataframe_to_race_chart(df):----> 4 bcr.bar_chart_race(
5 df=df, 6 filename='AnalysisVideo.mp4', 7 title='Bar Chart Race', 8 writer='matplotlib' 9 ) 10 return 'AnalysisVideo.mp4'File /srv/paws/lib/python3.10/site-packages/bar_chart_race/_make_chart.py:783, in bar_chart_race(df, filename, orientation, sort, n_bars, fixed_order, fixed_max, steps_per_period, period_length, interpolate_period, label_bars, bar_size, period_label, period_fmt, period_summary_func, perpendicular_bar_func, figsize, cmap, title, title_size, bar_label_size, tick_label_size, shared_fontdict, scale, writer, fig, dpi, bar_kwargs, filter_column_colors)
461 ''' 462 Create an animated bar chart race using matplotlib. Data must be in 463 'wide' format where each row represents a single time period and each (...) 776 These sizes are relative to plt.rcParams['font.size']. 777 ''' 778 bcr = _BarChartRace(df, filename, orientation, sort, n_bars, fixed_order, fixed_max, 779 steps_per_period, period_length, interpolate_period, label_bars, bar_size, 780 period_label, period_fmt, period_summary_func, perpendicular_bar_func, 781 figsize, cmap, title, title_size, bar_label_size, tick_label_size, 782 shared_fontdict, scale, writer, fig, dpi, bar_kwargs, filter_column_colors)--> 783 return bcr.make_animation()
File /srv/paws/lib/python3.10/site-packages/bar_chart_race/_make_chart.py:446, in _BarChartRace.make_animation(self)
444 else: 445 message = str(e)--> 446 raise Exception(message)
447 finally: 448 plt.rcParams = self.orig_rcParamsException: You do not have ffmpeg installed on your machine. Download
ffmpeg from here: https://www.ffmpeg.org/download.html. Matplotlib's original error message below: unknown file extension: .mp4
In T358412#9632678, @Aixvik wrote:Not able to generate video from the data frame? What might the reason be? As we have 7k+ columns and it's taking time can we generate a bar chart race video of only a few columns as an example?
And I read in the documentation that we should have 'ffmpeg' installed on our device as I am working on web paws Jupyter notebook and not locally do I also have to install 'ffmpeg'?
Mar 14 2024
In T358412#9632197, @Mitumoni_kalita wrote:In T358412#9632185, @Abishek_Das wrote:In T358412#9632174, @Mitumoni_kalita wrote:In T358412#9632167, @Abishek_Das wrote:In T358412#9632120, @Mitumoni_kalita wrote:In T358412#9631995, @Abishek_Das wrote:Are you including all the 7519 columns in your video 😅?
In T358412#9631917, @Mitumoni_kalita wrote:Thank you so much to all, It worked.
How should I proceed?
Hmm, if you're including 7519 columns, it will take time. For now, just add 5 rows and 5 columns, or 10 rows by 10 columns. I think I read in the bar chart documentation that the more rows and columns you have, the longer it takes to render.Since, it generates frame by frame something like that. Also, only play the video after your cell is done running.
Great 🥳
What should I do next? record this as a contribution or send PAWS link to @Ederporto
In T358412#9632174, @Mitumoni_kalita wrote:In T358412#9632167, @Abishek_Das wrote:In T358412#9632120, @Mitumoni_kalita wrote:In T358412#9631995, @Abishek_Das wrote:Are you including all the 7519 columns in your video 😅?
In T358412#9631917, @Mitumoni_kalita wrote:Thank you so much to all, It worked.
How should I proceed?
Hmm, if you're including 7519 columns, it will take time. For now, just add 5 rows and 5 columns, or 10 rows by 10 columns. I think I read in the bar chart documentation that the more rows and columns you have, the longer it takes to render.Since, it generates frame by frame something like that. Also, only play the video after your cell is done running.
In T358412#9632120, @Mitumoni_kalita wrote:In T358412#9631995, @Abishek_Das wrote:Are you including all the 7519 columns in your video 😅?
In T358412#9631917, @Mitumoni_kalita wrote:How should I proceed?
Hmm, if you're including 7519 columns, it will take time. For now, just add 5 rows and 5 columns, or 10 rows by 10 columns. I think I read in the bar chart documentation that the more rows and columns you have, the longer it takes to render.Since, it generates frame by frame something like that. Also, only play the video after your cell is done running.
Are you including all the 7519 columns in your video 😅?
In T358412#9631634, @Valentina_Buoro wrote:In T358412#9614248, @Abishek_Das wrote:Hello everyone, I am also an Outreachy applicant for 2024.
Today, I discovered the message on Phabricator; however, I initially assumed that all discussions were taking place in the Zulip channel. Consequently, I didn't check the Phabricator comments section.
To keep it concise, I'd like to address how to make FFmpeg work on the PAWS Jupyter Notebook for the task "Create a tool for informative infographics from structured information from Wikimedia projects - Task A."
The reason FFmpeg isn't functioning on the PAWS Jupyter Notebook is that we need to download and add FFmpeg Static Builds from (https://johnvansickle.com/ffmpeg/) to the same folder where we have the code.
Here's a step-by-step guide (So, you don't have to go through the trouble of downloading from https://johnvansickle.com/ffmpeg/):
Note: Before you do the step mentioned in point (a), make sure all the steps, i.e., b, c, d, and e, are done first.
a) I've attached code that you can add to your Jupyter Notebook cell (Same notebook where you have your code to generate the bar chart race). Run this code to resolve the FFmpeg issue.
# Download a static FFmpeg build and add it to PATH. %run 'util/load-ffmpeg.ipynb' print('Done!')b) Prior to running the code mentioned in point (a), add/upload the "util" folder to your PAWS. I've included the folder below.
util.zip864 BDownload
(You, have to unzip it after downloading)c) The purpose of the "util" folder is to automatically add the FFmpeg Static Build File (which is a folder) to your PAWS when you run the provided code mentioned in point (a).
d) Ensure that the filename in bcr.bar_chart_race() has a ".mp4" extension.
e) After completing these steps, you can run your respective code, which is the code for generating the bar chart race.
Note:
a) You might encounter a warning / Error (Which again doesn't appear when I run my code locally and only sometimes appears on my PAWS Jupyter Notebook), as shown in the attached screenshot. However, this is not an issue, as the video file will be generated in the PAWS folder after running your code. You can then download the bar chart race video and watch the video(as shown the screenshot below).
b) If your code works correctly locally, it should generally (90%-99% of the time) work on the PAWS online Jupyter Notebook.
c) The warning or error screenshot I provided may or may not appear (Which happens to me only on PAWS), so be mindful of that.
d) Ensure that the filename in bcr.bar_chart_race() has a ".mp4" extension, as the ".html" filename won't appear on PAWS. But, Again, the .html works locally.
e) Why the .html doesn't appear on PAWS, I have no idea about it, and I have still not looked for a solution related to .html since the .mp4 file is generated on PAWS without any issue.
f) All the things I have mentioned on how to solve the issue related to FFmpeg were taken from various documentation like Matplotlib 3.8.3 documentation and, of course, my favorite stack overflow (So, thanks to the Devs on Stack Overflow).
Thank you so much for this
In T358412#9631366, @MahimaSinghal wrote:In T358412#9630937, @Abishek_Das wrote:Hi, I found some good examples of project timelines from past Wikimedia Outreachy interns, which may help. You can take a look at the links below:
• https://phabricator.wikimedia.org/T161670
• https://phabricator.wikimedia.org/T177507
• https://phabricator.wikimedia.org/T333790Thankyou @Abishek_Das , But I am looking forward to timeline of the work we plan to accomplish on the project. Outlines of the task we will be doing .
Hi, I found some good examples of project timelines from past Wikimedia Outreachy interns, which may help. You can take a look at the links below:
In T358412#9628805, @Ederporto wrote:In T358412#9614274, @Abishek_Das wrote:Hello @Ederporto, for the project proposal, do we need to create one in Wikimedia Phabricator since we will also be submitting one on the Outreachy website?
You don't need to create anything on Phabricator, no.
@Mitumoni_kalita is it working now?
Mar 8 2024
you're welcome @Anachimuco , @DevJames1 , @GonzaGertrude and @Udonels 😁
Hello @Ederporto, for the project proposal, do we need to create one in Wikimedia Phabricator since we will also be submitting one on the Outreachy website?
In T358412#9614254, @Damiodunuga wrote:Hello @Ederporto please how do i get my submission reviewed
Hello everyone, I am also an Outreachy applicant for 2024.