Gyp ERR! stack pyenv: python2: command not found


#1

Hi,

Trying to install some packages for Atom, and it seems to be using the build in node-gyp from “/Applications/Atom.app/Contents/Resources/app/apm/node_modules/.bin/node-gyp”.

Unforutunuty the build in node-gyp won’t read my python environment which I’m setting via .pyenv

How can I fix this?

➜  ~ python --version
Python 3.4.0
➜  ~ cd Project
➜  Project git:(master) ✗ cat .python-version
2.7.12
➜   git:(master) ✗ python --version
Python 2.7.12
➜  Project git:(master) ✗ apm install term2
Installing term2 to /Users/maximveksler/.atom/packages ✗

> pty.js@0.2.13 install /private/var/folders/ds/1p69lc1j7_x9y0q4b4g2cclh0000gn/T/apm-install-dir-117010-51776-1vmy5s3/node_modules/term2/node_modules/pty.js
> node-gyp rebuild

/private/var/folders/ds/1p69lc1j7_x9y0q4b4g2cclh0000gn/T/apm-install-dir-117010-51776-1vmy5s3
└── (empty)


gyp ERR! configure error
gyp ERR! stack Error: Command failed: /Users/maximveksler/.pyenv/shims/python2 -c import platform; print(platform.python_version());
gyp ERR! stack pyenv: python2: command not found
gyp ERR! stack
gyp ERR! stack The `python2' command exists in these Python versions:
gyp ERR! stack   2.7.12
gyp ERR! stack
gyp ERR! stack
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:213:12)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at maybeClose (internal/child_process.js:827:16)
gyp ERR! stack     at Socket.<anonymous> (internal/child_process.js:319:11)
gyp ERR! stack     at emitOne (events.js:77:13)
gyp ERR! stack     at Socket.emit (events.js:169:7)
gyp ERR! stack     at Pipe._onclose (net.js:477:12)
gyp ERR! System Darwin 16.3.0
gyp ERR! command "/Applications/Atom.app/Contents/Resources/app/apm/bin/node" "/Applications/Atom.app/Contents/Resources/app/apm/node_modules/.bin/node-gyp" "rebuild"
gyp ERR! cwd /private/var/folders/ds/1p69lc1j7_x9y0q4b4g2cclh0000gn/T/apm-install-dir-117010-51776-1vmy5s3/node_modules/term2/node_modules/pty.js
gyp ERR! node -v v4.4.5
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
npm WARN enoent ENOENT: no such file or directory, open '/private/var/folders/ds/1p69lc1j7_x9y0q4b4g2cclh0000gn/T/apm-install-dir-117010-51776-1vmy5s3/package.json'
npm WARN apm-install-dir-117010-51776-1vmy5s3 No description
npm WARN apm-install-dir-117010-51776-1vmy5s3 No repository field.
npm WARN apm-install-dir-117010-51776-1vmy5s3 No README data
npm WARN apm-install-dir-117010-51776-1vmy5s3 No license field.
npm ERR! Darwin 16.3.0
npm ERR! argv "/Applications/Atom.app/Contents/Resources/app/apm/bin/node" "/Applications/Atom.app/Contents/Resources/app/apm/node_modules/npm/bin/npm-cli.js" "--globalconfig" "/Users/maximveksler/.atom/.apm/.apmrc" "--userconfig" "/Users/maximveksler/.atom/.apmrc" "install" "/private/var/folders/ds/1p69lc1j7_x9y0q4b4g2cclh0000gn/T/d-117010-51776-yr6wco/package.tgz" "--runtime=electron" "--target=1.3.13" "--arch=x64" "--global-style"
npm ERR! node v4.4.5
npm ERR! npm  v3.10.5
npm ERR! code ELIFECYCLE

npm ERR! pty.js@0.2.13 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the pty.js@0.2.13 install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the pty.js package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs pty.js
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls pty.js
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /private/var/folders/ds/1p69lc1j7_x9y0q4b4g2cclh0000gn/T/apm-install-dir-117010-51776-1vmy5s3/npm-debug.log
npm ERR! code 1

➜  Project git:(master) ✗