0

The following install fails:

$ sudo yarn add -P web3@1.0.0-beta.26

Here's the error:

gyp ERR! configure error 
gyp ERR! stack Error: Python executable "/anaconda3/bin/python" is v3.6.4, which is not supported by gyp.
gyp ERR! stack You can pass the --python switch to point to Python >= v2.5.0 & < 3.0.0.

If I were using 'npm' as the package manager, the following command would resolve the issue:

$ sudo npm install --save web3@1.0.0-beta.26 --python=pyhon2.7

But, I bootstrapped my project with 'create-react-app', which defaults to using 'yarn' as the package manager.

So, what's the syntax for switching versions of python, using 'yarn', as mentioned in the error message. I've gone through guessing several variations to no avail. And, I'm not finding any solution that fits the circumstance.

TylerH
  • 20,799
  • 66
  • 75
  • 101
Ron Allen Smith
  • 603
  • 2
  • 7
  • 19
  • could you just make a new virtual env that uses one of those versions of python and then migrate your project over? – Digbigpig Jun 07 '18 at 01:47

1 Answers1

1

Try setting python version as an environmental variable.

npm config --global set python /usr/bin/python2.7

You can read more about this in this issue

sudo bangbang
  • 27,127
  • 11
  • 75
  • 77
  • Yes, I just found your citation too. Should have checked this post while I was researching. I opted to use a .npmrc file in the project directory with the one-liner: python = "/usr/bin/python2.7" since this is the only time I've used 'yarn' to install web3 dependencies. It's a less permanent solution for now. – Ron Allen Smith Jun 07 '18 at 09:57