From 68dd980c710538b887ef75ebaf927587ebb312ed Mon Sep 17 00:00:00 2001
From: Amir MOHAMMADI <amir.mohammadi@idiap.ch>
Date: Fri, 1 Oct 2021 16:20:56 +0200
Subject: [PATCH] remove /opt/conda entries from path to avoid conflicts

---
 bob/devtools/bootstrap.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/bob/devtools/bootstrap.py b/bob/devtools/bootstrap.py
index 3267952a..020575a1 100644
--- a/bob/devtools/bootstrap.py
+++ b/bob/devtools/bootstrap.py
@@ -284,7 +284,13 @@ def install_miniconda(prefix, name):
         logger.info("(move) %s -> %s", prefix, cached)
         os.rename(prefix, cached)
 
-    run_cmdline(["bash", "miniconda.sh", "-b", "-p", prefix])
+    # remove /opt/conda entries from path to avoid conflicts
+    env = os.environ.copy()
+    env["PATH"] = ":".join(
+        [p for p in env["PATH"].split(":") if not p.startswith("/opt/conda/")]
+    )
+
+    run_cmdline(["bash", "miniconda.sh", "-b", "-p", prefix], env=env)
     if cached is not None:
         merge_conda_cache(cached, prefix, name)
         shutil.rmtree(cached)
-- 
GitLab