Couldn't install the matplotlib package

The package is successfully installed in my idle using pip install matplotlib command, but then it failed when I tried to install it in my project interpreter.

The first error I got was "Cython" is not a module, so I went on to install Cython, but then it requires Microsoft Visual C++ 14.0.

So i went on and downloaded that, it worked, Cython is downloaded.

But then I still couldn't install the matplotlib, I have tried every possible way i found on the internet such as: downloading Visual C++ build tools, downloading mingw, using the command pip3 install matplotlib in PyCharm, and so on.

These are the last few lines of the error message:

UPDATING build\lib.win-amd64-3.8\matplotlib\_version.py
set build\lib.win-amd64-3.8\matplotlib\_version.py to '3.1.2'
running build_ext
building 'matplotlib.ft2font' extension
creating build\temp.win-amd64-3.8
creating build\temp.win-amd64-3.8\Release
creating build\temp.win-amd64-3.8\Release\src
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.24.28314\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DFREETYPE_BUILD_TYPE=system -DPY_ARRAY_UNIQUE_SYMBOL=MPL_matplotlib_ft2font_ARRAY_API -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -D__STDC_FORMAT_MACROS=1 -Iextern/agg24-svn/include "-IC:\Users\User\PycharmProjects\Beginners Project\venv\lib\site-packages\numpy\core\include" "-IC:\Users\User\PycharmProjects\Beginners Project\venv\include" -IC:\Users\User\AppData\Local\Programs\Python\Python38\include -IC:\Users\User\AppData\Local\Programs\Python\Python38\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.24.28314\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-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.18362.0\cppwinrt" /Tcsrc/checkdep_freetype2.c /Fobuild\temp.win-amd64-3.8\Release\src/checkdep_freetype2.obj
checkdep_freetype2.c
src/checkdep_freetype2.c(1): fatal error C1083: Cannot open include file: 'ft2build.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.24.28314\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2

----------------------------------------

Command ""C:\Users\User\PycharmProjects\Beginners Project\venv\Scripts\python.exe" -u -c "import setuptools, tokenize;__file__='C:\\Users\\User\\AppData\\Local\\Temp\\pycharm-packaging\\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:\Users\User\AppData\Local\Temp\pip-record-wa9ac9un\install-record.txt --single-version-externally-managed --compile --install-headers "C:\Users\User\PycharmProjects\Beginners Project\venv\include\site\python3.8\matplotlib"" failed with error code 1 in C:\Users\User\AppData\Local\Temp\pycharm-packaging\matplotlib\

 

Please help me, I'm already been stuck and researching this problem for over 6 hours, your help is greatly appreciated and advance with thanks.

Thank you

0
Avatar
Permanently deleted user

@... Please decrease the version of Python to 3.7, I also got a similar problem. Python 3.7 will work. It helped me as well. Cheers. Further comments are welcome.

0
Avatar
Permanently deleted user

@... Thank you so much, it worked perfectly! How did you figure that out? And do you have any ideas why the latest version of Python fails to work with matplotlib?

0

请先登录再写评论。