Skip to content

[ci] Windows Wanda image: fix conda PermissionError in microcheck windowsbuild#62471

Closed
ans9868 wants to merge 2 commits into
ray-project:masterfrom
ans9868:ci/windows-certs-avoid-conda-update
Closed

[ci] Windows Wanda image: fix conda PermissionError in microcheck windowsbuild#62471
ans9868 wants to merge 2 commits into
ray-project:masterfrom
ans9868:ci/windows-certs-avoid-conda-update

Conversation

@ans9868

@ans9868 ans9868 commented Apr 9, 2026

Copy link
Copy Markdown
Contributor

PR: Fix windowsbuild conda PermissionError on Windows


Description

The wanda: windowsbuild CI check was intermittently failing during the Windows image build.

What was going wrong

After installing Python and dependencies via conda, a follow-up command:

conda update -c conda-forge ca-certificates certifi

would sometimes cause conda to update itself in-place. On Windows, this triggers a
PermissionError when conda tries to clean up its own temp files (e.g. conda.exe.c~).
The CI job then fails, even though the only goal was to refresh SSL certificates.

A previous fix (#62441) disabled some
self-update behavior via conda config --set auto_update_conda false, but the explicit
conda update step was never removed, so the risky path could still run.

Why this is hard to catch

This failure is intermittent. The same script can pass on one run and fail on another
depending on agent load, caching, and timing. When cleanup does fail, conda 26.x can hit a
secondary bug in its own error handling (conda/conda#15760),
adding noise to the logs. A green windowsbuild after #62441 doesn't mean the underlying
issue is gone.

What this PR does

  • Moves ca-certificates and certifi into the same initial conda install as Python
    and requests — no separate update step needed
  • Adds python -m pip install -U certifi after pip installs for a full cert refresh
  • Removes the conda update -c conda-forge line entirely

Why avoid conda update on Windows?

Unlike conda install with explicit specs, conda update can upgrade conda itself and widen the blast radius to unrelated packages. Replacing a running conda.exe inside a Windows Docker container is fragile and the source of this failure.


Related Issues

PR / Issue Description
ray-project/ray#61545 Original Windows cert refresh attempt
ray-project/ray#62441 Partial mitigation; this PR removes the explicit conda update that still triggered failures
conda/conda#15760 Upstream conda bug in cleanup/error path (splitext)

Observed failure: intermittent PermissionError on conda.exe.c~ in the BuildKite
microcheck for wanda: windowsbuild.

… windowsbuild

After the main conda install (Python / requests), a follow-up conda update -c conda-forge … ca-certificates certifi can still drive an in-place replacement of conda.exe on Windows. That leads to a PermissionError while cleaning up temp files such as conda.exe.c~, and can hit the broken cleanup path in conda 26.x (conda/conda#15760). Microcheck wanda: windowsbuild then fails even though the only intent was to refresh certs (ray-project#61545). conda config --set auto_update_conda false (ray-project#62441) mitigates some conda self-update behavior but does not remove that explicit conda update step—and does not replace a deliberate cert refresh; this PR refreshes certs via conda install … ca-certificates certifi and pip install -U certifi instead.

Signed-off-by: Adel Nour <ans9868@nyu.edu>
@ans9868
ans9868 requested a review from a team as a code owner April 9, 2026 16:35

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit 3597901. Configure here.

Comment thread ci/ray_ci/windows/build_base.sh

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request modifies the ci/ray_ci/windows/build_base.sh script to streamline the installation of ca-certificates and certifi within the conda environment, aiming to refresh the trust store for Python/requests and avoid issues with conda update on Windows. It also adds a pip install -U certifi step. The review highlights two main concerns: first, removing conda config --set auto_update_conda false might re-introduce conda self-update issues leading to PermissionError, and it's suggested to retain this configuration. Second, the manual pip install -U certifi could bypass version pinning and cause environment inconsistencies, recommending an update in the constraints file instead.

Comment on lines +15 to +20
# Include ca-certificates + certifi in this solve so the trust store is refreshed with
# Python/requests (ray-project/ray#61545). Avoid a follow-up `conda update -c conda-forge`:
# it can replace conda.exe in place on Windows and fail in Docker (PermissionError on
# conda.exe.c~; see conda/conda#15760).
# Use `conda install` (explicit specs) rather than `conda update` (broader "newest compatible" refresh/upgrade more of the environment including conda itself which can cause issues with the build).
conda install -q -y python="${PYTHON_FULL_VERSION}" requests=2.32.3 ca-certificates certifi

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

Removing conda config --set auto_update_conda false re-introduces the risk of conda attempting to update itself during the conda install command. Even when using install with explicit specs, conda may still perform a self-update if a newer version is available and the configuration allows it. To reliably prevent the PermissionError on conda.exe in Windows Docker environments, this configuration should be retained.

Suggested change
# Include ca-certificates + certifi in this solve so the trust store is refreshed with
# Python/requests (ray-project/ray#61545). Avoid a follow-up `conda update -c conda-forge`:
# it can replace conda.exe in place on Windows and fail in Docker (PermissionError on
# conda.exe.c~; see conda/conda#15760).
# Use `conda install` (explicit specs) rather than `conda update` (broader "newest compatible" refresh/upgrade more of the environment including conda itself which can cause issues with the build).
conda install -q -y python="${PYTHON_FULL_VERSION}" requests=2.32.3 ca-certificates certifi
conda config --set auto_update_conda false
# Include ca-certificates + certifi in this solve so the trust store is refreshed with
# Python/requests (ray-project/ray#61545). Avoid a follow-up conda update -c conda-forge:
# it can replace conda.exe in place on Windows and fail in Docker (PermissionError on
# conda.exe.c~; see conda/conda#15760).
# Use conda install (explicit specs) rather than conda update (broader newest compatible refresh/upgrade more of the environment including conda itself which can cause issues with the build).
conda install -q -y python="${PYTHON_FULL_VERSION}" requests=2.32.3 ca-certificates certifi

-r python/requirements/ml/dl-cpu-requirements.txt

# Ensure urllib/requests see an up-to-date certifi bundle after constrained installs.
python -m pip install -U certifi

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Performing a manual pip install -U certifi after a constrained installation bypasses the version pinning in python/requirements_compiled.txt. This can lead to environment inconsistencies if other packages depend on a specific version of certifi. It is generally safer to update the version in the constraints file directly.

…i pip step

- Restore conda config --set auto_update_conda false + TODO (conda#15760) before conda install
- Shorten comment above pip install -U certifi (constraints vs refresh)

Signed-off-by: Adel Nour <ans9868@nyu.edu>
@elliot-barn

Copy link
Copy Markdown
Collaborator

Merged a temp fix here: #62441

@ray-gardener ray-gardener Bot added devprod community-contribution Contributed by the community labels Apr 9, 2026
@ans9868

ans9868 commented Apr 9, 2026

Copy link
Copy Markdown
Contributor Author

Hey Elliot, I think your patch is simpler and more elegant. That said, mine may be useful longer term. Conda update is very general and can touch more than intended, while conda install is more targeted and could prevent a whole class of similar issues down the road.

One thing worth noting: windowsbuild microcheck doesn't actually trigger on PRs like this one. I tested both our changes in my other open PR (#60522, the Ax/Bayesian optimization fix), which does run the Windows build CI. Both our changes passed the windowsbuild microcheck. That PR was the original motivation here as it got blocked by unrelated microcheck failures, and the Windows conda issue was one of them.

Happy to close this if the leaner fix is preferred, or keep it open if the more explicit approach is wanted. Up to you and the team.

@aslonnie aslonnie left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this is already fixed on master branch.

# The installs above use `-c python/requirements_compiled.txt`, which pins exact versions. If we
# passed that file again here, certifi would stay on the pinned (possibly old) version. We run
# without it so pip can install the latest certifi. Upgrading certifi alone is low risk for this CI image.
python -m pip install -U certifi

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this line should not be required. using the pinned version is intentional

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, I agree. The main thing I was trying to preserve here was using conda install instead of conda update, but I think your point is fair that the underlying issue may already be covered on master. If you all see this as redundant, I’m happy to close the PR.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I am closing this PR, especially since master is unblocked already.

  • the part that pip install all 4 packages is fine, and probably even better.
  • but the part that pip install -U certifi is an unintended change.

thanks for the contribution anyways.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution Contributed by the community devprod

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants