Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/poetry/utils/env/base_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,11 +269,11 @@ def get_base_prefix(cls) -> Path:
@abstractmethod
def get_marker_env(self) -> dict[str, Any]: ...

def get_pip_command(self, embedded: bool = False) -> list[str]:
if embedded or not Path(self._bin(self._pip_executable)).exists():
return [str(self.python), str(self.pip_embedded)]
# run as module so that pip can update itself on Windows
return [str(self.python), "-m", "pip"]
def get_pip_command(self, prefer_in_env: bool = False) -> list[str]:
if prefer_in_env and Path(self._bin(self._pip_executable)).exists():
# we run pip as module so that pip can update itself on Windows
return [str(self.python), "-m", "pip"]
return [str(self.python), str(self.pip_embedded)]

@abstractmethod
def get_supported_tags(self) -> list[Tag]: ...
Expand All @@ -295,7 +295,7 @@ def get_command_from_bin(self, bin: str) -> list[str]:
if bin == "pip":
# when pip is required we need to ensure that we fall back to
# embedded pip when pip is not available in the environment
return self.get_pip_command()
return self.get_pip_command(prefer_in_env=True)

return [self._bin(bin)]

Expand Down