-
Notifications
You must be signed in to change notification settings - Fork 177
Auto activate uv venv with pip installed #2666
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
): | ||
return [] | ||
return [ | ||
f"uv venv --prompt workflow --seed {DEFAULT_REPO_DIR}/.venv > /dev/null 2>&1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume this .venv
can turn up in git status
, as it is not necessarily included in .gitignore
. Any chance we could create it outside of the repo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I considered creating a global uv venv outside the repo. The problem with that is that having an active venv outside the repo would trigger uv warnings about the active repo not being used cause it defaults to .venv
in the project directory. Not critical, but quite confusing. And since we want to support uv-first flow, I think we should optimize for this case.
As regards to .venv in git, it will never appear in git since it's always excluded by .venv/.gitignore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Users may still be confused by a new directory in their repository, especially if they don't use uv or Python. But I guess we can live with that if there are no good alternatives
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe, let's see how it works
@@ -164,6 +166,18 @@ async def _commands(self) -> List[str]: | |||
|
|||
return result | |||
|
|||
def _dstack_image_commands(self) -> List[str]: | |||
if ( | |||
self.run_spec.configuration.image is not None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current idea is to have .venv in the repo dir so that uv does not issue warnings about the wrong venv. And I don't want to hardcode the repo path in the image since we had plans to make it configurable.
Tested pip vs uv for installing pytorch on GCP n1-standard-4:
|
Addresses #2625
#2649 ditched conda in favor of uv in dstack Docker images. The side effect of that is that
pip
is no longer available in runs. This breaks things directly dependent on pip such as Jupyter's%pip
,python -m venv
, andpip
hardcoded in makefiles and other scripts. The PR makes pip available by creating a uv venv with pip installed and activating it when using dstack Docker images. This should not worsen UX for users relying on uv-based workflow, only improve UX for those who depend on pip directly.The PR will be merged once the 0.8 Docker images with uv are built and version.base_image is updated.