Skip to content
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

[Core] Fix wheel creation when multiple versions are installed #3866

Merged
merged 4 commits into from
Aug 25, 2024

Conversation

romilbhardwaj
Copy link
Collaborator

If a user has multiple Sky versions installed (e.g., in different conda envs), sky launch would fail with:

FileNotFoundError: Could not find built SkyPilot wheels with glob pattern **/skypilot-1.0.0.dev20240823-*.whl under PosixPath('/Users/romilb/.sky/wheels')

This is because we cleanup all except the latest wheels:

latest_wheel_dir_name = latest_wheel.parent
# Cleanup older wheels.
for f in WHEEL_DIR.iterdir():
if f != latest_wheel_dir_name:
if f.is_dir() and not f.is_symlink():
shutil.rmtree(f, ignore_errors=True)
return latest_wheel

This PR updates our wheel creation behavior to check if a wheel for the version exists and create it if it doesn't already exist.

Tested (run the relevant ones):

  • Code formatting: bash format.sh

Manual tests:

  • Create 2 conda envs, temporarily update version strs and verify launching from both envs works.

Comment on lines 166 to 167
if (last_wheel_modification_time < last_modification_time) or not any(
WHEEL_DIR.glob(_WHEEL_PATTERN)):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we instead check WHEEL_DIR.glob(f'**/{_WHEEL_PATTERN}') instead, similar to https://github.com/skypilot-org/skypilot/blob/master/sky/backends/wheel_utils.py#L43?

Also, since we are checking the whether the current wheel exists, it might be fine to just use the current wheel for the later latest_wheel, i.e. it can become _get_current_wheel_and_remove_older_others?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah good idea. Refactored _get_latest_wheel_and_remove_all_others into separate methods to get the latest wheel and remove others.

Copy link
Collaborator

@Michaelvll Michaelvll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix @romilbhardwaj ! LGTM

# Only build wheels if the wheel is outdated or wheel does not exist
# for the requested version.
if (last_wheel_modification_time < last_modification_time) or not any(
WHEEL_DIR.glob(f'**/{_WHEEL_PATTERN}')):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: do we need any here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, glob() returns a generator that we must check with any(). Checking just glob(f'**/{_WHEEL_PATTERN}') would always return true since a generator is always returned.

@romilbhardwaj romilbhardwaj added this pull request to the merge queue Aug 25, 2024
Merged via the queue into master with commit 6067e2b Aug 25, 2024
20 checks passed
@romilbhardwaj romilbhardwaj deleted the wheel_multiversion branch August 25, 2024 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants