Skip to content

Commit b70a84e

Browse files
committed
install: Workaround debian ensurepip issue
1 parent b8ba241 commit b70a84e

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

scripts/firedrake-install

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -921,8 +921,22 @@ if mode == "install":
921921
quit("Can't install into existing venv '%s'" % firedrake_env)
922922

923923
log.info("Creating firedrake venv in '%s'." % firedrake_env)
924+
# Debian's Python3 is screwed, they don't ship ensurepip as part
925+
# of the base python package, so the default python -m venv
926+
# doesn't work. Moreover, they have spiked the file such that it
927+
# calls sys.exit, which will kill any attempts to create a venv
928+
# with pip.
929+
try:
930+
import ensurepip
931+
with_pip = True
932+
except ImportError:
933+
with_pip = False
924934
import venv
925-
venv.EnvBuilder(with_pip=True).create(firedrake_env)
935+
venv.EnvBuilder(with_pip=with_pip).create(firedrake_env)
936+
if not with_pip:
937+
import urllib.request
938+
urllib.request.urlretrieve("https://bootstrap.pypa.io/get-pip.py", filename="get-pip.py")
939+
check_call(python + ["get-pip.py"])
926940
# Ensure pip and setuptools are at the latest version.
927941
run_pip(["install", "-U", "setuptools"])
928942
run_pip(["install", "-U", "pip"])

0 commit comments

Comments
 (0)