However, you may face the error “ImportError Plotly Express requires pandas to be installed” when importing the Plotly Express.
An example case is shown in the following:
As we can see from the given screenshot, importing the Plotly Express returns an error.
Let us discuss why this error occurs and how we can resolve it in this short tutorial.
What Causes This Error?
If you are just starting with Plotly, you may think installing the Plotly package should have everything you need. While this is true when working with graph_objects, Plotly Express requires Pandas as a dependency.
Therefore, you need to install the Pandas before using Plotly Express.
Solution
As mentioned, Plotly Express requires Pandas as a dependency. Hence, you need to install the Pandas in your Python environment to resolve this issue.
Run the following command:
If you are running the Python 2. x, install Pandas with the following command:
If you are using Anaconda as the Python environment, you can use conda as follows:
Once installed, you can test if the Plotly Express is working by running the following command:
>>>
Congratulations! You successfully solved the error.
Conclusion
This short tutorial shows you how to resolve the “ImportError Plotly express requires Pandas to be installed” error when importing the Plotly Express.
Thanks for reading!!