ImportError: cannot import name 'makeMappingArray' from 'matplotlib.colors'

I got an error when deploying my app:

ImportError: cannot import name ‘makeMappingArray’ from ‘matplotlib.colors’ (/home/appuser/venv/lib/python3.7/site-packages/matplotlib/colors.py)

According to Matplotlib, the function was deprecated since V3.34. See here. On my local machine, I had to copy-paste the function to the colors.py file for it to run. I got the function from this site.

In my code, I imported *matplotlib.pyplot as plt but never did I call the makeMappingArray function. Why does the streamlit app still need it to run both locally and on the streamlit sharing platform? How can it be corrected?

makeMappingArray is deprecated since matplotlib version 3.2.

1 Like

I did not even import that function. Why does streamlit log the error? The application works perfectly on my local machine

When I delete that function from the colors.py file in the matplotlib folder, the application throws the same error on the local machine. How then was it deprecated when my application still requires it to run? Is there something I am not doing right?