-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
[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
Comments
Not that it really helps, but the problem seems to be with building FreeType:
So it seems like the configure script for FreeType doesn't have support for |
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. |
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. |
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. |
Can you clarify? I remember something to do with specifying |
Here's the line, which I found empirically we needed: |
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. |
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:
From this traceback it is unclear to me if you are using the homebrew compiler or the conda-forge compilers. |
My compiler is from apple CommandLineTools (this is from within the conda environment, I stripped the
@jklymak I just installed prebuilt matplotlib through conda first, then tried an editable install, but the FreeType build failed again |
I successfully built matplotlib after forcing it to use the system FreeType by adding this in
|
I don't get the freetype compile step. Are you installing from conda-forge channel? You can use the system freetype, but many of your image tests are going to fail if you want to run our tests. |
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 |
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). |
Does forcing an 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( |
It gets farther, but runs into differnt issues
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
which makes me think I need to check if there is a system update to be done (note the host and build system disagreement!). |
Without making any changes to |
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? |
Is |
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. |
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 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:
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). |
Should we add this diff for now - I can confirm it works for my setup. If we update freetype we can remove if possible. |
I do not know why we are setting |
|
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. |
You can also specify the # 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 |
The |
Uh oh!
There was an error while loading. Please reload this page.
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 asubprocess-exited-with-error
exception.I have all the development dependencies installed, so I'm not sure what could be going wrong.
Code for reproduction
Actual outcome
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
The text was updated successfully, but these errors were encountered: