{"id":1153,"hash":"2994d56aa2acacec968220d804aab600e3b0d7faf58881f88fc4ae7bec8a60eb","pattern":"Pip install Matplotlib error with virtualenv","full_message":"I am trying to install matplotlib in a new virtualenv. \n\nWhen I do: \n\npip install matplotlib\n\nor\n\npip install http://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-1.1.0/matplotlib-1.1.0.tar.gz\n\nI get this error:\n\nbuilding 'matplotlib._png' extension\n\ngcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -fPIC -  DPY_ARRAY_UNIQUE_SYMBOL=MPL_ARRAY_API -DPYCXX_ISO_CPP_LIB=1 -I/usr/local/include -I/usr/include -I. -I/home/sam/django-projects/datazone/local/lib/python2.7/site-packages/numpy/core/include -I. -I/usr/include/python2.7 -c src/_png.cpp -o build/temp.linux-x86_64-2.7/src/_png.o\n\nsrc/_png.cpp:10:20: fatal error: png.h: No such file or directory\n\ncompilation terminated.\n\nerror: command 'gcc' failed with exit status 1\n\nAnyone have an idea what is going on?\n\nAny help much appreciated.","ecosystem":"pypi","package_name":"matplotlib","package_version":null,"solution":"Building Matplotlib requires libpng (and freetype, as well) which isn't a python library, so pip doesn't handle installing it (or freetype).  \n\nYou'll need to install something along the lines of libpng-devel and freetype-devel (or whatever the equivalent is for your OS).\n\nSee the building requirements/instructions for matplotlib.","confidence":0.95,"source":"stackoverflow","source_url":"https://stackoverflow.com/questions/9829175/pip-install-matplotlib-error-with-virtualenv","votes":109,"created_at":"2026-04-19T04:52:25.794533+00:00","updated_at":"2026-04-19T04:52:25.794533+00:00"}