Error Installing Matplotlib on Python 3.8
Asked Answered
D

3

4

I currently have Python 2.7 and Python 3.8 (downloaded the .dmg via Python.org) on my Mac OS X Catalina. I have successfully installed Numpy via Terminal, as well as Matplotlib on Python 2.7 via Terminal, but I always get two error codes when I install Matplotlib through Terminal. I've tried using different variants of inputs via terminal via troubleshooting I did in my online research, but to no avail.

Input:

pip3 install matplotlib

Output (Error #1):

ERROR: Command errored out with exit status 1:
 command: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/6l/48hzctr50x9gg5rv9zzc5jl40000gn/T/pip-install-k3_jyhbb/matplotlib/setup.py'"'"'; __file__='"'"'/private/var/folders/6l/48hzctr50x9gg5rv9zzc5jl40000gn/T/pip-install-k3_jyhbb/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 /private/var/folders/6l/48hzctr50x9gg5rv9zzc5jl40000gn/T/pip-record-9nz4sjf0/install-record.txt --single-version-externally-managed --compile
     cwd: /private/var/folders/6l/48hzctr50x9gg5rv9zzc5jl40000gn/T/pip-install-k3_jyhbb/matplotlib/
Complete output (509 lines):
IMPORTANT WARNING:
    pkg-config is not installed.
    matplotlib may not be able to find some of its dependencies
================================================================================
Edit setup.cfg to change the build options

Output (Error #2):

  gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -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 -I/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/numpy/core/include -I/Library/Frameworks/Python.framework/Versions/3.8/include/python3.8 -c src/checkdep_freetype2.c -o build/temp.macosx-10.9-x86_64-3.8/src/checkdep_freetype2.o
src/checkdep_freetype2.c:1:10: fatal error: 'ft2build.h' file not found
#include <ft2build.h>
         ^~~~~~~~~~~~
1 error generated.
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/6l/48hzctr50x9gg5rv9zzc5jl40000gn/T/pip-install-k3_jyhbb/matplotlib/setup.py'"'"'; __file__='"'"'/private/var/folders/6l/48hzctr50x9gg5rv9zzc5jl40000gn/T/pip-install-k3_jyhbb/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 /private/var/folders/6l/48hzctr50x9gg5rv9zzc5jl40000gn/T/pip-record-9nz4sjf0/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.
Daubigny answered 25/10, 2019 at 11:22 Comment(1)
The second error seems to indicate that you are missing the ft2build header. I think this is part of freetype, so I think you will need the freetype libraries to solve this second error. Maybe see #18887945Luddite
C
1

I was able to solve this by using the unnoficial packages, you can download then here and just make sure to install de requirements, you can find them on the link too, then install each package with:

pip install "SomePackage-1.0-py2.py3-none-any.whl"
Cowpox answered 18/11, 2019 at 13:55 Comment(0)
S
0

I finally found my resolution in a reddit comment by "Diapolo10" under topic "Error when installing matplotlib via pip". I was using 32-bit Python. I deleted it and installed 64-bit Python. Afterward, I was able to install the libraries without issue.

Swiss answered 28/12, 2023 at 3:22 Comment(0)
L
-2

Installed matplotlib on python 2.7

The current version of matplotlib requires Python >= 3.6, so this might be part of your challenge. But I think the first error is where the issue lays - it looks like you're missing your needed 3rd party dependencies. You can get those here: https://matplotlib.org/3.1.1/users/installing.html#building-on-macos

Feel free to paste your output in a comment if that doesn't work.

Legislative answered 26/10, 2019 at 0:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.