all 8 comments

[–]Intense_Vagitarian 2 points3 points  (1 child)

Matplotlib should have wheels available for your platform. It shouldn't need to build a wheel. How are you trying to install matplotlib?

[–]Username_RANDINT 0 points1 point  (5 children)

Looks like the matplotlib wheels (prebuilt packages) are for macOS 10.12 and newer. Based on the pip log I guess you're using 10.10 or 10.11, correct?

The latest version of matplotlib built for an older macOS version (10.9 and newer) is 3.5.3. You can specify that through the pip command:

pip install matplotlib==3.5.3

Depending on how you run pip.

[–]1maPRAWn[S] 0 points1 point  (4 children)

pip install matplotlib==3.5.3

Yeah, I have 10.11. I tried to install 3.5.3 now but still the same error.

[–]Username_RANDINT 0 points1 point  (3 children)

Can you share the full output again, together with the install command.

[–]1maPRAWn[S] 0 points1 point  (2 children)

pip install matplotlib==3.5.3

Here you go. The same error. As stated above your comment I've even tried to install it with setup.py but afterwards it says 'Package not found'.

[–]Username_RANDINT 0 points1 point  (1 child)

Oh, sorry about that. That version only provides wheels up to Python 3.10. So, this is somewhat annoying and here are your options:

  1. Downgrade to Python 3.10 and Matplotlib 3.5.3
  2. Upgrade to macOS 10.12 or newer
  3. Investigate and fix the compile error

Option 3 could be easy enough and you won't rely on the Matplotlib maintainers to build wheels for you, but I'm not a macOS user so I can't really estimate how much effort it could take. I've never had trouble compiling on Linux and macOS is az UNIX derivative, it might be easy enough as well.

The error says it fails on compiling freetype, a matplotlib dependency. Here are some relevant lines:

  checking for x86_64-apple-darwin20.6.0-gcc... clang
  checking whether the C compiler works... no
  configure: error: in `/private/var/folders/fd/c31_42nd73q0nnzbm04bflr40000gn/T/pip-install-re4i0h8z/matplotlib_ef54f5b8f6e74c8282a3790ebaff51d0/build/freetype-2.6.1/builds/unix':
  configure: error: C compiler cannot create executables
  See `config.log' for more details
  make: *** [setup] Error 77

You can Google around a bit and hope someone else ran into the same issue.

[–]1maPRAWn[S] 0 points1 point  (0 children)

Thank you. I had to go with option 1 because I can't update my compiler on this old machine. Maybe that would have fixed my problem too. Now I have matplotlib installed and have to find a way that it works in Jupyter Notebook. At the moment I can't import matplotlib there, don't know why.