Npm NodeJS Installe node-gyp rebuild error "libtensorflow.so: file not recognized: File format not recognized"

628 views
Skip to first unread message

thebootsie123

unread,
Jul 30, 2018, 6:03:58 PM7/30/18
to TensorFlow.js Discussion
Hi. I created a web app in NodeJS which uses Tensorflow.js to get a prediction from a model trained in Python. What I'm trying to do is deploy that through IBM Cloud's Cloud Foundry SDK for NodeJS. The problem I'm running into is when I'm trying to push my project to IBM Cloud. From looking at the logs in the console it seems that Tensorflow.js Node when it's installing and runs node-gyp rebuild it get's an error which is "libtensorflow.so: file not recognized: File format not recognized". The node version is greater then 8 and it's running Ubuntu 14.04. Anyone know how I can fix this? Here are the logs.

Staging app and tracing logs...

   Creating container

   Successfully created container

   Downloading app package...

   Downloaded app package (48M)

   Downloading build artifacts cache...

   Downloaded build artifacts cache (484.1K)

   Staging...

   -----> Download go 1.9.1

   -----> Running go build supply

   -----> Nodejs Buildpack version 1.6.30

   -----> Installing binaries

          engines.node (package.json): ^8.11.2

          engines.npm (package.json): ^5.6.0

   -----> Installing node 8.11.3

          Download [https://buildpacks.cloudfoundry.org/dependencies/node/node-8.11.3-linux-x64-cflinuxfs2-ba4bdc53.tgz]

          npm 5.6.0 already installed with node

   -----> Installing yarn 1.7.0

          Download [https://buildpacks.cloudfoundry.org/dependencies/yarn/yarn-v1.7.0-e7720ee3.tar.gz]

          Installed yarn 1.7.0

   -----> Creating runtime environment

          NODE_ENV=production

          NODE_HOME=/tmp/contents699216015/deps/0/node

          NODE_MODULES_CACHE=true

          NODE_VERBOSE=false

          NPM_CONFIG_LOGLEVEL=error

          NPM_CONFIG_PRODUCTION=true

   -----> Building dependencies

          Prebuild detected (node_modules already exists)

          Rebuilding any native modules

   > proto...@6.8.8 postinstall /tmp/app/node_modules/protobufjs

   > node scripts/postinstall

   > @tensorflow/tfjs...@0.1.9 install /tmp/app/node_modules/@tensorflow/tfjs-node

   > node-gyp rebuild

   make: Entering directory `/tmp/app/node_modules/@tensorflow/tfjs-node/build'

     ACTION binding_gyp_tfjs_binding_target_download_libtensorflow Release/libtensorflow.so

     CXX(target) Release/obj.target/tfjs_binding/binding/tfe_utils.o

     CXX(target) Release/obj.target/tfjs_binding/binding/tfjs_backend.o

     CXX(target) Release/obj.target/tfjs_binding/binding/tfjs_binding.o

     SOLINK_MODULE(target) Release/obj.target/tfjs_binding.node

   /tmp/app/node_modules/@tensorflow/tfjs-node/deps/tensorflow/lib/libtensorflow.so: file not recognized: File format not recognized

   collect2: error: ld returned 1 exit status

   make: *** [Release/obj.target/tfjs_binding.node] Error 1

   make: Leaving directory `/tmp/app/node_modules/@tensorflow/tfjs-node/build'

   gyp ERR! build error 

   gyp ERR! stack Error: `make` failed with exit code: 2

   gyp ERR! stack     at ChildProcess.onExit (/tmp/contents699216015/deps/0/node/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)

   gyp ERR! stack     at emitTwo (events.js:126:13)

   gyp ERR! stack     at ChildProcess.emit (events.js:214:7)

   gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)

   gyp ERR! System Linux 4.4.0-109-generic

   gyp ERR! command "/tmp/contents699216015/deps/0/node/bin/node" "/tmp/contents699216015/deps/0/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"

   gyp ERR! cwd /tmp/app/node_modules/@tensorflow/tfjs-node

   gyp ERR! node -v v8.11.3

   gyp ERR! node-gyp -v v3.6.2

   gyp ERR! not ok 

   npm ERR! code ELIFECYCLE

   npm ERR! errno 1

   npm ERR! @tensorflow/tfjs...@0.1.9 install: `node-gyp rebuild`

   npm ERR! Exit status 1

   npm ERR! 

   npm ERR! Failed at the @tensorflow/tfjs...@0.1.9 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:

   npm ERR!     /home/vcap/.npm/_logs/2018-07-30T21_53_19_381Z-debug.log

          **ERROR** Unable to build dependencies: exit status 1

   Failed to compile droplet: Failed to run all supply scripts: exit status 14

   Exit status 223

   Staging failed: STG: Exited with status 223

   Stopping instance b85ecf75-b007-40e4-8c59-b974f43bd31c

   Destroying container

   Successfully destroyed container

Error staging application: App staging failed in the buildpack compile phase

FAILED

Kangyi Zhang

unread,
Jul 30, 2018, 6:15:21 PM7/30/18
to thebootsie123, TensorFlow.js Discussion
Hi there,

This should because of an open issue: https://github.com/tensorflow/tfjs/issues/542.

Before we submit a fix, a quick workaround would be to reinstall @tensorflow/tfjs-node in IBM Cloud bash (if they provide access), 

or change your start script to
"scripts": {
  "start": "npm rebuild @tensorflow/tfjs-node && node index.js"
}

Kangyi

--
You received this message because you are subscribed to the Google Groups "TensorFlow.js Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tfjs+unsubscribe@tensorflow.org.
Visit this group at https://groups.google.com/a/tensorflow.org/group/tfjs/.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/tfjs/402a781c-682e-4b72-9403-def87801470b%40tensorflow.org.

thebootsie123

unread,
Jul 30, 2018, 6:43:02 PM7/30/18
to TensorFlow.js Discussion, boots...@gmail.com
Hi. Thanks for the reply. I think the cause of the issue may be because of the one you linked. However, the problem I'm having is when I push my project to IBM Cloud it reinstalls all of the modules the first time you push an application. So, for some reason I keep getting this error when it's installing the module again.

thebootsie123

unread,
Jul 30, 2018, 6:53:24 PM7/30/18
to TensorFlow.js Discussion
Well, that's kinda weird. I managed to fix the issue by removing the node_modules folder in my working directory before pushing to IBM Cloud.

thebootsie123

unread,
Jul 30, 2018, 7:32:34 PM7/30/18
to TensorFlow.js Discussion
Hi. Now I'm getting the exact error from the opened issue. Although, I do have a little bit of a variation.

Registration of backend tensorflow failed
Error: libtensorflow.so: cannot open shared object file: No such file or directory
Reply all
Reply to author
Forward
0 new messages