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

Give mac developers feedback when yarn install fails for missing Python 3.10 dependency #59

Conversation

jsnbuchanan
Copy link
Contributor

@jsnbuchanan jsnbuchanan commented Mar 23, 2024

Resolves #58

Fix

  • Give mac developers feedback when yarn install fails for missing Python 3.10 dependency

Problem

On macOS, this script checks if Python 3.10 is installed and accessible to node-gyp.

I ran into a problem trying to yarn install, with a system Python version of 3.12.2, but ran into the error ModuleNotFoundError: No module named 'distutils'. Since node-gyp relies on distutils, which is removed in Python 3.12, you need to use a Python version that still includes distutils.

Before

Verbose, but unhelpful error during yarn install, reading ModuleNotFoundError: No module named 'distutils'

After

  • Wrong python version

    clearly-communicate-wrong-python-version

  • Non-existing path set for NODE_GYP_FORCE_PYTHON

    non-existent-python-path

  • path set for NODE_GYP_FORCE_PYTHON without execute permission

    python-without-execute-permissions

Proof-of-Contribution PR

MorpheusAIs/Docs#121

| 0x9dc9f9Bd590c4534dDdD61947b8a74584F8760A3 | #58, #59 | 4 | Give mac developers actionable feedback when Lite-Client yarn install fails for missing Python 3.10 dependency |

…f an incorrect python dependency

On macOS, this script checks if Python 3.10 is installed and accessible to node-gyp.

I ran into a problem trying to `yarn` install, with a system Python version of `3.12.2`, but ran into the error `ModuleNotFoundError: No module named 'distutils'`. Since node-gyp relies on `distutils`, which is removed in Python `3.12`, you need to use a Python version that still includes `distutils`.
@jsnbuchanan
Copy link
Contributor Author

Example of the remedies suggested, in case you want to check them:

When: Incompatible Python version 3.12.2 found. Python 3.10 is required.

Suggested remedy:
STEP 1: Check for versions of python installed on your system. For example, if you use brew:

brew list --versions | grep python

STEP 2: If python 3.10 was not found, install it. For example:

brew install [email protected]

STEP 3: Ensure you have an environment variable for NODE_GYP_FORCE_PYTHON pointing to your python 3.10 path.
For example, assuming you installed [email protected] with brew:

export NODE_GYP_FORCE_PYTHON=$(brew --prefix [email protected])/bin/python3.10

@betterbrand
Copy link
Contributor

Have you tested this on win and Linux?

@jsnbuchanan
Copy link
Contributor Author

Fair point @betterbrand, I have not.

I figured that the build workflows on the .github > workflows > build.yml build_on_linux and build_on_win would be able to give me a pass on that.

Is that a bad assumption? Are those not run on feature branches?

Willing to figure out how to do that locally.

Copy link
Contributor

@betterbrand betterbrand left a comment

Choose a reason for hiding this comment

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

Looks Great!

@betterbrand betterbrand merged commit 4ae6e2e into MorpheusAIs:main Mar 29, 2024
3 checks passed
@jsnbuchanan jsnbuchanan deleted the fix/yarn-install-feedback-for-missing-python3.10-dependency branch March 29, 2024 20:25
@vintidui vintidui mentioned this pull request Apr 15, 2024
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.

Yarn install fails on macOS when missing Python 3.10 dependency with very vague error
2 participants