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

Fix Python 3.13 standalone mount steps #2743

Merged
merged 1 commit into from
Jan 9, 2025

Conversation

mwaskom
Copy link
Contributor

@mwaskom mwaskom commented Jan 9, 2025

Older versions of the standalone Python distribution included only a python3 binary, so our Image recipe when using add_python added a softlink from python3 to python (which Modal otherwise expects to exist).

With newer versions of the standalone Python distribution, which we start picking up with Python 3.13, python is included so the build recipe would fail

=> Step 2: RUN ln -s /usr/local/bin/python3 /usr/local/bin/python
ln: failed to create symbolic link '/usr/local/bin/python': File exists

This PR skips the linking step based on a Python version check. (Technically it's the standalone mount version, not the Python version that matters, but the result is equivalent and the latter is easier to check in the relevant context).

@mwaskom mwaskom requested a review from ekzhang January 9, 2025 20:11
Copy link
Member

@ekzhang ekzhang left a comment

Choose a reason for hiding this comment

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

Sounds good to me! Another approach is to just add || true to the end of the command, will let you pick which one is better though.

@mwaskom
Copy link
Contributor Author

mwaskom commented Jan 9, 2025

Sounds good to me! Another approach is to just add || true to the end of the command, will let you pick which one is better though.

Yeah — we'd need to do that conditionally anyway though right? If we just change the existing line it will force Image rebuilds I think.

@mwaskom
Copy link
Contributor Author

mwaskom commented Jan 9, 2025

or something like

add_python_commands = [
    "COPY /python/. /usr/local",
    "RUN ln -s /usr/local/bin/python3 /usr/local/bin/python" + (" || true" if python_version >= "3.13" else ""),
    "ENV TERMINFO_DIRS=/etc/terminfo:/lib/terminfo:/usr/share/terminfo:/usr/lib/terminfo",
]

kinda messy either way.

@mwaskom mwaskom merged commit a32d5c8 into main Jan 9, 2025
23 checks passed
@mwaskom mwaskom deleted the michael/2025-01-09-fix-py313-standalone-python-steps branch January 9, 2025 20:30
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