OSX 14 and Python 3.12 unable to install in editable mode

I’m following the instructions at

https://matplotlib.org/devdocs/devel/development_setup.html#installing-for-devs
The command python -m pip install --verbose --no-build-isolation --editable .[dev] doesn’t work for a couple of reasons.

Firstly it fails unless you enclose the .[dev] part in quotes (single or double because of the )

Secondly, something I’ve not resolved is ‘ModuleNotFoundError: No module named ‘mesonpy’’

I searched and found some mention of it elsewhere but no resolution. Thanks in advance, keen to contribute.

Full output below

(venv) antlockyer@Ants-MBP-2 matplotlib % pip install --verbose --no-build-isolation ‘.[dev]’
Using pip 23.2.1 from /Users/antlockyer/Development/matplotlib/venv/lib/python3.12/site-packages/pip (python 3.12)
Processing /Users/antlockyer/Development/matplotlib
Running command Preparing metadata (pyproject.toml)
Preparing metadata (pyproject.toml) … done
ERROR: Exception:
Traceback (most recent call last):
File “/Users/antlockyer/Development/matplotlib/venv/lib/python3.12/site-packages/pip/_internal/cli/base_command.py”, line 180, in exc_logging_wrapper
status = run_func(*args)
^^^^^^^^^^^^^^^
File “/Users/antlockyer/Development/matplotlib/venv/lib/python3.12/site-packages/pip/_internal/cli/req_command.py”, line 248, in wrapper
return func(self, options, args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File “/Users/antlockyer/Development/matplotlib/venv/lib/python3.12/site-packages/pip/_internal/commands/install.py”, line 377, in run
requirement_set = resolver.resolve(
^^^^^^^^^^^^^^^^^
File “/Users/antlockyer/Development/matplotlib/venv/lib/python3.12/site-packages/pip/_internal/resolution/resolvelib/resolver.py”, line 73, in resolve
collected = self.factory.collect_root_requirements(root_reqs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/Users/antlockyer/Development/matplotlib/venv/lib/python3.12/site-packages/pip/_internal/resolution/resolvelib/factory.py”, line 491, in collect_root_requirements
req = self._make_requirement_from_install_req(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/Users/antlockyer/Development/matplotlib/venv/lib/python3.12/site-packages/pip/_internal/resolution/resolvelib/factory.py”, line 453, in _make_requirement_from_install_req
cand = self._make_candidate_from_link(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/Users/antlockyer/Development/matplotlib/venv/lib/python3.12/site-packages/pip/_internal/resolution/resolvelib/factory.py”, line 206, in _make_candidate_from_link
self._link_candidate_cache[link] = LinkCandidate(
^^^^^^^^^^^^^^
File “/Users/antlockyer/Development/matplotlib/venv/lib/python3.12/site-packages/pip/_internal/resolution/resolvelib/candidates.py”, line 293, in init
super().init(
File “/Users/antlockyer/Development/matplotlib/venv/lib/python3.12/site-packages/pip/_internal/resolution/resolvelib/candidates.py”, line 156, in init
self.dist = self._prepare()
^^^^^^^^^^^^^^^
File “/Users/antlockyer/Development/matplotlib/venv/lib/python3.12/site-packages/pip/_internal/resolution/resolvelib/candidates.py”, line 225, in _prepare
dist = self._prepare_distribution()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/Users/antlockyer/Development/matplotlib/venv/lib/python3.12/site-packages/pip/_internal/resolution/resolvelib/candidates.py”, line 304, in _prepare_distribution
return preparer.prepare_linked_requirement(self._ireq, parallel_builds=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/Users/antlockyer/Development/matplotlib/venv/lib/python3.12/site-packages/pip/_internal/operations/prepare.py”, line 538, in prepare_linked_requirement
return self._prepare_linked_requirement(req, parallel_builds)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/Users/antlockyer/Development/matplotlib/venv/lib/python3.12/site-packages/pip/_internal/operations/prepare.py”, line 653, in _prepare_linked_requirement
dist = _get_prepared_distribution(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/Users/antlockyer/Development/matplotlib/venv/lib/python3.12/site-packages/pip/_internal/operations/prepare.py”, line 69, in _get_prepared_distribution
abstract_dist.prepare_distribution_metadata(
File “/Users/antlockyer/Development/matplotlib/venv/lib/python3.12/site-packages/pip/_internal/distributions/sdist.py”, line 61, in prepare_distribution_metadata
self.req.prepare_metadata()
File “/Users/antlockyer/Development/matplotlib/venv/lib/python3.12/site-packages/pip/_internal/req/req_install.py”, line 562, in prepare_metadata
self.metadata_directory = generate_metadata(
^^^^^^^^^^^^^^^^^^
File “/Users/antlockyer/Development/matplotlib/venv/lib/python3.12/site-packages/pip/_internal/operations/build/metadata.py”, line 35, in generate_metadata
distinfo_dir = backend.prepare_metadata_for_build_wheel(metadata_dir)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/Users/antlockyer/Development/matplotlib/venv/lib/python3.12/site-packages/pip/_internal/utils/misc.py”, line 718, in prepare_metadata_for_build_wheel
return super().prepare_metadata_for_build_wheel(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/Users/antlockyer/Development/matplotlib/venv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_impl.py”, line 186, in prepare_metadata_for_build_wheel
return self._call_hook(‘prepare_metadata_for_build_wheel’, {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/Users/antlockyer/Development/matplotlib/venv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_impl.py”, line 321, in _call_hook
raise BackendUnavailable(data.get(‘traceback’, ‘’))
pip._vendor.pyproject_hooks._impl.BackendUnavailable: Traceback (most recent call last):
File “/Users/antlockyer/Development/matplotlib/venv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py”, line 77, in _build_backend
obj = import_module(mod_path)
^^^^^^^^^^^^^^^^^^^^^^^
File “/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/importlib/init.py”, line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “”, line 1381, in _gcd_import
File “”, line 1354, in _find_and_load
File “”, line 1318, in _find_and_load_unlocked
ModuleNotFoundError: No module named ‘mesonpy’

There are some python packages that you now need to install manually before installing Matplotlib, including Meson. Did you find this section yet?
https://matplotlib.org/devdocs/devel/dependencies.html#dependencies-for-building-matplotlib

I did not see that section, thank you. Looks like I need the C++ compiler too, will give it a try and report back. Appreciate the help.

Was an additional error due to having a fresh machine (needed to run install certificates.command from the Python 3.12 folder) but now all built. Thanks again.

1 Like