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

Yarn missing python flag #3519

Open
OmgImAlexis opened this issue May 29, 2017 · 8 comments
Open

Yarn missing python flag #3519

OmgImAlexis opened this issue May 29, 2017 · 8 comments

Comments

@OmgImAlexis
Copy link

OmgImAlexis commented May 29, 2017

Do you want to request a feature or report a bug?
Feature request

What is the current behavior?
yarn add x --python=2.7 ignores the flag.

What is the expected behavior?
Yarn should use the specified version of python when building modules since npm does.
Yarn should also check the python flag set in the npm config for example running this command doesn't change the python version being used. npm config set python python2.7

Ref: trentm/node-bunyan#216 (comment)

Please mention your node.js, yarn and operating system version.
N/A

@bestander
Copy link
Member

Python is not a feature of Yarn, it is used by node-gyp.
You probably can pass python version via environment variables

@OmgImAlexis
Copy link
Author

Since it can be passed in npm it should work the same in yarn. Most users with issues ended up having to move back to npm just to get their deps installed and they really shouldn't have to rely on environment variables when there's a npm setting for this.

@franciscorubin

This comment has been minimized.

@jcrben
Copy link

jcrben commented Feb 10, 2018

Seems like the environment variable approach is working for me. On my macOS I have:
export npm_config_python=/usr/bin/python while I meanwhile use python3 with pyenv.

Yarn install fails when I don't have the environment variable and works when I do. This seems consistent with https://github.com/nodejs/node-gyp/tree/05d2002258596a9693d6042d573c7fd20449ad23#configuration which says "node-gyp responds to environment variables or npm configuration".

If it's set right, you should see python when typing npm config list:
image

@matthewchung74
Copy link

this is what i ended up doing npm config --global set python /usr/bin/python

@MattFisher
Copy link

Creating a .npmrc file in the project folder containing python = "/usr/bin/python2.7" works too.

@mracette
Copy link

mracette commented Jan 5, 2022

It looks like this is valid now:

yarn config set python /usr/bin/python2

❯ yarn -v
1.22.17

@ykchong45
Copy link

It looks like this is valid now:

yarn config set python /usr/bin/python2

❯ yarn -v
1.22.17

On Windows 11, I specify the full path to the python executable.

yarn config set python /path/to/python.exe

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

No branches or pull requests

9 participants