You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Recompilation in an editable install hides all compiler output #820
hides all build output, so if the build fails due to missing build requirements or some other reason, you don't get any indication as to why.
I would expect the compilation output to be shown at import time.
I found this while trying to do an editable install of numpy, and because the initial install of numpy used build isolation the import time recompile did not have the build requirements (cython).
That documentation page is helpful. It would be helpful for any compilation errors to show up. Apart from build environment issues I encountered, if you are developing the C code and you make a mistake you are going to want to see why!
Discussing with @Cadair IRL there are at least two things:
he was not getting an error when using meson editable install in non-verbose mode. If that's the case this seems like a bug. I was involved in Editable install: raise ImportError when rebuilding fails #648 a while ago and I think it was supposed to raise an ImportError when compilation fails? Maybe we are missing some context or this was a bit of an edge case.
should the default editable be verbose by default? I guess this is a bit more controversial but I lean towards "verbose by default" as well. If you are doing editable install you are likely in "developer mode" and you are probably interested to see some output when things are recompiled (be it only to be reassured something is happening).
# Insert invalid code in the extension module source code
path.write_text('return')
# Import module and trigger rebuild: the build fails and ImportErrror is raised
stdout=io.StringIO()
withredirect_stdout(stdout):
withpytest.raises(ImportError, match='re-building the purelib-and-platlib '):
importplat# noqa: F401
assertnotverboseorstdout.getvalue().startswith('meson-python: building ')
finally:
delsys.meta_path[0]
sys.modules.pop('pure', None)
path.write_text(code)
If this is not the case, we would need a way to reproduce the issue to investigate further.
should the default editable be verbose by default?
The reason for making the rebuild silent by default is that editable installs may be used for packages that install scripts. The output of those scripts becomes unusable when it is intermixed with compilation logging. This problem is more severe because ninja output the compilation log on the standard output and not on the standard error. Someone went to great lengths to suppress any output when there is nothing to be built even when verbose output is enabled, thus there is definitely a group of users that does not want output emitted. What could be done is to redirect the compilation output to a file and display it (or the last N lines of it) when the compilation fails.
I got an error (the import failed) but there was no indication as to why (in my case I was missing Cython). No ninja output was shown by the import error so I didn't know how to fix it.
Someone went to great lengths to suppress any output when there is nothing to be built even when verbose output is enabled, thus there is definitely a group of users that does not want output emitted
(I think?) I am one of the user who did not want any output when there is no work to do. I tried to open a PR to do it in #579, which @dnicolodi finished in #579 🙏.
Yet at the same time, where there is an error, I would have liked a quick tip about meson-editable verbose, mostly because I am neither a meson nor meson-python expert 😅 and it took me a while to debug the situation and understand that things were not recompiling as I naively thought. As a scikit-learn maintainer, I am guessing other scientific Python package maintainers may be in a similar boat.
I tried to mention the MESON_EDITABLE_ERROR in the ImportError message in #648 (comment) but @dnicolodi was not a great fan of the approach which I guess is completely understandable.
To be explicit, I am not trying to sway anyone, but mostly summarize the situation at this point 😉.
It is a complicated UX question given the various usage scenarios plus the issues with different tools emitting content to stdout vs. sterr inconsistently. However, I would say that the main use case - using an editable build for developing a package that uses meson-python in a regular environment - does have the requirement of showing the traceback on a build error.
What could be done is to redirect the compilation output to a file and display it (or the last N lines of it) when the compilation fails.
I like this idea. Perhaps the last N lines + the path to the file (which will be preserved in the build dir) if the user needs the full output?
We've received a lot of complaints about this since switching to meson-python (with an editable install by default) in SageMath. Sage is a big project, so touching the wrong file can lead to a mysterious hour-long delay when you go to test your changes.
As far as I understand, it's currently not possible to pass -Ceditable-verbose=yes via meson.options. Although it would be useful...
That file is solely used to define new options (and their default values) that don't previously exist; it cannot pass values for any existing options. The project default_options can be used to pass values for any built-in meson option (but not pep517 build backend options owned by meson-python).
Meson-python as it stands today is primarily configured via pyproject.toml
why can't it be set in the project (meta)data, be it in pyproject.toml, or in menson.build, or in meson.options ?
Looks like a bug to me. We don't want to tell the users to normally/always use a non-default option, or always have an environment variable set. Normal operations should be working out of the box.
The principle discussed there is still valid though: parse the ninja logs and show the relevant part of a build failure. Hence why this issue is still open. In case gh-750 keeps being stalled, someone else can give that a go.
Activity
rgommers commentedon Nov 5, 2025
Does https://mesonbuild.com/meson-python/how-to-guides/editable-installs.html#verbose-mode help?
There might be an improvement to make there, showing the build output by default only if the build fails.
Cadair commentedon Nov 5, 2025
That documentation page is helpful. It would be helpful for any compilation errors to show up. Apart from build environment issues I encountered, if you are developing the C code and you make a mistake you are going to want to see why!
lesteve commentedon Nov 7, 2025
Discussing with @Cadair IRL there are at least two things:
ImportErrorwhen compilation fails? Maybe we are missing some context or this was a bit of an edge case.dnicolodi commentedon Nov 11, 2025
This is not what should happen. There is a test that verify that an
ImportErroris raisedmeson-python/tests/test_editable.py
Lines 317 to 346 in 8e98598
The reason for making the rebuild silent by default is that editable installs may be used for packages that install scripts. The output of those scripts becomes unusable when it is intermixed with compilation logging. This problem is more severe because
ninjaoutput the compilation log on the standard output and not on the standard error. Someone went to great lengths to suppress any output when there is nothing to be built even when verbose output is enabled, thus there is definitely a group of users that does not want output emitted. What could be done is to redirect the compilation output to a file and display it (or the last N lines of it) when the compilation fails.Cadair commentedon Nov 11, 2025
I got an error (the import failed) but there was no indication as to why (in my case I was missing Cython). No ninja output was shown by the import error so I didn't know how to fix it.
lesteve commentedon Nov 12, 2025
(I think?) I am one of the user who did not want any output when there is no work to do. I tried to open a PR to do it in #579, which @dnicolodi finished in #579 🙏.
Yet at the same time, where there is an error, I would have liked a quick tip about meson-editable verbose, mostly because I am neither a meson nor meson-python expert 😅 and it took me a while to debug the situation and understand that things were not recompiling as I naively thought. As a scikit-learn maintainer, I am guessing other scientific Python package maintainers may be in a similar boat.
I tried to mention the
MESON_EDITABLE_ERRORin theImportErrormessage in #648 (comment) but @dnicolodi was not a great fan of the approach which I guess is completely understandable.To be explicit, I am not trying to sway anyone, but mostly summarize the situation at this point 😉.
rgommers commentedon Nov 13, 2025
It is a complicated UX question given the various usage scenarios plus the issues with different tools emitting content to stdout vs. sterr inconsistently. However, I would say that the main use case - using an editable build for developing a package that uses
meson-pythonin a regular environment - does have the requirement of showing the traceback on a build error.I like this idea. Perhaps the last N lines + the path to the file (which will be preserved in the build dir) if the user needs the full output?
crusaderky commentedon Dec 5, 2025
+1. I just hit this exact issue with meson-python used to compile cython.
orlitzky commentedon Feb 6, 2026
We've received a lot of complaints about this since switching to meson-python (with an editable install by default) in SageMath. Sage is a big project, so touching the wrong file can lead to a mysterious hour-long delay when you go to test your changes.
dimpase commentedon Feb 6, 2026
As far as I understand, it's currently not possible to pass
-Ceditable-verbose=yesviameson.options.Although it would be useful...
eli-schwartz commentedon Feb 6, 2026
That file is solely used to define new options (and their default values) that don't previously exist; it cannot pass values for any existing options. The project
default_optionscan be used to pass values for any built-in meson option (but not pep517 build backend options owned by meson-python).Meson-python as it stands today is primarily configured via pyproject.toml
(Editable-verbose is not listed as available to be set via https://mesonbuild.com/meson-python/reference/pyproject-settings.html however.)
dimpase commentedon Feb 7, 2026
why can't it be set in the project (meta)data, be it in
pyproject.toml, or inmenson.build, or inmeson.options?Looks like a bug to me. We don't want to tell the users to normally/always use a non-default option, or always have an environment variable set. Normal operations should be working out of the box.
dnicolodi commentedon Feb 7, 2026
No one ever asked for it. But it can be added. See #838
3 remaining items
dnicolodi commentedon Jun 28, 2026
#750 started out on the wrong foot and is still wrong. The author seems to have lost interest in fixing it.
rgommers commentedon Jun 28, 2026
The principle discussed there is still valid though: parse the ninja logs and show the relevant part of a build failure. Hence why this issue is still open. In case gh-750 keeps being stalled, someone else can give that a go.
ENH: capture and report build errors when rebuilding editable wheels
ENH: capture and report build errors when rebuilding editable wheels
ENH: capture and report build errors when rebuilding editable wheels
ENH: capture and report build errors when rebuilding editable wheels
ENH: capture and report build errors when rebuilding editable wheels
ENH: capture and report build errors when rebuilding editable wheels
ENH: capture and report build errors when rebuilding editable wheels
ENH: capture and report build errors when rebuilding editable wheels
ENH: capture and report build errors when rebuilding editable wheels
ENH: capture and report build errors when rebuilding editable wheels
ENH: capture and report build errors when rebuilding editable wheels
ENH: capture and report build errors when rebuilding editable wheels