Skip to content

[Bug]: Cannot compile Matplotlib 3.7.1 on OS X 10.11 #25509

Closed as not planned
Closed as not planned

Description

@BLKSerene

Bug summary

Hi, I'm unable to compile the wheel for Matplotlib 3.7.1 on OS X 10.11.
The latest version of Matplotlib that works with OS X 10.11 is 3.5.3 (since it provides pre-built wheels).
I'm not sure whether the latest version of Matplotlib support OS X 10.11 still, or are there any work-arounds?

Code for reproduction

pip3 install matplotlib

Actual outcome

...skips a lot of copying...
      copying lib/matplotlib/mpl-data/images/move_large.png -> build/lib.macosx-10.9-universal2-cpython-39/matplotlib/mpl-data/images
      running build_ext
      creating var
      creating var/folders
      creating var/folders/_n
      creating var/folders/_n/8qwtj23j0tx0bdy7ftvpg63m0000gn
      creating var/folders/_n/8qwtj23j0tx0bdy7ftvpg63m0000gn/T
      gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -I/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c /var/folders/_n/8qwtj23j0tx0bdy7ftvpg63m0000gn/T/tmpiydqbuj3.cpp -o var/folders/_n/8qwtj23j0tx0bdy7ftvpg63m0000gn/T/tmpiydqbuj3.o -fvisibility=hidden
      gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -I/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c /var/folders/_n/8qwtj23j0tx0bdy7ftvpg63m0000gn/T/tmpa3un9zpv.cpp -o var/folders/_n/8qwtj23j0tx0bdy7ftvpg63m0000gn/T/tmpa3un9zpv.o -fvisibility-inlines-hidden
      gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -I/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c /var/folders/_n/8qwtj23j0tx0bdy7ftvpg63m0000gn/T/tmpez3g7zr9.cpp -o var/folders/_n/8qwtj23j0tx0bdy7ftvpg63m0000gn/T/tmpez3g7zr9.o -flto
      
      FreeType build system -- automatic system detection
      
      The following settings are used:
      
        platform                    unix
        compiler                    gcc
        configuration directory     ./builds/unix
        configuration rules         ./builds/unix/unix.mk
      
      If this does not correspond to your system or settings please remove the file
      `config.mk' from this directory then read the INSTALL file for help.
      
      Otherwise, simply type `/Library/Developer/CommandLineTools/usr/bin/make' again to build the library,
      or `/Library/Developer/CommandLineTools/usr/bin/make refdoc' to build the API reference (this needs python >= 2.6).
      
      Generating modules list in ./objs/ftmodule.h...
      * module: truetype  (Windows/Mac font files with extension *.ttf or *.ttc)
      * module: type1     (Postscript font files with extension *.pfa or *.pfb)
      * module: cff       (OpenType fonts with extension *.otf)
      * module: cid       (Postscript CID-keyed fonts, no known extension)
      * module: pfr       (PFR/TrueDoc font files with extension *.pfr)
      * module: type42    (Type 42 font files with no known extension)
      * module: winfnt    (Windows bitmap fonts with extension *.fnt or *.fon)
      * module: pcf       (pcf bitmap fonts)
      * module: bdf       (bdf bitmap fonts)
      * module: sfnt      (helper module for TrueType & OpenType formats)
      * module: autofit   (automatic hinting module)
      * module: pshinter  (Postscript hinter module)
      * module: raster    (monochrome bitmap renderer)
      * module: smooth    (anti-aliased bitmap renderer)
      * module: smooth    (anti-aliased bitmap renderer for LCDs)
      * module: smooth    (anti-aliased bitmap renderer for vertical LCDs)
      * module: psaux     (Postscript Type 1 & Type 2 helper module)
      * module: psnames   (Postscript & Unicode Glyph name handling)
      done.
      cd builds/unix; \
                  ./configure  '--with-zlib=no' '--with-bzip2=no' '--with-png=no' '--with-harfbuzz=no' '--enable-static' '--disable-shared' '--host=x86_64-apple-darwin20.6.0'
      checking build system type... x86_64-apple-darwin15.6.0
      checking host system type... x86_64-apple-darwin20.6.0
      checking for x86_64-apple-darwin20.6.0-gcc... gcc
      checking whether the C compiler works... no
      configure: error: in `/private/var/folders/_n/8qwtj23j0tx0bdy7ftvpg63m0000gn/T/pip-install-gsgl2hnt/matplotlib_0c58bc77da5d4f6db3f53a8832b3638d/build/freetype-2.6.1/builds/unix':
      configure: error: C compiler cannot create executables
      See `config.log' for more details
      make: *** [setup] Error 77
      Extracting /project/freetype/freetype2/2.6.1/freetype-2.6.1.tar.gz
      Building freetype in build/freetype-2.6.1
      Traceback (most recent call last):
        File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 251, in build_wheel
          return _build_backend().build_wheel(wheel_directory, config_settings,
        File "/private/var/folders/_n/8qwtj23j0tx0bdy7ftvpg63m0000gn/T/pip-build-env-kkb1c5cp/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 413, in build_wheel
          return self._build_with_temp_dir(['bdist_wheel'], '.whl',
        File "/private/var/folders/_n/8qwtj23j0tx0bdy7ftvpg63m0000gn/T/pip-build-env-kkb1c5cp/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 398, in _build_with_temp_dir
          self.run_setup()
        File "/private/var/folders/_n/8qwtj23j0tx0bdy7ftvpg63m0000gn/T/pip-build-env-kkb1c5cp/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 335, in run_setup
          exec(code, locals())
        File "<string>", line 270, in <module>
        File "/private/var/folders/_n/8qwtj23j0tx0bdy7ftvpg63m0000gn/T/pip-build-env-kkb1c5cp/overlay/lib/python3.9/site-packages/setuptools/__init__.py", line 108, in setup
          return distutils.core.setup(**attrs)
        File "/private/var/folders/_n/8qwtj23j0tx0bdy7ftvpg63m0000gn/T/pip-build-env-kkb1c5cp/overlay/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 185, in setup
          return run_commands(dist)
        File "/private/var/folders/_n/8qwtj23j0tx0bdy7ftvpg63m0000gn/T/pip-build-env-kkb1c5cp/overlay/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
          dist.run_commands()
        File "/private/var/folders/_n/8qwtj23j0tx0bdy7ftvpg63m0000gn/T/pip-build-env-kkb1c5cp/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "/private/var/folders/_n/8qwtj23j0tx0bdy7ftvpg63m0000gn/T/pip-build-env-kkb1c5cp/overlay/lib/python3.9/site-packages/setuptools/dist.py", line 1221, in run_command
          super().run_command(command)
        File "/private/var/folders/_n/8qwtj23j0tx0bdy7ftvpg63m0000gn/T/pip-build-env-kkb1c5cp/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/private/var/folders/_n/8qwtj23j0tx0bdy7ftvpg63m0000gn/T/pip-build-env-kkb1c5cp/normal/lib/python3.9/site-packages/wheel/bdist_wheel.py", line 343, in run
          self.run_command("build")
        File "/private/var/folders/_n/8qwtj23j0tx0bdy7ftvpg63m0000gn/T/pip-build-env-kkb1c5cp/overlay/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/private/var/folders/_n/8qwtj23j0tx0bdy7ftvpg63m0000gn/T/pip-build-env-kkb1c5cp/overlay/lib/python3.9/site-packages/setuptools/dist.py", line 1221, in run_command
          super().run_command(command)
        File "/private/var/folders/_n/8qwtj23j0tx0bdy7ftvpg63m0000gn/T/pip-build-env-kkb1c5cp/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/private/var/folders/_n/8qwtj23j0tx0bdy7ftvpg63m0000gn/T/pip-build-env-kkb1c5cp/overlay/lib/python3.9/site-packages/setuptools/_distutils/command/build.py", line 131, in run
          self.run_command(cmd_name)
        File "/private/var/folders/_n/8qwtj23j0tx0bdy7ftvpg63m0000gn/T/pip-build-env-kkb1c5cp/overlay/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/private/var/folders/_n/8qwtj23j0tx0bdy7ftvpg63m0000gn/T/pip-build-env-kkb1c5cp/overlay/lib/python3.9/site-packages/setuptools/dist.py", line 1221, in run_command
          super().run_command(command)
        File "/private/var/folders/_n/8qwtj23j0tx0bdy7ftvpg63m0000gn/T/pip-build-env-kkb1c5cp/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/private/var/folders/_n/8qwtj23j0tx0bdy7ftvpg63m0000gn/T/pip-build-env-kkb1c5cp/overlay/lib/python3.9/site-packages/setuptools/command/build_ext.py", line 84, in run
          _build_ext.run(self)
        File "/private/var/folders/_n/8qwtj23j0tx0bdy7ftvpg63m0000gn/T/pip-build-env-kkb1c5cp/overlay/lib/python3.9/site-packages/setuptools/_distutils/command/build_ext.py", line 345, in run
          self.build_extensions()
        File "<string>", line 183, in build_extensions
        File "/private/var/folders/_n/8qwtj23j0tx0bdy7ftvpg63m0000gn/T/pip-install-gsgl2hnt/matplotlib_0c58bc77da5d4f6db3f53a8832b3638d/setupext.py", line 654, in do_custom_build
          subprocess.check_call(configure, env=env, cwd=src_path)
        File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 373, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['./configure', '--with-zlib=no', '--with-bzip2=no', '--with-png=no', '--with-harfbuzz=no', '--enable-static', '--disable-shared', '--host=x86_64-apple-darwin20.6.0']' returned non-zero exit status 2.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for matplotlib
Failed to build matplotlib
ERROR: Could not build wheels for matplotlib, which is required to install pyproject.toml-based projects

Expected outcome

Compiled successfully

Additional information

None

Operating system

OS X 10.11

Matplotlib Version

3.7.1

Matplotlib Backend

N/A

Python version

3.9.13

Jupyter version

N/A

Installation

pip

Activity

  1. tacaswell commented on Mar 20, 2023

    @tacaswell
    Member

    Something is going wrong in compiling freetype (likely due to a miss-matched --host flag), can you see if the fix in #24168 work for you?

  2. tacaswell commented on Mar 20, 2023

    @tacaswell
    Member
          checking build system type... x86_64-apple-darwin15.6.0
          checking host system type... x86_64-apple-darwin20.6.0
    
    

    I am also not sure if this miss-match is expected or not.

  3. BLKSerene commented on Mar 20, 2023

    @BLKSerene
    Author

    Something is going wrong in compiling freetype (likely due to a miss-matched --host flag), can you see if the fix in #24168 work for you?

    I tried #24168 (comment) and #24168 (comment), but neither of them seems to work for me.

  4. greglucas commented on Mar 20, 2023

    @greglucas
    Contributor

    OSX 10.12+ is required now, see here for the details: #22240

    Although I agree that traceback is erroring from Freetype and not Matplotlib itself, so there are other issues it looks like you'll face.

  5. QuLogic commented on Mar 20, 2023

    @QuLogic
    Member

    Closing as that version of macOS is unsupported.

    Feel free to continue discussing workarounds, but there's no need to keep the issue open as there's no action here.

  6. jklymak commented on Mar 21, 2023

    @jklymak
    Member

    Is OSX 10.12 only required for the macOSx backend? I think it's possible to run Matplotlib without that, so I wonder if we should have an option to skip building that backend for older MacOS machines. Though that is a 7.5 year old operating system, so...

  7. greglucas commented on Mar 21, 2023

    @greglucas
    Contributor

    so I wonder if we should have an option to skip building that backend for older MacOS machines

    Good point @jklymak, you can edit mplsetup.cfg with macosx = False to skip the macosx backend compilation.

    [packages]
    # Some of Matplotlib's components are optional: the MacOSX backend (installed
    # by default on MacOSX; requires the Cocoa headers included with XCode), and
    # the test data (i.e., the baseline image files; not installed by default).
    # You can control whether they are installed by uncommenting the following
    # lines. Note that the MacOSX backend is never built on Linux or Windows,
    # regardless of the config value.
    #
    #tests = False
    #macosx = True

  8. jklymak commented on Mar 21, 2023

    @jklymak
    Member

    Ah cool, so macosx = False; system_freetype = True should work for an old mac

  9. BLKSerene commented on Mar 21, 2023

    @BLKSerene
    Author

    Ah cool, so macosx = False; system_freetype = True should work for an old mac

    I download and install the latest version of freetype (2.13.0), and force Matplotlib to use the system freetype when compiling, but is says:

          src/checkdep_freetype2.c:3:6: error: "FreeType version 2.3 or higher is required. You may unset the system_freetype entry in mplsetup.cfg to let Matplotlib download it."
              #error "FreeType version 2.3 or higher is required. \
               ^
          src/checkdep_freetype2.c:8:10: fatal error: 'ft2build.h' file not found
          #include <ft2build.h>
                   ^
          2 errors generated.
          error: command '/usr/bin/gcc' failed with exit code 1
          [end of output]
      
      note: This error originates from a subprocess, and is likely not a problem with pip.
      ERROR: Failed building wheel for matplotlib
    Failed to build matplotlib
    ERROR: Could not build wheels for matplotlib, which is required to install pyproject.toml-based projects
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions