Skip to content

Conversation

@LoopedBard3
Copy link
Member

@LoopedBard3 LoopedBard3 commented Jan 8, 2026

If we would use the python version 3.13t, don't, instead use the non-thread-free version so we can successfully install all of the windows packages.

This will fix errors, such as the following, that are occurring because the packages we are trying to install are incompatible with the 3.13t version of python.

Incompatibility Error
Details
(.venv) C:\h\w\AC0C096E\w\9CE4088C\e>python -m pip install azure.storage.blob==12.13.0 
Collecting azure.storage.blob==12.13.0
  Using cached azure_storage_blob-12.13.0-py3-none-any.whl.metadata (25 kB)
Collecting azure-core<2.0.0,>=1.23.1 (from azure.storage.blob==12.13.0)
  Using cached azure_core-1.37.0-py3-none-any.whl.metadata (47 kB)
Collecting msrest>=0.6.21 (from azure.storage.blob==12.13.0)
  Using cached msrest-0.7.1-py3-none-any.whl.metadata (21 kB)
Collecting cryptography>=2.1.4 (from azure.storage.blob==12.13.0)
  Using cached cryptography-46.0.3.tar.gz (749 kB)
  Installing build dependencies: started
  Installing build dependencies: finished with status 'error'
  error: subprocess-exited-with-error
  
  installing build dependencies for cryptography did not run successfully.
  exit code: 1
  
  [39 lines of output]
  Ignoring cffi: markers 'platform_python_implementation != "PyPy" and python_version == "3.8"' don't match your environment
  Collecting maturin<2,>=1.9.4
    Using cached maturin-1.11.2-py3-none-win_amd64.whl.metadata (16 kB)
  Collecting cffi>=2.0.0
    Using cached cffi-2.0.0.tar.gz (523 kB)
    Installing build dependencies: started
    Installing build dependencies: finished with status 'done'
    Getting requirements to build wheel: started
    Getting requirements to build wheel: finished with status 'error'
    error: subprocess-exited-with-error
  
    Getting requirements to build wheel did not run successfully.
    exit code: 1
  
    [20 lines of output]
    Traceback (most recent call last):
      File "C:\h\w\AC0C096E\w\9CE4088C\e\.venv\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 389, in <module>
        main()
        ~~~~^^
      File "C:\h\w\AC0C096E\w\9CE4088C\e\.venv\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 373, in main
        json_out["return_val"] = hook(**hook_input["kwargs"])
                                 ~~~~^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\h\w\AC0C096E\w\9CE4088C\e\.venv\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 143, in get_requires_for_build_wheel
        return hook(config_settings)
      File "C:\h\w\AC0C096E\t\pip-build-env-5_89x309\overlay\Lib\site-packages\setuptools\build_meta.py", line 331, in get_requires_for_build_wheel
        return self._get_build_requires(config_settings, requirements=[])
               ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\h\w\AC0C096E\t\pip-build-env-5_89x309\overlay\Lib\site-packages\setuptools\build_meta.py", line 301, in _get_build_requires
        self.run_setup()
        ~~~~~~~~~~~~~~^^
      File "C:\h\w\AC0C096E\t\pip-build-env-5_89x309\overlay\Lib\site-packages\setuptools\build_meta.py", line 317, in run_setup
        exec(code, locals())
        ~~~~^^^^^^^^^^^^^^^^
      File "<string>", line 22, in <module>
    RuntimeError: CFFI does not support the free-threaded build of CPython 3.13. Upgrade to free-threaded 3.14 or newer to use CFFI with the free-threaded build.
    [end of output]
  
    note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed to build 'cffi' when getting requirements to build wheel
  [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed to build 'cryptography' when installing build dependencies for cryptography

Test run: https://dev.azure.com/dnceng/internal/_build/results?buildId=2874993&view=results
Successfully ran microbenchmarks on machine PerfViper098 which had been failing before (only 1 run due to sanity check). Also successfully ran the android tests set to run.

…thread-free version so we can successfully install all of the windows packages.
@LoopedBard3 LoopedBard3 self-assigned this Jan 8, 2026
@LoopedBard3 LoopedBard3 added bug Something isn't working dependencies Pull requests that update a dependency file labels Jan 8, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes Python package installation failures on Windows by detecting and avoiding Python 3.13t (free-threaded experimental build). The free-threaded version of Python 3.13 is incompatible with CFFI, which is a dependency of packages like azure.storage.blob and cryptography. When Python 3.13t is detected, the script falls back to using the standard Python 3.13 build.

Key changes:

  • Modified the virtual environment creation command on Windows to detect and avoid Python 3.13t
  • Added fallback logic to use py -3.13 when the default Python 3 is the incompatible 3.13t version

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -138,7 +138,7 @@ def get_pre_commands(
# Run inside a python venv
if os_group == "windows":
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

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

The fallback to py -3.13 assumes that a non-free-threaded Python 3.13 is available on the system. While the Windows Python launcher will provide an error if 3.13 is not installed, consider adding a comment to document this assumption and the expected Helix environment configuration.

Suggested change
if os_group == "windows":
if os_group == "windows":
# Assumes a non-free-threaded Python 3.13 is installed and available via the
# Windows Python launcher as `py -3.13` on Helix Windows queues. The `py -3`
# invocation first checks whether it is a free-threaded 3.13 build and avoids
# using it; if so, we fall back to `py -3.13` which must be present in the
# Helix environment.

Copilot uses AI. Check for mistakes.
@@ -138,7 +138,7 @@ def get_pre_commands(
# Run inside a python venv
if os_group == "windows":
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

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

This complex one-liner command is difficult to read and maintain. The command combines detection logic, conditional execution, and fallback behavior all in a single line. Consider breaking this into multiple commands with clear comments explaining each step, or at minimum, add an inline comment explaining the logic: "Detect if running 3.13t (free-threaded), and if so, use py -3.13 instead to avoid CFFI compatibility issues".

Suggested change
if os_group == "windows":
if os_group == "windows":
# Detect if `py -3` is Python 3.13 in experimental free-threaded mode; if so, avoid using it
# to create the venv (due to CFFI compatibility issues) and instead fall back to `py -3.13`.

Copilot uses AI. Check for mistakes.
@LoopedBard3 LoopedBard3 marked this pull request as ready for review January 8, 2026 22:58
@LoopedBard3 LoopedBard3 requested a review from mangod9 January 9, 2026 18:05
@LoopedBard3 LoopedBard3 merged commit 06eba8d into dotnet:main Jan 9, 2026
35 of 38 checks passed
@LoopedBard3 LoopedBard3 deleted the DontUsetPythonVersion branch January 9, 2026 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants