Skip to content
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

Can't build with --no-isolation without installing the builder first #613

Closed
mjpieters opened this issue May 7, 2023 · 1 comment
Closed
Labels
good first issue Good for newcomers

Comments

@mjpieters
Copy link

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 what pip install --no-build-isolation does.
@layday
Copy link
Member

layday commented May 7, 2023

[...] or, document that --no-isolation will only work if you manually install the builder first. This is what pip install --no-build-isolation does.

This is the intention. PR to improve the help text welcome.

@layday layday added the good first issue Good for newcomers label May 7, 2023
layday added a commit to layday/build that referenced this issue May 11, 2023
layday added a commit to layday/build that referenced this issue May 23, 2023
@layday layday closed this as completed in 300ca5f May 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants