Andrew
Andrew

Reputation: 3613

Initialization of backend tensorflow failed Error: Could not locate the bindings file

I'm receiving this error when trying to use tensorflow on an ubuntu box. It's a fresh npm install in a new folder. I've tried the suggestions from other posts but still can't get it. Is there something I'm missing?

Initialization of backend tensorflow failed Error: Could not locate the bindings file. Tried: → /var/nodejs/tensor/node_modules/@tensorflow/tfjs-node/build/tfjs_binding.node, ... etc

node: v10.12.0

npm: 6.7.0

package.json

{
  "name": "tensor",
  "scripts": {
    "start": "node algo.js"
  },
  "dependencies": {
    "@tensorflow/tfjs-node": "*"
  }
}

algo.js

const tf = require('@tensorflow/tfjs-node');

Upvotes: 2

Views: 1712

Answers (1)

Thomas Dondorf
Thomas Dondorf

Reputation: 25230

One of the following steps might help to fix your problem:

  • Do a clean installation of your dependencies
    • Delete the the node_modules folder
    • Rerun npm install
  • (Re)install node-gyp:
    • sudo npm install -g node-gyp
  • Install your dependencies via sudo
    • sudo npm install
    • If this step works, it is very likely that you are having a permission issue in your directory structure. You might want to check out this question on how to resolve the issue.

Upvotes: 2

Related Questions