Skip to content

Commit

Permalink
address nousersite issue
Browse files Browse the repository at this point in the history
  • Loading branch information
savingoyal committed Sep 10, 2023
1 parent f3a6ebd commit 9ee706c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions metaflow/plugins/pypi/conda_decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ def runtime_step_cli(
cli_args.env["PYTHONPATH"] = self.metaflow_dir.name
# TODO: Verify user site-package isolation behavior
# https://github.com/conda/conda/issues/7707
# Important! Can otherwise leak packages to other environments
cli_args.env["PYTHONNOUSERSITE"] = "1"
# Also ref - https://github.com/Netflix/metaflow/pull/178
# cli_args.env["PYTHONNOUSERSITE"] = "1"
# The executable is already in place for the user code to execute against
if self.interpreter:
cli_args.entrypoint[0] = self.interpreter
Expand Down
2 changes: 2 additions & 0 deletions metaflow/plugins/pypi/conda_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ def executable(self, step_name, default=None):
# TODO: Handle the default executable case. Delegate to base_env as previously?
step = next(step for step in self.flow if step.name == step_name)
id_ = self.get_environment(step)["id_"]
# bootstrap.py is responsible for ensuring the validity of this executable.
# -s is important! Can otherwise leak packages to other environments.
return os.path.join(id_, "bin/python -s")

def interpreter(self, step_name):
Expand Down
3 changes: 2 additions & 1 deletion metaflow/plugins/pypi/micromamba.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ def metadata(self, id_, packages, python, platform):
}

def interpreter(self, id_):
return os.path.join(self.path_to_environment(id_), "bin/python")
# -s is important! Can otherwise leak packages to other environments.
return os.path.join(self.path_to_environment(id_), "bin/python -s")

def platform(self):
return self.info()["platform"]
Expand Down

0 comments on commit 9ee706c

Please sign in to comment.