[ci] Windows Wanda image: fix conda PermissionError in microcheck windowsbuild#62471
[ci] Windows Wanda image: fix conda PermissionError in microcheck windowsbuild#62471ans9868 wants to merge 2 commits into
Conversation
… 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>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Reviewed by Cursor Bugbot for commit 3597901. Configure here.
There was a problem hiding this comment.
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.
| # 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 |
There was a problem hiding this comment.
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.
| # 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 |
There was a problem hiding this comment.
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>
|
Merged a temp fix here: #62441 |
|
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
left a comment
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
this line should not be required. using the pinned version is intentional
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
I am closing this PR, especially since master is unblocked already.
- the part that
pip installall 4 packages is fine, and probably even better. - but the part that
pip install -U certifiis an unintended change.
thanks for the contribution anyways.

PR: Fix
windowsbuildconda PermissionError on WindowsDescription
The
wanda: windowsbuildCI check was intermittently failing during the Windows image build.What was going wrong
After installing Python and dependencies via
conda, a follow-up command:would sometimes cause conda to update itself in-place. On Windows, this triggers a
PermissionErrorwhen 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 explicitconda updatestep 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
windowsbuildafter #62441 doesn't mean the underlyingissue is gone.
What this PR does
ca-certificatesandcertifiinto the same initialconda installas Pythonand requests — no separate update step needed
python -m pip install -U certifiafter pip installs for a full cert refreshconda update -c conda-forgeline entirelyRelated Issues
splitext)Observed failure: intermittent
PermissionErroronconda.exe.c~in the BuildKitemicrocheck for
wanda: windowsbuild.