If you are using an old version of plotly, then running pip install --upgrade plotly should fix this issue.
pip install --upgrade plotly