diff --git a/tools/idf_tools.py b/tools/idf_tools.py index 972a0f906e..a60960782c 100755 --- a/tools/idf_tools.py +++ b/tools/idf_tools.py @@ -1398,13 +1398,17 @@ def action_install_python_env(args): # type: ignore subprocess.check_call([sys.executable, '-m', 'virtualenv', '--seeder', 'pip', idf_python_env_path], stdout=sys.stdout, stderr=sys.stderr) + env_copy = os.environ.copy() + if env_copy.get('PIP_USER') == 'yes': + warn('Found PIP_USER="yes" in the environment. Disabling PIP_USER in this shell to install packages into a virtual environment.') + env_copy['PIP_USER'] = 'no' run_args = [virtualenv_python, '-m', 'pip', 'install', '--no-warn-script-location'] requirements_txt = os.path.join(global_idf_path, 'requirements.txt') run_args += ['-r', requirements_txt] if args.extra_wheels_dir: run_args += ['--find-links', args.extra_wheels_dir] info('Installing Python packages from {}'.format(requirements_txt)) - subprocess.check_call(run_args, stdout=sys.stdout, stderr=sys.stderr) + subprocess.check_call(run_args, stdout=sys.stdout, stderr=sys.stderr, env=env_copy) def action_add_version(args):