I'm trying to use matplotlib in python, specifically, in PyCharm IDE. I have Windows 10 and Python 3.8 and I checked that everything was up to date (like pip).
I installed matplotlib via pip with the command "pip install matplotlib", till then everything was okay because I didn't get any error in the cmd and it was successful.
The problem appears when I try to install the package into the project in PyCharm, and an error appears. I haven't found this error on any website and I've tried lots of things, like reinstalling python and PyCharm, installing the library with conda environment, also trying to install updated FreeType but I don't know how to do it...
Also, I noticed that when I import matplotlib in python.exe any error appears, so I thought the error might be in PyCharm, but this is just a speculation. Here's the error:
src/checkdep_freetype2.c(5): fatal error C1189: #error: "FreeType version 2.3 or higher is required. You may set the MPLLOCALFREETYPE environment variable to 1 to let Matplotlib download it."
I don't know how to install an updated FreeType version or setting the MPLLOCALFREETYPE to 1 as the error suggested.
If I can provide more information or more code please let me know, I don't know if I asked "correctly".
Update:
I've tried to write the command also in the terminal of venv and I think I get the same error, but with more detail, it mentions something regarding Microsoft visual studio. Here the error:
IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18
362.0\cppwinrt" /Tcsrc/checkdep_freetype2.c /Fobuild\temp.win32-3.8\Release\src/checkdep_freetype2.obj
checkdep_freetype2.c
src/checkdep_freetype2.c(5): fatal error C1189: #error: "FreeType version 2.3 or higher is required. You may set the MPLLOCALFREETYPE environment variable to 1 to let Matplotlib download
it."
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.25.28610\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2
----------------------------------------
Command "C:\Users\Samuel\PycharmProjects\untitled\venv\Scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\temp\\pip-install-pzdo9qwp\\matplotlib\\setup.py';f=getattr(tokenize,
'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\temp\pip-record-059s14h2\install-record.txt --single-version-e
xternally-managed --compile --install-headers C:\Users\Samuel\PycharmProjects\untitled\venv\include\site\python3.8\matplotlib" failed with error code 1 in C:\temp\pip-install-pzdo9qwp\matplotl
ib\```