diff --git a/pw_build/python.gni b/pw_build/python.gni index aac65ce439..add1d8278f 100644 --- a/pw_build/python.gni +++ b/pw_build/python.gni @@ -517,10 +517,12 @@ template("pw_python_package") { args = [ "install", - # This speeds up pip installs. At this point in the gn build the - # virtualenv is already activated so build isolation isn't required. - # This requires that pip, setuptools, and wheel packages are - # installed. + # This speeds up pip installs. Build isolation isn't required for + # in-tree packages unless that package includes C/C++ extension + # modules: + # https://setuptools.pypa.io/en/latest/userguide/ext_modules.html + # For packages witout extensions this option requires that pip, + # setuptools, and wheel packages are available. "--no-build-isolation", ] diff --git a/pw_build/python_venv.gni b/pw_build/python_venv.gni index 1391194ef5..dfb0dd2a81 100644 --- a/pw_build/python_venv.gni +++ b/pw_build/python_venv.gni @@ -168,7 +168,6 @@ template("pw_python_venv") { _skip_installing_external_python_deps = true args = [ "install", - "--no-build-isolation", "wheel", ] inputs = _constraints @@ -190,10 +189,11 @@ template("pw_python_venv") { module = "pip" _pw_internal_run_in_venv = true _skip_installing_external_python_deps = true - args = [ - "install", - "--no-build-isolation", - ] + args = [ "install" ] + + # Note: --no-build-isolation should be avoided for installing 3rd party + # Python packages that use C/C++ extension modules. + # https://setuptools.pypa.io/en/latest/userguide/ext_modules.html inputs = _constraints + _requirements # Constraints diff --git a/pw_env_setup/py/pw_env_setup/virtualenv_setup/install.py b/pw_env_setup/py/pw_env_setup/virtualenv_setup/install.py index 2abba5d3bf..95d6421d82 100644 --- a/pw_env_setup/py/pw_env_setup/virtualenv_setup/install.py +++ b/pw_env_setup/py/pw_env_setup/virtualenv_setup/install.py @@ -264,7 +264,10 @@ def pip_install(*args): requirements = constraints if requirements: - requirement_args = ['--no-build-isolation'] + requirement_args = [] + # Note: --no-build-isolation should be avoided for installing 3rd party + # Python packages that use C/C++ extension modules. + # https://setuptools.pypa.io/en/latest/userguide/ext_modules.html requirement_args.extend('--requirement={}'.format(req) for req in requirements) combined_requirement_args = requirement_args + constraint_args