Can't build with `--no-isolation` without installing the builder first
mjpieters opened this issue · comments
Minimal reproducable test case using this project itself:
# setup; temp dir with venv and build 0.10.0 source
mkdir /tmp/testnonisolated
cd /tmp/testnonisolated
git clone --depth 1 --branch 0.10.0 https://github.com/pypa/build.git
python -m venv venv
source venv/bin/activate
# install build with pip (isolated build)
pip install build/
# attempt to use build to build build (say that 10 times really fast)
python -m build --no-isolation build
This fails with
* Getting build dependencies for sdist...
Traceback (most recent call last):
File "/private/tmp/testnonisolated/venv/lib/python3.11/site-packages/pyproject_hooks/_impl.py", line 321, in _call_hook
raise BackendUnavailable(data.get('traceback', ''))
pyproject_hooks._impl.BackendUnavailable: Traceback (most recent call last):
File "/private/tmp/testnonisolated/venv/lib/python3.11/site-packages/pyproject_hooks/_in_process/_in_process.py", line 77, in _build_backend
obj = import_module(mod_path)
^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/mj/.pyenv/versions/3.11.2/lib/python3.11/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
File "<frozen importlib._bootstrap>", line 1128, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
File "<frozen importlib._bootstrap>", line 1142, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'flit_core'
ERROR Backend 'flit_core.buildapi' is not available.
I can see that an attempt is made at installing the build dependencies, but this fails because ProjectBuilder.check_dependencies()
calls ProjectBuilder.get_requires_for_build()
, which relies on the builder to be installed already.
Either:
- install the builder first, separately, like an isolated install would do
- or, document that
--no-isolation
will only work if you manually install the builder first. This is whatpip install --no-build-isolation
does.
[...] or, document that
--no-isolation
will only work if you manually install the builder first. This is whatpip install --no-build-isolation
does.
This is the intention. PR to improve the help text welcome.