doc: add comment to explain why unsetting PIP_REQUIRE_VIRTUALENV is required.

This commit is contained in:
Celeborn2BeAlive 2020-08-28 18:12:01 +02:00
parent 352977e442
commit 97c2118b7e

View File

@ -54,6 +54,10 @@ def install_package(name, version):
logging.info(f"installing {name} version...") logging.info(f"installing {name} version...")
env = os.environ env = os.environ
if "PIP_REQUIRE_VIRTUALENV" in env: if "PIP_REQUIRE_VIRTUALENV" in env:
# PIP_REQUIRE_VIRTUALENV is an env var to ensure pip cannot install packages outside a virtual env
# https://docs.python-guide.org/dev/pip-virtualenv/
# But since Blender's pip is outside of a virtual env, it can block our packages installation, so we unset the
# env var for the subprocess.
env = os.environ.copy() env = os.environ.copy()
del env["PIP_REQUIRE_VIRTUALENV"] del env["PIP_REQUIRE_VIRTUALENV"]
subprocess.run([str(PYTHON_PATH), "-m", "pip", "install", f"{name}=={version}"], env=env) subprocess.run([str(PYTHON_PATH), "-m", "pip", "install", f"{name}=={version}"], env=env)