-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Registration of backend tensorflow failed #739
Comments
tfjs-node now ships with tfjs - so you don't need to npm install @tensorflow/tfjs. Can you show me the output from the command:
Make sure you have Python 2.7 on windows - 3.x is not supported with node-gyp (build tool for Node.js addons). |
If const tf = require('@tensorflow/tfjs')
require('@tensorflow/tfjs-node-gpu') |
Hi, I have the same problem with a different error message.
Once I remove I guess the reason I got above error was I first installed Anyway, thanks @nkreeger 👍 |
I experienced a similar problem to @craftgear. I already had
|
We ship 0.12.7 right now in the So basically this:
// Package ships with '@tensorflow/tfjs':
const tf = require('@tensorflow/tfjs');
require('@tensorflow/tfjs-node');
... |
@nkreeger thanks for that info. So it can be assumed that |
What about the GPU version? I'm still having the issue in my original post after a fresh install of only Console output:
|
@timbur Can you try this:
Post the output here. Also - might be easier to clone the tfjs-node repo and try running node-gyp build inside of that clone. |
Output:
Also, the file is definitely there:
I wonder if I should try a fresh install of everything - i.e., node, npm, python, git bash, etc. I wonder if somehow things got borked because I did at one point have both python 2 and 3 installed (now only 2). |
@nkreeger
then index.js with just
runned as .mjs
runned with webpack
After installing @tensorflow/tfjs
I did not have the kind of luck @brannondorsey had. No matter if I install them one by one or cleaning aup everything running install with the dependencies |
Automatically closing due to lack of recent activity. Please update the issue when new information becomes available, and we will reopen the issue. Thanks! |
PS C:\Users\xdx\Documents\programming\programming-env-debug> cd node_modules/@tensorflow/tfjs-node-gpu
PS C:\Users\xdx\Documents\programming\programming-env-debug\node_modules\@tensorflow\tfjs-node-gpu> node-gyp build
gyp info it worked if it ends with ok
gyp info using node-gyp@3.8.0
gyp info using node@10.11.0 | win32 | x64
gyp info spawn C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe
gyp info spawn args [ 'build/binding.sln',
gyp info spawn args '/clp:Verbosity=minimal',
gyp info spawn args '/nologo',
gyp info spawn args '/p:Configuration=Release;Platform=x64' ]
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
deps-stage
(node:7796) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, rename 'C:\Users\xdx\Documents\programming\programming-en
v-debug\node_modules\@tensorflow\tfjs-node-gpu\deps\lib\tensorflow.dll' -> 'C:\Users\xdx\Documents\programming\programming-env-debug\node_modules
\@tensorflow\tfjs-node-gpu\build\Release\tensorflow.dll'
(node:7796) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function wi
thout a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:7796) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will
terminate the Node.js process with a non-zero exit code.
generate_def
build-tensorflow-lib
Microsoft (R) Library Manager Version 14.00.24210.0
Copyright (C) Microsoft Corporation. All rights reserved.
Creating library Release\obj\tfjs_binding\tensorflow.lib and object Release\obj\tfjs_binding\tensorflow.exp
Creating library C:\Users\xdx\Documents\programming\programming-env-debug\node_modules\@tensorflow\tfjs-node-gpu\build\Release\tfjs_binding.li
b and object C:\Users\xdx\Documents\programming\programming-env-debug\node_modules\@tensorflow\tfjs-node-gpu\build\Release\tfjs_binding.exp
Generating code
2 of 842 functions ( 0.2%) were compiled, the rest were copied from previous compilation.
0 functions were new in current compilation
0 functions had inline decision re-evaluated but remain unchanged
Finished generating code
tfjs_binding.vcxproj -> C:\Users\xdx\Documents\programming\programming-env-debug\node_modules\@tensorflow\tfjs-node-gpu\build\Release\\tfjs_bindi
ng.node
tfjs_binding.vcxproj -> C:\Users\xdx\Documents\programming\programming-env-debug\node_modules\@tensorflow\tfjs-node-gpu\build\Release\tfjs_bindin
g.pdb (Full PDB)
gyp info ok
PS C:\Users\xdx\Documents\programming\programming-env-debug\node_modules\@tensorflow\tfjs-node-gpu> cd ../../../
PS C:\Users\xdx\Documents\programming\programming-env-debug> ts-node .\src\tfjs-test.tsx
Registration of backend tensorflow failed
Error: The specified module could not be found.
\\?\C:\Users\xdx\Documents\programming\programming-env-debug\node_modules\@tensorflow\tfjs-node-gpu\build\Release\tfjs_binding.node
at Object.Module._extensions..node (internal/modules/cjs/loader.js:718:18)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:20:18)
at bindings (C:\Users\xdx\Documents\programming\programming-env-debug\node_modules\bindings\bindings.js:81:44)
at C:\Users\xdx\Documents\programming\programming-env-debug\node_modules\@tensorflow\tfjs-node-gpu\dist\index.js:11:60
at Environment.registerBackend (C:\Users\xdx\Documents\programming\programming-env-debug\node_modules\@tensorflow\tfjs-core\src\environment.ts:417:23)
at Object.<anonymous> (C:\Users\xdx\Documents\programming\programming-env-debug\node_modules\@tensorflow\tfjs-node-gpu\dist\index.js:10:9)
============================
Hi there 👋. Looks like you are running TensorFlow.js in Node.js. To speed things up dramatically, install our node backend, which binds to TensorFlo
w C++, by running npm i @tensorflow/tfjs-node, or npm i @tensorflow/tfjs-node-gpu if you have CUDA. Then call require('@tensorflow/tfjs-node'); (-gpu suffix for CUDA) at the start of your program. Visit https://github.com/tensorflow/tfjs-node for more details.
============================ I did |
node-gyp build won't really work because we do some pre-work. You'll want to invoke: https://github.com/tensorflow/tfjs-node/blob/master/scripts/install.js |
PS C:\Users\xdx\Documents\programming\programming-env-debug> node .\node_modules\@tensorflow\tfjs-node-gpu\scripts\install.js
* Downloading libtensorflow
[==============================] 5070185/bps 99% 0.0s
* Building TensorFlow Node.js bindings
C:\Users\xdx\Documents\programming\programming-env-debug\node_modules\@tensorflow\tfjs-node-gpu\scripts\install.js:154
throw new Error('node-gyp rebuild failed with: ' + err);
^
Error: node-gyp rebuild failed with: Error: Command failed: node-gyp rebuild
gyp info it worked if it ends with ok
gyp info using node-gyp@3.8.0
gyp info using node@10.11.0 | win32 | x64
gyp info spawn C:\Python27\python.EXE
gyp info spawn args [ 'C:\\Users\\xdx\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'msvs',
gyp info spawn args '-G',
gyp info spawn args 'msvs_version=auto',
gyp info spawn args '-I',
gyp info spawn args 'C:\\Users\\xdx\\Documents\\programming\\programming-env-debug\\build\\config.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\\Users\\xdx\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\\Users\\xdx\\.node-gyp\\10.11.0\\include\\node\\common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=C:\\Users\\xdx\\.node-gyp\\10.11.0',
gyp info spawn args '-Dnode_gyp_dir=C:\\Users\\xdx\\AppData\\Roaming\\npm\\node_modules\\node-gyp',
gyp info spawn args '-Dnode_lib_file=C:\\Users\\xdx\\.node-gyp\\10.11.0\\<(target_arch)\\node.lib',
gyp info spawn args '-Dmodule_root_dir=C:\\Users\\xdx\\Documents\\programming\\programming-env-debug',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'C:\\Users\\xdx\\Documents\\programming\\programming-env-debug\\build',
gyp info spawn args '-Goutput_dir=.' ]
gyp: binding.gyp not found (cwd: C:\Users\xdx\Documents\programming\programming-env-debug) while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (C:\Users\xdx\AppData\Roaming\npm\node_modules\node-gyp\lib\configure.js:345:16)
gyp ERR! stack at ChildProcess.emit (events.js:182:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\xdx\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\xdx\Documents\programming\programming-env-debug
gyp ERR! node -v v10.11.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
at cp.exec (C:\Users\xdx\Documents\programming\programming-env-debug\node_modules\@tensorflow\tfjs-node-gpu\scripts\install.js:154:13)
at ChildProcess.exithandler (child_process.js:296:5)
at ChildProcess.emit (events.js:182:13)
at maybeClose (internal/child_process.js:962:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5) @nkreeger I got this output. 😟 |
When you invoke through node_modules - node_gyp tries to compile in your actual project directory. Might be easier to rm -rf node_modules and re-run |
PS C:\Users\xdx\Documents\programming\programming-env-debug> yarn install
yarn install v1.12.1
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
Done in 265.89s.
PS C:\Users\xdx\Documents\programming\programming-env-debug> ts-node .\src\tfjs-test.tsx
Registration of backend tensorflow failed
Error: The specified module could not be found.
\\?\C:\Users\xdx\Documents\programming\programming-env-debug\node_modules\@tensorflow\tfjs-node-gpu\build\Release\tfjs_binding.node
at Object.Module._extensions..node (internal/modules/cjs/loader.js:718:18)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:20:18)
at bindings (C:\Users\xdx\Documents\programming\programming-env-debug\node_modules\bindings\bindings.js:81:44)
at C:\Users\xdx\Documents\programming\programming-env-debug\node_modules\@tensorflow\tfjs-node-gpu\dist\index.js:11:60
at Environment.registerBackend (C:\Users\xdx\Documents\programming\programming-env-debug\node_modules\@tensorflow\tfjs-core\src\environment.ts:417:23)
at Object.<anonymous> (C:\Users\xdx\Documents\programming\programming-env-debug\node_modules\@tensorflow\tfjs-node-gpu\dist\index.js:10:9) @nkreeger I'm still getting that same error. It looks like it is also using a globally installed Thank you very much for your help. 🤗 |
I have the same problem as @timbur, tfjs_binding.node is there but I got "Error: The specified module could not be found." I tied both CommonJS and ES6Modules:
and:
I have Win10, Nodejs 11.2, Python 2.7. 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 |
It looks like you are running inside JetBrains? If so - can you try running through that command prompt that you installed with? I wonder if a path is not working correctly in the JetBrains IDE. |
@rahbari Thanks for your edit pointing out that the software libraries need to be installed as prerequisites. I guess I just glanced over that or ignored it. I'm doing that now and I'm confident that will solve the issue I'm having. I should have read the documentation more closely. ❤👀 |
@nkreeger I hadn't installed CUDA SDK, after installing everything works fine in Intellij. |
Hi i'm getting the same error here in 2019! Would appreciate some help, about to go into production Thanks! Dan To get help from the community, check out our Google group. TensorFlow.js versionTFJS core: "version": "0.13.11" Browser versionnon applicable - API Describe the problem or feature requestHi I've just installed a new aws ec2 instance of an api that serves predictions from a node API, node version is 8.13 which has worked for me previously on the same instance, but after pulling a newer version of the codebase i am now getting this error: Registration of backend tensorflow failed Code to reproduce the bug / link to feature requestas above |
cc @nkreeger . Have you tried removing node_modules, and re-running yarn/npm to re-install the tfjs-node dependency? Looks like the TF C++ library is missing in node_modules/. |
Hey .. that nailed it thanks, reinstalled tfjs-node, all working fine now : ) |
Yes. I removed node_modules folder and reinstall modules including @tensorflow/tfjs-node that works. |
Can someone please explain step by step how to get the gpu version to install on a fresh windows 10? I have everything else installed properly afaik and it still craps out at the node-gyp rebuild step of install.js with no information whatsoever on what the problem is. The plain node version installs fine. It’s been 4 months. |
Yeah I officially give up. I can’t believe how bad this node-gyp stuff still is in 2019. Is it easier to use the gpu version on Linux or something? Also, why is the rebuild step even required? Why doesn't it come with whatever is needed, precompiled? This is the error I see no matter what:
|
I am facing the same issue. I am using react native and It works fine when i import it Version used: "@tensorflow/tfjs": "^1.1.2" |
@kir486680 We don't officially support React Native - it is something we're planning on investigating soon. |
@nkreeger , what is the isuue here please. gyp info it worked if it ends with ok |
Initialization of backend tensorflow failed ============================
|
tried to build with bazel: got bellow error tensorflow git:(master) bazel build --config=monolithic //tensorflow/tools/lib_package:libtensorflow Starting local Bazel server and connecting to it...
INFO: Call stack for the definition of repository 'grpc' which is a tf_http_archive (rule definition at /home/julkarnine/Downloads/tensorflow/third_party/repo.bzl:126:19):
and referenced by '//tensorflow/core:version_info_gen' and referenced by '//tensorflow/core:version_info_gen' and referenced by '//tensorflow/core:version_info_gen' INFO: Elapsed time: 5.385s |
is there any problem CUDA Device Query (Runtime API) version (CUDART static linking) Detected 1 CUDA Capable device(s) Device 0: "GeForce RTX 2060" deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 10.0, CUDA Runtime Version = 9.0, NumDevs = 1 |
TensorFlow.js version
Browser version
N/A
Describe the problem or feature request
Following error is displayed:
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:And:
@tensorflow/tfjs-node-gpu
is required only once.The text was updated successfully, but these errors were encountered: