Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Bug]: subprocess-exited-with-error when trying to build on M1 mac #24168

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kwsp opened this issue Oct 14, 2022 · 26 comments
Closed

[Bug]: subprocess-exited-with-error when trying to build on M1 mac #24168

kwsp opened this issue Oct 14, 2022 · 26 comments
Milestone

Comments

@kwsp
Copy link
Contributor

kwsp commented Oct 14, 2022

Bug summary

Following the setup guide, I cloned the repo, created a conda environment, and when I try to run python -m pip install -ve . , it throws a subprocess-exited-with-error exception.

I have all the development dependencies installed, so I'm not sure what could be going wrong.

Code for reproduction

python -m pip install -ve .

Actual outcome

(mpl-dev) ~/code/py/matplotlib (main ✗) SETUPTOOLS_ENABLE_FEATURES="legacy-editable" python -m pip install -ve .
Using pip 22.2.2 from /opt/homebrew/Caskroom/miniforge/base/envs/mpl-dev/lib/python3.10/site-packages/pip (python 3.10)
Obtaining file:///Users/tnie/code/py/matplotlib
  Running command pip subprocess to install build dependencies
  Collecting certifi>=2020.06.20
    Using cached certifi-2022.9.24-py3-none-any.whl (161 kB)
  Collecting numpy>=1.19
    Using cached numpy-1.23.4-cp310-cp310-macosx_11_0_arm64.whl (13.3 MB)
  Collecting setuptools_scm>=7
    Using cached setuptools_scm-7.0.5-py3-none-any.whl (42 kB)
  Collecting tomli>=1.0.0
    Using cached tomli-2.0.1-py3-none-any.whl (12 kB)
  Collecting packaging>=20.0
    Using cached packaging-21.3-py3-none-any.whl (40 kB)
  Collecting setuptools
    Using cached setuptools-65.5.0-py3-none-any.whl (1.2 MB)
  Collecting typing-extensions
    Using cached typing_extensions-4.4.0-py3-none-any.whl (26 kB)
  Collecting pyparsing!=3.0.5,>=2.0.2
    Using cached pyparsing-3.0.9-py3-none-any.whl (98 kB)
  Installing collected packages: typing-extensions, tomli, setuptools, pyparsing, numpy, certifi, packaging, setuptools_scm
  Successfully installed certifi-2022.9.24 numpy-1.23.4 packaging-21.3 pyparsing-3.0.9 setuptools-65.5.0 setuptools_scm-7.0.5 tomli-2.0.1 typing-extensions-4.4.0
  Installing build dependencies ... done
  Running command Checking if build backend supports build_editable
  Checking if build backend supports build_editable ... done
  Running command Getting requirements to build wheel
  /private/var/folders/xy/7rx63bwx6c9_0n5d50q5j5xh0000gn/T/pip-build-env-yure_ojr/overlay/lib/python3.10/site-packages/setuptools/dist.py:286: SetuptoolsDeprecationWarning: The namespace_packages parameter is deprecated, consider using implicit namespaces instead (PEP 420).
    warnings.warn(msg, SetuptoolsDeprecationWarning)

  Edit mplsetup.cfg to change the build options; suppress output with --quiet.

  BUILDING MATPLOTLIB
        python: yes [3.10.6 | packaged by conda-forge | (main, Aug 22 2022,
                    20:41:22) [Clang 13.0.1 ]]
      platform: yes [darwin]
         tests: no  [skipping due to configuration]
        macosx: yes [installing]

  running egg_info
  writing lib/matplotlib.egg-info/PKG-INFO
  writing dependency_links to lib/matplotlib.egg-info/dependency_links.txt
  writing namespace_packages to lib/matplotlib.egg-info/namespace_packages.txt
  writing requirements to lib/matplotlib.egg-info/requires.txt
  writing top-level names to lib/matplotlib.egg-info/top_level.txt
  adding license file 'LICENSE/LICENSE'
  adding license file 'LICENSE/LICENSE_AMSFONTS'
  adding license file 'LICENSE/LICENSE_BAKOMA'
  adding license file 'LICENSE/LICENSE_CARLOGO'
  adding license file 'LICENSE/LICENSE_COLORBREWER'
  adding license file 'LICENSE/LICENSE_COURIERTEN'
  adding license file 'LICENSE/LICENSE_JSXTOOLS_RESIZE_OBSERVER'
  adding license file 'LICENSE/LICENSE_QT4_EDITOR'
  adding license file 'LICENSE/LICENSE_SOLARIZED'
  adding license file 'LICENSE/LICENSE_STIX'
  adding license file 'LICENSE/LICENSE_YORICK'
  writing manifest file 'lib/matplotlib.egg-info/SOURCES.txt'
  Getting requirements to build wheel ... done
  Running command pip subprocess to install backend dependencies
  Collecting wheel
    Using cached wheel-0.37.1-py2.py3-none-any.whl (35 kB)
  Installing collected packages: wheel
  Successfully installed wheel-0.37.1
  Installing backend dependencies ... done
  Running command Preparing metadata (pyproject.toml)
  /private/var/folders/xy/7rx63bwx6c9_0n5d50q5j5xh0000gn/T/pip-build-env-yure_ojr/overlay/lib/python3.10/site-packages/setuptools/dist.py:286: SetuptoolsDeprecationWarning: The namespace_packages parameter is deprecated, consider using implicit namespaces instead (PEP 420).
    warnings.warn(msg, SetuptoolsDeprecationWarning)

  Edit mplsetup.cfg to change the build options; suppress output with --quiet.

  BUILDING MATPLOTLIB
        python: yes [3.10.6 | packaged by conda-forge | (main, Aug 22 2022,
                    20:41:22) [Clang 13.0.1 ]]
      platform: yes [darwin]
         tests: no  [skipping due to configuration]
        macosx: yes [installing]

  running dist_info
  creating /private/var/folders/xy/7rx63bwx6c9_0n5d50q5j5xh0000gn/T/pip-modern-metadata-fj_hu2nd/matplotlib.egg-info
  writing /private/var/folders/xy/7rx63bwx6c9_0n5d50q5j5xh0000gn/T/pip-modern-metadata-fj_hu2nd/matplotlib.egg-info/PKG-INFO
  writing dependency_links to /private/var/folders/xy/7rx63bwx6c9_0n5d50q5j5xh0000gn/T/pip-modern-metadata-fj_hu2nd/matplotlib.egg-info/dependency_links.txt
  writing namespace_packages to /private/var/folders/xy/7rx63bwx6c9_0n5d50q5j5xh0000gn/T/pip-modern-metadata-fj_hu2nd/matplotlib.egg-info/namespace_packages.txt
  writing requirements to /private/var/folders/xy/7rx63bwx6c9_0n5d50q5j5xh0000gn/T/pip-modern-metadata-fj_hu2nd/matplotlib.egg-info/requires.txt
  writing top-level names to /private/var/folders/xy/7rx63bwx6c9_0n5d50q5j5xh0000gn/T/pip-modern-metadata-fj_hu2nd/matplotlib.egg-info/top_level.txt
  writing manifest file '/private/var/folders/xy/7rx63bwx6c9_0n5d50q5j5xh0000gn/T/pip-modern-metadata-fj_hu2nd/matplotlib.egg-info/SOURCES.txt'
  adding license file 'LICENSE/LICENSE'
  adding license file 'LICENSE/LICENSE_AMSFONTS'
  adding license file 'LICENSE/LICENSE_BAKOMA'
  adding license file 'LICENSE/LICENSE_CARLOGO'
  adding license file 'LICENSE/LICENSE_COLORBREWER'
  adding license file 'LICENSE/LICENSE_COURIERTEN'
  adding license file 'LICENSE/LICENSE_JSXTOOLS_RESIZE_OBSERVER'
  adding license file 'LICENSE/LICENSE_QT4_EDITOR'
  adding license file 'LICENSE/LICENSE_SOLARIZED'
  adding license file 'LICENSE/LICENSE_STIX'
  adding license file 'LICENSE/LICENSE_YORICK'
  writing manifest file '/private/var/folders/xy/7rx63bwx6c9_0n5d50q5j5xh0000gn/T/pip-modern-metadata-fj_hu2nd/matplotlib.egg-info/SOURCES.txt'
  creating '/private/var/folders/xy/7rx63bwx6c9_0n5d50q5j5xh0000gn/T/pip-modern-metadata-fj_hu2nd/matplotlib-0.1.0.dev44573+g1f9dc78.d20221014.dist-info'
  adding license file "LICENSE/LICENSE_CARLOGO" (matched pattern "LICENSE/*")
  adding license file "LICENSE/LICENSE" (matched pattern "LICENSE/*")
  adding license file "LICENSE/LICENSE_SOLARIZED" (matched pattern "LICENSE/*")
  adding license file "LICENSE/LICENSE_AMSFONTS" (matched pattern "LICENSE/*")
  adding license file "LICENSE/LICENSE_BAKOMA" (matched pattern "LICENSE/*")
  adding license file "LICENSE/LICENSE_QT4_EDITOR" (matched pattern "LICENSE/*")
  adding license file "LICENSE/LICENSE_STIX" (matched pattern "LICENSE/*")
  adding license file "LICENSE/LICENSE_JSXTOOLS_RESIZE_OBSERVER" (matched pattern "LICENSE/*")
  adding license file "LICENSE/LICENSE_YORICK" (matched pattern "LICENSE/*")
  adding license file "LICENSE/LICENSE_COLORBREWER" (matched pattern "LICENSE/*")
  adding license file "LICENSE/LICENSE_COURIERTEN" (matched pattern "LICENSE/*")
  Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: pillow>=6.2.0 in /opt/homebrew/Caskroom/miniforge/base/envs/mpl-dev/lib/python3.10/site-packages (from matplotlib==0.1.0.dev44573+g1f9dc78.d20221014) (9.2.0)
Requirement already satisfied: fonttools>=4.22.0 in /opt/homebrew/Caskroom/miniforge/base/envs/mpl-dev/lib/python3.10/site-packages (from matplotlib==0.1.0.dev44573+g1f9dc78.d20221014) (4.37.4)
Requirement already satisfied: setuptools-scm>=7 in /opt/homebrew/Caskroom/miniforge/base/envs/mpl-dev/lib/python3.10/site-packages (from matplotlib==0.1.0.dev44573+g1f9dc78.d20221014) (7.0.5)
Requirement already satisfied: cycler>=0.10 in /opt/homebrew/Caskroom/miniforge/base/envs/mpl-dev/lib/python3.10/site-packages (from matplotlib==0.1.0.dev44573+g1f9dc78.d20221014) (0.11.0)
Requirement already satisfied: python-dateutil>=2.7 in /opt/homebrew/Caskroom/miniforge/base/envs/mpl-dev/lib/python3.10/site-packages (from matplotlib==0.1.0.dev44573+g1f9dc78.d20221014) (2.8.2)
Requirement already satisfied: kiwisolver>=1.0.1 in /opt/homebrew/Caskroom/miniforge/base/envs/mpl-dev/lib/python3.10/site-packages (from matplotlib==0.1.0.dev44573+g1f9dc78.d20221014) (1.4.4)
Requirement already satisfied: contourpy>=1.0.1 in /opt/homebrew/Caskroom/miniforge/base/envs/mpl-dev/lib/python3.10/site-packages (from matplotlib==0.1.0.dev44573+g1f9dc78.d20221014) (1.0.5)
Requirement already satisfied: pyparsing>=2.2.1 in /opt/homebrew/Caskroom/miniforge/base/envs/mpl-dev/lib/python3.10/site-packages (from matplotlib==0.1.0.dev44573+g1f9dc78.d20221014) (3.0.9)
Requirement already satisfied: numpy>=1.19 in /opt/homebrew/Caskroom/miniforge/base/envs/mpl-dev/lib/python3.10/site-packages (from matplotlib==0.1.0.dev44573+g1f9dc78.d20221014) (1.23.3)
Requirement already satisfied: packaging>=20.0 in /opt/homebrew/Caskroom/miniforge/base/envs/mpl-dev/lib/python3.10/site-packages (from matplotlib==0.1.0.dev44573+g1f9dc78.d20221014) (21.3)
Requirement already satisfied: six>=1.5 in /opt/homebrew/Caskroom/miniforge/base/envs/mpl-dev/lib/python3.10/site-packages (from python-dateutil>=2.7->matplotlib==0.1.0.dev44573+g1f9dc78.d20221014) (1.16.0)
Requirement already satisfied: setuptools in /opt/homebrew/Caskroom/miniforge/base/envs/mpl-dev/lib/python3.10/site-packages (from setuptools-scm>=7->matplotlib==0.1.0.dev44573+g1f9dc78.d20221014) (65.5.0)
Requirement already satisfied: tomli>=1.0.0 in /opt/homebrew/Caskroom/miniforge/base/envs/mpl-dev/lib/python3.10/site-packages (from setuptools-scm>=7->matplotlib==0.1.0.dev44573+g1f9dc78.d20221014) (2.0.1)
Requirement already satisfied: typing-extensions in /opt/homebrew/Caskroom/miniforge/base/envs/mpl-dev/lib/python3.10/site-packages (from setuptools-scm>=7->matplotlib==0.1.0.dev44573+g1f9dc78.d20221014) (4.4.0)
Installing collected packages: matplotlib
  Attempting uninstall: matplotlib
    Found existing installation: matplotlib 3.6.1
    Uninstalling matplotlib-3.6.1:
      Removing file or directory /opt/homebrew/Caskroom/miniforge/base/envs/mpl-dev/lib/python3.10/site-packages/__pycache__/pylab.cpython-310.pyc
      Removing file or directory /opt/homebrew/Caskroom/miniforge/base/envs/mpl-dev/lib/python3.10/site-packages/matplotlib-3.6.1-py3.10-nspkg.pth
      Removing file or directory /opt/homebrew/Caskroom/miniforge/base/envs/mpl-dev/lib/python3.10/site-packages/matplotlib-3.6.1.dist-info/
      Removing file or directory /opt/homebrew/Caskroom/miniforge/base/envs/mpl-dev/lib/python3.10/site-packages/matplotlib/
      Removing file or directory /opt/homebrew/Caskroom/miniforge/base/envs/mpl-dev/lib/python3.10/site-packages/mpl_toolkits/axes_grid1/
      Removing file or directory /opt/homebrew/Caskroom/miniforge/base/envs/mpl-dev/lib/python3.10/site-packages/mpl_toolkits/axisartist/
      Removing file or directory /opt/homebrew/Caskroom/miniforge/base/envs/mpl-dev/lib/python3.10/site-packages/mpl_toolkits/mplot3d/
      Removing file or directory /opt/homebrew/Caskroom/miniforge/base/envs/mpl-dev/lib/python3.10/site-packages/mpl_toolkits/tests/
      Removing file or directory /opt/homebrew/Caskroom/miniforge/base/envs/mpl-dev/lib/python3.10/site-packages/pylab.py
      Successfully uninstalled matplotlib-3.6.1
  Running setup.py develop for matplotlib
    Running command python setup.py develop
    /private/var/folders/xy/7rx63bwx6c9_0n5d50q5j5xh0000gn/T/pip-build-env-yure_ojr/overlay/lib/python3.10/site-packages/setuptools/dist.py:286: SetuptoolsDeprecationWarning: The namespace_packages parameter is deprecated, consider using implicit namespaces instead (PEP 420).
      warnings.warn(msg, SetuptoolsDeprecationWarning)

    Edit mplsetup.cfg to change the build options; suppress output with --quiet.

    BUILDING MATPLOTLIB
          python: yes [3.10.6 | packaged by conda-forge | (main, Aug 22 2022,
                      20:41:22) [Clang 13.0.1 ]]
        platform: yes [darwin]
           tests: no  [skipping due to configuration]
          macosx: yes [installing]

    running develop
    /private/var/folders/xy/7rx63bwx6c9_0n5d50q5j5xh0000gn/T/pip-build-env-yure_ojr/overlay/lib/python3.10/site-packages/setuptools/command/easy_install.py:144: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
      warnings.warn(
    /private/var/folders/xy/7rx63bwx6c9_0n5d50q5j5xh0000gn/T/pip-build-env-yure_ojr/overlay/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
      warnings.warn(
    running egg_info
    writing lib/matplotlib.egg-info/PKG-INFO
    writing dependency_links to lib/matplotlib.egg-info/dependency_links.txt
    writing namespace_packages to lib/matplotlib.egg-info/namespace_packages.txt
    writing requirements to lib/matplotlib.egg-info/requires.txt
    writing top-level names to lib/matplotlib.egg-info/top_level.txt
    adding license file 'LICENSE/LICENSE'
    adding license file 'LICENSE/LICENSE_AMSFONTS'
    adding license file 'LICENSE/LICENSE_BAKOMA'
    adding license file 'LICENSE/LICENSE_CARLOGO'
    adding license file 'LICENSE/LICENSE_COLORBREWER'
    adding license file 'LICENSE/LICENSE_COURIERTEN'
    adding license file 'LICENSE/LICENSE_JSXTOOLS_RESIZE_OBSERVER'
    adding license file 'LICENSE/LICENSE_QT4_EDITOR'
    adding license file 'LICENSE/LICENSE_SOLARIZED'
    adding license file 'LICENSE/LICENSE_STIX'
    adding license file 'LICENSE/LICENSE_YORICK'
    writing manifest file 'lib/matplotlib.egg-info/SOURCES.txt'
    running build_ext
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /opt/homebrew/Caskroom/miniforge/base/envs/mpl-dev/include -arch arm64 -fPIC -O2 -isystem /opt/homebrew/Caskroom/miniforge/base/envs/mpl-dev/include -arch arm64 -I/opt/homebrew/Caskroom/miniforge/base/envs/mpl-dev/include/python3.10 -c /var/folders/xy/7rx63bwx6c9_0n5d50q5j5xh0000gn/T/tmpw_eu7bd5.cpp -o var/folders/xy/7rx63bwx6c9_0n5d50q5j5xh0000gn/T/tmpw_eu7bd5.o -fvisibility=hidden
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /opt/homebrew/Caskroom/miniforge/base/envs/mpl-dev/include -arch arm64 -fPIC -O2 -isystem /opt/homebrew/Caskroom/miniforge/base/envs/mpl-dev/include -arch arm64 -I/opt/homebrew/Caskroom/miniforge/base/envs/mpl-dev/include/python3.10 -c /var/folders/xy/7rx63bwx6c9_0n5d50q5j5xh0000gn/T/tmpkkqo0md2.cpp -o var/folders/xy/7rx63bwx6c9_0n5d50q5j5xh0000gn/T/tmpkkqo0md2.o -fvisibility-inlines-hidden
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /opt/homebrew/Caskroom/miniforge/base/envs/mpl-dev/include -arch arm64 -fPIC -O2 -isystem /opt/homebrew/Caskroom/miniforge/base/envs/mpl-dev/include -arch arm64 -I/opt/homebrew/Caskroom/miniforge/base/envs/mpl-dev/include/python3.10 -c /var/folders/xy/7rx63bwx6c9_0n5d50q5j5xh0000gn/T/tmp2rkel642.cpp -o var/folders/xy/7rx63bwx6c9_0n5d50q5j5xh0000gn/T/tmp2rkel642.o -flto

    FreeType build system -- automatic system detection

    The following settings are used:

      platform                    unix
      compiler                    clang
      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).

    cd builds/unix; \
                ./configure  '--with-zlib=no' '--with-bzip2=no' '--with-png=no' '--with-harfbuzz=no' '--enable-static' '--disable-shared' '--host=arm64-apple-darwin20.0.0'
    checking build system type... arm-apple-darwin21.5.0
    checking host system type... Invalid configuration `arm64-apple-darwin20.0.0': machine `arm64-apple' not recognized
    configure: error: /bin/sh ./config.sub arm64-apple-darwin20.0.0 failed
    make: *** [setup] Error 1
    Traceback (most recent call last):
      File "<string>", line 2, in <module>
      File "<pip-setuptools-caller>", line 34, in <module>
      File "/Users/tnie/code/py/matplotlib/setup.py", line 270, in <module>
        setup(  # Finally, pass this all along to setuptools to do the heavy lifting.
      File "/private/var/folders/xy/7rx63bwx6c9_0n5d50q5j5xh0000gn/T/pip-build-env-yure_ojr/overlay/lib/python3.10/site-packages/setuptools/__init__.py", line 87, in setup
        return distutils.core.setup(**attrs)
      File "/private/var/folders/xy/7rx63bwx6c9_0n5d50q5j5xh0000gn/T/pip-build-env-yure_ojr/overlay/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 185, in setup
        return run_commands(dist)
      File "/private/var/folders/xy/7rx63bwx6c9_0n5d50q5j5xh0000gn/T/pip-build-env-yure_ojr/overlay/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
        dist.run_commands()
      File "/private/var/folders/xy/7rx63bwx6c9_0n5d50q5j5xh0000gn/T/pip-build-env-yure_ojr/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 968, in run_commands
        self.run_command(cmd)
      File "/private/var/folders/xy/7rx63bwx6c9_0n5d50q5j5xh0000gn/T/pip-build-env-yure_ojr/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 1217, in run_command
        super().run_command(command)
      File "/private/var/folders/xy/7rx63bwx6c9_0n5d50q5j5xh0000gn/T/pip-build-env-yure_ojr/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 987, in run_command
        cmd_obj.run()
      File "/private/var/folders/xy/7rx63bwx6c9_0n5d50q5j5xh0000gn/T/pip-build-env-yure_ojr/overlay/lib/python3.10/site-packages/setuptools/command/develop.py", line 34, in run
        self.install_for_development()
      File "/private/var/folders/xy/7rx63bwx6c9_0n5d50q5j5xh0000gn/T/pip-build-env-yure_ojr/overlay/lib/python3.10/site-packages/setuptools/command/develop.py", line 114, in install_for_development
        self.run_command('build_ext')
      File "/private/var/folders/xy/7rx63bwx6c9_0n5d50q5j5xh0000gn/T/pip-build-env-yure_ojr/overlay/lib/python3.10/site-packages/setuptools/_distutils/cmd.py", line 319, in run_command
        self.distribution.run_command(command)
      File "/private/var/folders/xy/7rx63bwx6c9_0n5d50q5j5xh0000gn/T/pip-build-env-yure_ojr/overlay/lib/python3.10/site-packages/setuptools/dist.py", line 1217, in run_command
        super().run_command(command)
      File "/private/var/folders/xy/7rx63bwx6c9_0n5d50q5j5xh0000gn/T/pip-build-env-yure_ojr/overlay/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 987, in run_command
        cmd_obj.run()
      File "/private/var/folders/xy/7rx63bwx6c9_0n5d50q5j5xh0000gn/T/pip-build-env-yure_ojr/overlay/lib/python3.10/site-packages/setuptools/command/build_ext.py", line 84, in run
        _build_ext.run(self)
      File "/private/var/folders/xy/7rx63bwx6c9_0n5d50q5j5xh0000gn/T/pip-build-env-yure_ojr/overlay/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 346, in run
        self.build_extensions()
      File "/Users/tnie/code/py/matplotlib/setup.py", line 183, in build_extensions
        package.do_custom_build(env)
      File "/Users/tnie/code/py/matplotlib/setupext.py", line 641, in do_custom_build
        subprocess.check_call(configure, env=env, cwd=src_path)
      File "/opt/homebrew/Caskroom/miniforge/base/envs/mpl-dev/lib/python3.10/subprocess.py", line 369, 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=arm64-apple-darwin20.0.0']' returned non-zero exit status 2.
    Building freetype in build/freetype-2.6.1
    error: subprocess-exited-with-error

    × python setup.py develop did not run successfully.
    │ exit code: 1
    ╰─> See above for output.

    note: This error originates from a subprocess, and is likely not a problem with pip.
    full command: /opt/homebrew/Caskroom/miniforge/base/envs/mpl-dev/bin/python -c '
    exec(compile('"'"''"'"''"'"'
    # This is <pip-setuptools-caller> -- a caller that pip uses to run setup.py
    #
    # - It imports setuptools before invoking setup.py, to enable projects that directly
    #   import from `distutils.core` to work with newer packaging standards.
    # - It provides a clear error message when setuptools is not installed.
    # - It sets `sys.argv[0]` to the underlying `setup.py`, when invoking `setup.py` so
    #   setuptools doesn'"'"'t think the script is `-c`. This avoids the following warning:
    #     manifest_maker: standard file '"'"'-c'"'"' not found".
    # - It generates a shim setup.py, for handling setup.cfg-only projects.
    import os, sys, tokenize

    try:
        import setuptools
    except ImportError as error:
        print(
            "ERROR: Can not execute `setup.py` since setuptools is not available in "
            "the build environment.",
            file=sys.stderr,
        )
        sys.exit(1)

    __file__ = %r
    sys.argv[0] = __file__

    if os.path.exists(__file__):
        filename = __file__
        with tokenize.open(__file__) as f:
            setup_py_code = f.read()
    else:
        filename = "<auto-generated setuptools caller>"
        setup_py_code = "from setuptools import setup; setup()"

    exec(compile(setup_py_code, filename, "exec"))
    '"'"''"'"''"'"' % ('"'"'/Users/tnie/code/py/matplotlib/setup.py'"'"',), "<pip-setuptools-caller>", "exec"))' develop --no-deps
    cwd: /Users/tnie/code/py/matplotlib/
  Rolling back uninstall of matplotlib
  Moving to /opt/homebrew/Caskroom/miniforge/base/envs/mpl-dev/lib/python3.10/site-packages/__pycache__/pylab.cpython-310.pyc
   from /private/var/folders/xy/7rx63bwx6c9_0n5d50q5j5xh0000gn/T/pip-uninstall-4nkxktri/pylab.cpython-310.pyc
  Moving to /opt/homebrew/Caskroom/miniforge/base/envs/mpl-dev/lib/python3.10/site-packages/matplotlib-3.6.1-py3.10-nspkg.pth
   from /private/var/folders/xy/7rx63bwx6c9_0n5d50q5j5xh0000gn/T/pip-uninstall-wsgach0q/matplotlib-3.6.1-py3.10-nspkg.pth
  Moving to /opt/homebrew/Caskroom/miniforge/base/envs/mpl-dev/lib/python3.10/site-packages/matplotlib-3.6.1.dist-info/
   from /opt/homebrew/Caskroom/miniforge/base/envs/mpl-dev/lib/python3.10/site-packages/~atplotlib-3.6.1.dist-info
  Moving to /opt/homebrew/Caskroom/miniforge/base/envs/mpl-dev/lib/python3.10/site-packages/matplotlib/
   from /opt/homebrew/Caskroom/miniforge/base/envs/mpl-dev/lib/python3.10/site-packages/~atplotlib
  Moving to /opt/homebrew/Caskroom/miniforge/base/envs/mpl-dev/lib/python3.10/site-packages/mpl_toolkits/axes_grid1/
   from /opt/homebrew/Caskroom/miniforge/base/envs/mpl-dev/lib/python3.10/site-packages/mpl_toolkits/~xes_grid1
  Moving to /opt/homebrew/Caskroom/miniforge/base/envs/mpl-dev/lib/python3.10/site-packages/mpl_toolkits/axisartist/
   from /opt/homebrew/Caskroom/miniforge/base/envs/mpl-dev/lib/python3.10/site-packages/mpl_toolkits/~xisartist
  Moving to /opt/homebrew/Caskroom/miniforge/base/envs/mpl-dev/lib/python3.10/site-packages/mpl_toolkits/mplot3d/
   from /opt/homebrew/Caskroom/miniforge/base/envs/mpl-dev/lib/python3.10/site-packages/mpl_toolkits/~plot3d
  Moving to /opt/homebrew/Caskroom/miniforge/base/envs/mpl-dev/lib/python3.10/site-packages/mpl_toolkits/tests/
   from /opt/homebrew/Caskroom/miniforge/base/envs/mpl-dev/lib/python3.10/site-packages/mpl_toolkits/~ests
  Moving to /opt/homebrew/Caskroom/miniforge/base/envs/mpl-dev/lib/python3.10/site-packages/pylab.py
   from /private/var/folders/xy/7rx63bwx6c9_0n5d50q5j5xh0000gn/T/pip-uninstall-wsgach0q/pylab.py
error: subprocess-exited-with-error

× python setup.py develop did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

Expected outcome

Matplotlib should build successfully.

Additional information

No response

Operating system

macOS 12.4

Matplotlib Version

trunk

Matplotlib Backend

No response

Python version

Python 3.10.6

Jupyter version

No response

Installation

No response

@oscargus
Copy link
Member

Not that it really helps, but the problem seems to be with building FreeType:

    checking build system type... arm-apple-darwin21.5.0
    checking host system type... Invalid configuration `arm64-apple-darwin20.0.0': machine `arm64-apple' not recognized

So it seems like the configure script for FreeType doesn't have support for arm64-apple.

@kwsp
Copy link
Contributor Author

kwsp commented Oct 24, 2022

I see. Let's leave this open for now for the folks who are confused about why matplotlib doesn't build on their M1 mac.

@jklymak
Copy link
Member

jklymak commented Oct 24, 2022

I build all the time on my arm-based Mac, but I don't use a brew-based Python. I install Python and Matplotlib via conda, and then I pip install in an environment.

@dopplershift
Copy link
Contributor

So for conda we copy in some more modern autotools configs in order to successfully build the "legacy" freetype 2.6.1 on newer platforms.

@jklymak
Copy link
Member

jklymak commented Oct 24, 2022

Can you clarify? I remember something to do with specifying clang a couple of years ago, but my current machine, which I built fresh, didn't need anything that I recall.

@dopplershift
Copy link
Contributor

@jklymak
Copy link
Member

jklymak commented Oct 24, 2022

Thanks! So, almost certainly, I'm avoiding that by installing prebuilt Matplotlib via conda first and then pip installing the editable install. I really recommend most people do that, at least for now while our conda install installs the old freetype.

@tacaswell
Copy link
Member

https://github.com/tacaswell/build_the_world/blob/4379e6c0b13144b56ae44438e024bee07ed0f147/build_py_env.xsh#L16-L41 is the darwin specific flags I had to set to get the scipy stack to compile on an M1.

is very suggestive to be related:

    # un-comment these to build freetype with CF compilers
    # del $host_alias
    # del $build_alias

From this traceback it is unclear to me if you are using the homebrew compiler or the conda-forge compilers.

@kwsp
Copy link
Contributor Author

kwsp commented Oct 24, 2022

My compiler is from apple CommandLineTools (this is from within the conda environment, I stripped the (mpl-dev) and paths etc.

~ clang --version
Apple clang version 13.1.6 (clang-1316.0.21.2.5)
Target: arm64-apple-darwin21.5.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
~ which clang
/usr/bin/clang

@jklymak I just installed prebuilt matplotlib through conda first, then tried an editable install, but the FreeType build failed again

@kwsp
Copy link
Contributor Author

kwsp commented Oct 24, 2022

I successfully built matplotlib after forcing it to use the system FreeType by adding this in mplsetup.cfg

[libs]
system_freetype = True

@jklymak
Copy link
Member

jklymak commented Oct 24, 2022

I don't get the freetype compile step. Are you installing from conda-forge channel? conda list | grep matplotlib.

You can use the system freetype, but many of your image tests are going to fail if you want to run our tests.

@kwsp
Copy link
Contributor Author

kwsp commented Oct 24, 2022

~ conda list | grep matplotlib
matplotlib                0.1.0.dev44575+g0aa73a2          pypi_0    pypi
matplotlib-inline         0.1.6              pyhd8ed1ab_0    conda-forge

I think I do have conda-forge by default because when the M1 first came out, most packages supporting M1 were only available on conda-forge

@tacaswell
Copy link
Member

I can reproduce this failure locally. It work for me a few months ago and I am unsure what changed (but have not had time to debug yet).

@QuLogic
Copy link
Member

QuLogic commented Oct 25, 2022

Does forcing an autoreconf work? (Note, this wold mean requiring autotools to be available to build from source.)

diff --git a/setupext.py b/setupext.py
index 0387223b94..2b675a4f82 100644
--- a/setupext.py
+++ b/setupext.py
@@ -623,8 +623,7 @@ class FreeType(SetupPackage):
                 **env,
             }
             configure_ac = Path(src_path, "builds/unix/configure.ac")
-            if ((src_path / "autogen.sh").exists()
-                    and not configure_ac.exists()):
+            if (src_path / "autogen.sh").exists():
                 print(f"{configure_ac} does not exist. "
                       f"Using sh autogen.sh to generate.")
                 subprocess.check_call(

@tacaswell
Copy link
Member

It gets farther, but runs into differnt issues

    make: Nothing to be done for `unix'.
    ./builds/unix/libtool --mode=compile clang -pedantic -ansi -I/Users/tcaswell/source/p/matplotlib/matplotlib/build/freetype-2.6.1/objs -I./builds/unix -I/Users/tcaswell/source/p/matplotlib/matplotlib/build/freetype-2.6.1/include -fvisibility=hidden -flto -c -Wall -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -fwrapv -O2 -Wall -fPIC   -O2  -isystem /Users/tcaswell/miniforge3/envs/mpl-dev/include -arch arm64  -fPIC   -O2  -isystem /Users/tcaswell/miniforge3/envs/mpl-dev/include -arch arm64  -fPIC -DDARWIN_NO_CARBON -DFT_CONFIG_CONFIG_H="<ftconfig.h>" -DFT2_BUILD_LIBRARY -DFT_CONFIG_MODULES_H="<ftmodule.h>"  -o /Users/tcaswell/source/p/matplotlib/matplotlib/build/freetype-2.6.1/objs/ftsystem.lo builds/unix/ftsystem.c
    libtool: Version mismatch error.  This is libtool 2.4.7, but the
    libtool: definition of this LT_INIT comes from libtool 2.4.6.
    libtool: You should recreate aclocal.m4 with macros from libtool 2.4.7
    libtool: and run autoconf again.

The libtool from conda is 2.4.6, but it is finding a 2.4.7 version from the system.

If I install clang via CF, then I get

    cd builds/unix; \
                ./configure  '--with-zlib=no' '--with-bzip2=no' '--with-png=no' '--with-harfbuzz=no' '--enable-static' '--disable-shared' '--host=arm64-apple-darwin20.0.0'
    checking build system type... aarch64-apple-darwin21.5.0
    checking host system type... aarch64-apple-darwin20.0.0
    checking for arm64-apple-darwin20.0.0-gcc... clang
    checking whether the C compiler works... no
    configure: error: in `/Users/tcaswell/source/p/matplotlib/matplotlib/build/freetype-2.6.1/builds/unix':
    configure: error: C compiler cannot create executables

which makes me think I need to check if there is a system update to be done (note the host and build system disagreement!).

@tacaswell
Copy link
Member

Without making any changes to setupext.py I an get freetype to compile with homebrew's compilers (this is via my build-the world nonsense). I strongly suspect that the issue here is related to getting a mix of conda, homebrew, and system compilers / libraries....

@dstansby
Copy link
Member

I'm also running into this. Prompted by https://sqlite.org/forum/info/73165e901d798571, I decided to check a more recent version of Freetype than 2.6.1. Using Freetype 2.11.1 it all bulids fine for me, so I think this might just be a case of needing to use a more recent version of Freetype?

@QuLogic
Copy link
Member

QuLogic commented Dec 29, 2022

The libtool from conda is 2.4.6, but it is finding a 2.4.7 version from the system.

Is LIBTOOLIZE set? It looks like it uses glibtoolize over libtoolize on Darwin. I guess conda-forge doesn't have that executable?

@lysa-n
Copy link

lysa-n commented Jan 24, 2023

So I encountered this error a few times and it was really driving me insane. However today I fixed it (again) and I will now never forget how I did that. For me on my mac M1 I was trying all this within Visual Studio Code. However, when I tried the pip install in the external built in terminal, my pip install suddendly ran without any problems. So for the ones encountering the issue in VSCode, hope this will help you.

@tacaswell
Copy link
Member

Also see https://discourse.matplotlib.org/t/dev-build-on-mac/23467

This appears to be a disagreement between what host to call the m1 platform between various tool chains. When working in a conda environment with packages from conda-forge there seems produce an inconsistency between the host that sysconfig reports and the hosts that the compilers we try to use (presumably from xcode?) accept. The following diff seems to fix it:

diff --git a/setupext.py b/setupext.py
index 4d41bdd44a..4a602b2e8d 100644
--- a/setupext.py
+++ b/setupext.py
@@ -649,8 +649,13 @@ class FreeType(SetupPackage):
                 "--disable-shared"
             ]
             host = sysconfig.get_config_var('HOST_GNU_TYPE')
-            if host is not None:  # May be unset on PyPy.
+
+            if (
+                host is not None and  # May be unset on PyPy.
+                'arm64-apple' not in host # Bad value with conda-forge?
+            ):
                 configure.append(f"--host={host}")
+
             subprocess.check_call(configure, env=env, cwd=src_path)
             if 'GNUMAKE' in env:
                 make = env['GNUMAKE']

I think this story is consistent as:

  1. I have never seen this problem when using Python from homebrew as (I think) there is more consistency between the tool chain that compiled Python and the one we are trying to compile freetype (and the rest of Matplotlib) with
  2. on conda-forge everything is built by library and with a lot more control over exactly what compilers will be found. I suspect that we can also solve this problem by installing the full compiler tool chain from CF (and maybe setting some envs to make sure they get discovered?)

We do need to update the version of freetype we accept for the tests, but it is not driven by this build issue (although the make / configure scripts for newer freetype dealing with this better is a nice perk).

@jklymak
Copy link
Member

jklymak commented Jan 24, 2023

Should we add this diff for now - I can confirm it works for my setup. If we update freetype we can remove if possible.

@tacaswell
Copy link
Member

I do not know why we are setting --host which makes me very hesitant to remove it!

@QuLogic
Copy link
Member

QuLogic commented Jan 24, 2023

--host was added in #21263 (using the wrong sysconfig value, but that was fixed later) to fix 32-bit compile on a 64-bit builder.

@tacaswell
Copy link
Member

sorry for not checking blame my self 😞

Given that I think this patch (only disabling it is a narrow case) is better than removing it all together.

@zhanwenchen
Copy link

zhanwenchen commented Jul 24, 2023

You can also specify the MPLSETUPCFG variable to use your own freetype system installation (e.g., with brew). setupext.py uses a magic number 2.6.1 for the FreeType version which doesn't give the correct os name. This has been fixed by newer FreeType versions such as 2.13.1.

# mplsetup.cf only contains these two lines:
# [libs]
# system_freetype = true
MPLSETUPCFG=/Users/yourname/mplsetup.cfg JPEG_ROOT=/opt/homebrew/opt/jpeg-turbo pip install --no-binary :all: pycocotools

@ksunden ksunden removed this from the v3.8.0 milestone Sep 15, 2023
@QuLogic
Copy link
Member

QuLogic commented Feb 8, 2024

The main branch now uses Meson, and none of the autotools build from FreeType, so I don't think we have to worry about this outdated handling of --host triplets.

@QuLogic QuLogic closed this as completed Feb 8, 2024
@QuLogic QuLogic added this to the v3.9.0 milestone Feb 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants