0

I am trying to install node talib in a particular directory but I keep getting the following error message:

gyp ERR! configure error
gyp ERR! stack Error: Command failed: /Users/martijnbeeks/anaconda3/bin/python -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack   File "<string>", line 1
gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack                                ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:294:12)
gyp ERR! stack     at ChildProcess.emit (events.js:198:13)
gyp ERR! stack     at maybeClose (internal/child_process.js:982:16)
gyp ERR! stack     at Socket.stream.socket.on (internal/child_process.js:389:11)
gyp ERR! stack     at Socket.emit (events.js:198:13)
gyp ERR! stack     at Pipe._handle.close (net.js:606:12)
gyp ERR! System Darwin 18.7.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure"
gyp ERR! cwd /Users/martijnbeeks/ProjectY/gekko-develop/talib
gyp ERR! node -v v10.16.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! talib@1.1.2 install: `node ./src/lib/build.js && node-gyp configure && node-gyp build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the talib@1.1.2 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:

Does anyone know what I am doing wrong? I am somehow thinking it interferes with Python and I completely removed Python but it was still not working. I have node.js version v10.16.3 and Python 3.7.4.

Thanks in advance,

Martijn

1 Answers1

0

I had the same issue here. I found out it was related to default OS X python been changed from version 2 to 3, as Python3 breaks backwards compatibility (for more info, see how to change default python version?).

I solved it, by opening an OS X terminal window:

$ which python
/usr/local/bin/python
$ /usr/local/bin/python -V
Python 3.7.1
$ which python2.7
/usr/bin/python2.7
$ rm /usr/local/bin/python
$ ln -s /usr/bin/python2.7 /usr/local/bin/python

This will create a symbolic link for python2 as your default python interpreter, bringing compatibility back.

Now I was able to install node talib without any problem.

I hope it works for you as well.

Roberto Narciso
  • 344
  • 2
  • 5