Step by step to solve a common error in Racing Bar Chart (ffmpeg is not available)
One of cool things in Python world is bar chart race animation with Python which can show data values at different moments in time. The animated racing bar charts helps you visualize the change in trends over time.
As a Python developer, if you want to have this wonderful chart in your work, first thing you need to do is to install bar_chart_race library into your Jupyter Notebook.
pip install bar-chart-race
Now you have the library and you import it in your Jupyter Notebook, and you have your data ready, then you start to run this:
import bar_chart_race as bcr
bcr.bar_chart_race(df)
Most likely you will get error like this:
That’s right. You do not have ffmpeg installed yet even you have installed bar_chart_race library. If you follow instructor below, you can easily solve the issue.
STEP 1: Installing the Module using Anaconda Command prompt:
conda install -c conda-forge ffmpeg
The Anaconda Command prompt should have come pre-installed with Anaconda.
You can also use Windows/MAC OS prompt:
pip install ffmpeg-python
Step 2: Downloading FFmpeg build and adding a path to it in the environment variable on your computer. Go to https://www.ffmpeg.org/download.html and you should see Get packages & executable files and click one of them (Linux, Windows, and macOS). In my case, I chose Windows icon and clicked Windows builds from BtbN button which is a release version.
Recommended by LinkedIn
Then you should see next page as follow:
Step 3: Extract the downloaded zip file and rename it as FFMpeg for short and copy the folder to your OS drive. My case is the C:\ drive.
Go to the bin sub-folder and should see these three executable files:
The path is C:\ffmpeg\bin and we need add it in Environment Variables.
Step 4: Now click Start button and type env, and click Edit the system environment variables and System Properties window pops out. Click on ‘Environment Variables’ button
Click the Path and Edit... button.
Now add the above path to here by click New button and copy/paste down below.
Click Ok all the way to close all of these Windows and you are done. You can verify whether the installation was successful by going to Command Prompt and typing ‘ffmpeg -version’.
If you don't see the above image, something could go wrong and you need go back redo them again.
Now you need restart Jupyter Notebook and go back the Racing chart page to rerun it again and you should see your animated racing chart. I hope this post is helpful to you in your work.
I had the same problem. Thanks to you, I found the solution
It did the job for me. Still need to work on how to make the chart work properly. But now it is visible and moving as it should. Thanks Man
Very helpfull, man. Thanks a lot