[python viz notes] modulenotfounderror: no module named 'matplotlib'

How to solve problem for python data visualization?

modulenotfounderror: no module named ā€˜matplotlibā€™

The error shows python package matplotlib is not install.

Solution

You can try to install matplotlib with pip or conda in the terminal

with pip

pip install matplotlib

with conda

conda install matplotlib

If you got an error of pip or conda is not a command, try to install them first.

Besides, install package in virtual enivronment is always recomended, more detals at venv ā€” Creation of virtual environments ā€” Python 3.12.4 documentation