duke toucan
duke toucan

Reputation: 1

Python/pip failed installing Matplotlib

I have Python 3.8 installed, I was able to install numpy and scipy flawlessly. When I try to install matplotlib I get this output in my command prompt.

    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.23.28105\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:\Python38\lib\site-packages\numpy\core\include -IC:\Python38\include -IC:\Python38\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.23.28105\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.23.28105\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Python38\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\duket\\AppData\\Local\\Temp\\pip-install-6otudvqg\\matplotlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\duket\\AppData\\Local\\Temp\\pip-install-6otudvqg\\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\duket\AppData\Local\Temp\pip-record-2fr17_ng\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.

I have no idea how to fix this, I've updated pip and I have also tried to install from a .whl file but still no dice.

Any help is greatly appreciated.

EDIT: If you want the full command prompt output I made a pastebin with it here: https://pastebin.com/HNXcGrDH

Upvotes: 0

Views: 2649

Answers (2)

Binoy Pilakkat
Binoy Pilakkat

Reputation: 150

Download the prebuilt lib from Prof. Gohlke and install using pip

https://www.lfd.uci.edu/~gohlke/pythonlibs/#matplotlib

pip install matplotlib-3.1.1-cp38-cp38-win_amd64.whl

Upvotes: 1

FlyingTeller
FlyingTeller

Reputation: 20629

You are missing the freetype library that is a dependecy of matplotlib Take a look at this repo for building the required libraries for matplotlib. Note however that the latest release of matplotlib does only support python 3.7. You might still be able to build from source if you use the latest version from github, but there is no guarantee for its stability, esspecially since there are currently no official tests of matplotlib for python 3.8

Upvotes: 0

Related Questions