Skip to content

Commit

Permalink
Always insert at the beginning of sys.path when modifying it.
Browse files Browse the repository at this point in the history
  • Loading branch information
rohinb2 committed Jul 12, 2024
1 parent 5077743 commit 2dde9db
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions runhouse/resources/packages/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,13 +241,13 @@ def _install(self, env: Union[str, "Env"] = None, cluster: "Cluster" = None):
f"{path}/requirements.txt not found, skipping reqs install"
)

sys.path.append(path) if not cluster else run_setup_command(
sys.path.insert(0, path) if not cluster else run_setup_command(
f"export PATH=$PATH;{path}", cluster=cluster
)
elif not cluster:
if Path(self.install_target).resolve().expanduser().exists():
sys.path.append(
str(Path(self.install_target).resolve().expanduser())
sys.path.insert(
0, str(Path(self.install_target).resolve().expanduser())
)
else:
raise ValueError(
Expand Down Expand Up @@ -403,7 +403,7 @@ def to(
external=False
) == system.endpoint(external=False):
# If we're on the target system, just make sure the package is in the Python path
sys.path.append(self.install_target.local_path)
sys.path.insert(0, self.install_target.local_path)
return self
logger.info(
f"Copying package from {self.install_target.fsspec_url} to: {getattr(system, 'name', system)}"
Expand Down

0 comments on commit 2dde9db

Please sign in to comment.