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

docs: Python 3.11 is highest compatible version for yarn install #28759

Merged

Conversation

MikeMcC399
Copy link
Contributor

Additional details

When rebuilding Cypress from source, at the stage where dependencies are installed, the following two npm modules require rebuilding, and this in turn requires that Python be installed.:

If the current version of Python 3.12.1 is installed then the rebuild fails with the following error message:

ModuleNotFoundError: No module named 'distutils'

This PR changes CONTRIBUTING > Requirements to document that Python 3.11 or lower be used, so that the problem does not occur.

On local Windows systems, for instance, there is no pre-installed or default version of Python installed, so the version to be installed must be chosen. node-gyp recommends for Windows:

Install the current version of Python from the Microsoft Store.

On macOS GitHub runners macos-11, macos-12 and macos-13 these have Python 3.12.x installed by default.

Steps to test

Install / set up the Node.js version specified by .node-version - currently 18.15.0

  • on Ubuntu 22.04 use the default Python version, for example 3.10.11
  • on Windows 11
    • install Python 3.11 from the Microsoft Store. Check the version with python3 --version.
    • install Visual Studio Community version 2022 (17.18.4), using the workload "Desktop development with C++" with its default selections. Select (or use Visual Studio Installer > Modify) to add Optional component Windows 10 SDK (for example 10.0.20348.0).

then execute the following:

git clone https://github.com/cypress-io/cypress
cd cypress
npm install yarn -g
yarn

Examine the logs and ensure that there are no errors recorded between the steps

[5/6] Building fresh packages...
[6/6] Cleaning modules...

How has the user experience changed?

This documentation change avoids the build error

ModuleNotFoundError: No module named 'distutils'

and concerns developers only.

PR Tasks

@cypress-app-bot
Copy link
Collaborator

@MikeMcC399
Copy link
Contributor Author

Supporting Python 3.12 requires a minimum of node-gyp@10.0.0 which takes care of the removal of distutils in Python 3.12. There are multiple npm modules which would need to be updated in Cypress before node-gyp@10.x could be used, so I expect that the restriction to use no higher than Python 3.11 will be in place for some significant time period.

@jennifer-shehane jennifer-shehane merged commit b7187bc into cypress-io:develop Jan 22, 2024
64 of 66 checks passed
@MikeMcC399 MikeMcC399 deleted the issue-28695-python-version branch January 22, 2024 18:36
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.

Python 3.12 build error "No module named 'distutils'"
4 participants