question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Registration of backend tensorflow failed

See original GitHub issue

TensorFlow.js version

    "@tensorflow/tfjs": "^0.13.1",
    "@tensorflow/tfjs-node-gpu": "^0.1.17",

Browser version

N/A

Describe the problem or feature request

Following error is displayed:

Registration of backend tensorflow failed
Error: The specified module could not be found.
\\?\C:\Users\me\Repos\predict\node_modules\@tensorflow\tfjs-node-gpu\build\Release\tfjs_binding.node
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:731:18)
    at Module.load (internal/modules/cjs/loader.js:612:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
    at Function.Module._load (internal/modules/cjs/loader.js:543:3)
    at Module.require (internal/modules/cjs/loader.js:650:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at bindings (C:\Users\me\Repos\predict\node_modules\bindings\bindings.js:81:44)
    at C:\Users\me\Repos\predict\node_modules\@tensorflow\tfjs-node-gpu\dist\index.js:10:60
    at Environment.registerBackend (C:\Users\me\Repos\predict\node_modules\@tensorflow\tfjs-node-gpu\node_modules\@tensorflow\tfjs-core\dist\environment.js:196:27)
    at Object.<anonymous> (C:\Users\me\Repos\predict\node_modules\@tensorflow\tfjs-node-gpu\dist\index.js:9:9)

I’ve checked the specified directory/file and it exists.

Code to reproduce the bug / link to feature request

I’m trying the most basic example shown here: https://js.tensorflow.org/#getting-started

I have tfjs-node-gpu successfully installed on Windows. Tried both:

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

And:

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

@tensorflow/tfjs-node-gpu is required only once.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:33 (11 by maintainers)

github_iconTop GitHub Comments

6reactions
rahbaricommented, Nov 17, 2018

I have the same problem as @timbur, tfjs_binding.node is there but I got “Error: The specified module could not be found.”

annotation 2018-11-17 163615

I tied both CommonJS and ES6Modules:

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

and:

import * as tf from '@tensorflow/tfjs';
import '@tensorflow/tfjs-node-gpu';

annotation 2018-11-17 163852

annotation 2018-11-17 163959

I have Win10, Nodejs 11.2, Python 2.7. I tried VS2015 and VS2017, with both I get same error after install.

EDIT ------------------------------------------

after some struggles I found I out that I haven’t install required nvidia drivers and tools, so for those who have the same problem you must install CUDA Toolkit 9 (Not 10 for now) and cuDNN SDK for CUDA Toolkit 9 and append them to windows path which is explained in detail at this page: https://www.tensorflow.org/install/gpu

3reactions
nkreegercommented, Sep 28, 2018

We ship 0.12.7 right now in the tfjs-node package. Sorry for the confusion - but you only have to npm install @tensorflow/tfjs-node today. That package ships with a supported version of @tensorflow/tfjs.

So basically this:

  "dependencies": {
    "@tensorflow/tfjs-node": "^0.1.17",
    ...
  }
// Package ships with '@tensorflow/tfjs':
const tf = require('@tensorflow/tfjs');
require('@tensorflow/tfjs-node');

...
Read more comments on GitHub >

github_iconTop Results From Across the Web

Initialization of backend tensorflow failed Error: Could not ...
One of the following steps might help to fix your problem: Do a clean installation of your dependencies. Delete the the node_modules folder...
Read more >
@tensorflow/tfjs-node - npm
This repository provides native TensorFlow execution in backend JavaScript applications under the Node.js runtime, accelerated by the TensorFlow ...
Read more >
@tensorflow/tfjs-backend-webgl - npm package | Snyk
@tensorflow/tfjs-backend-webgl. v4.1.0. GPU accelerated WebGL backend for TensorFlow.js For more information about how to use this package see README.
Read more >
cpu backend was already registered as global error
You received this message because you are subscribed to the Google Groups "TensorFlow.js Discussion" group. To unsubscribe from this group and stop receiving ......
Read more >
Upgrading to TensorFlow.js 3.0
We also no longer register gradients for kernels by default. If you want gradient/training ... import '@tensorflow/tfjs-backend-webgl';
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found