tensorflow / tfjs

A WebGL accelerated JavaScript library for training and deploying ML models.
https://js.tensorflow.org
Apache License 2.0
18.51k stars 1.93k forks source link

Node.js Tensorflow.js in windows binding: The kernel 'undefined' for backend 'webgl' is already registered #4587

Closed daw454 closed 3 years ago

daw454 commented 3 years ago

Hello,

when I try to establish a binding of tensorflow.js with node.js I get the following error message:

The kernel 'undefined' for backend 'webgl' is already registered
The kernel 'undefined' for backend 'webgl' is already registered
The kernel 'undefined' for backend 'webgl' is already registered
The kernel 'undefined' for backend 'webgl' is already registered
The kernel 'undefined' for backend 'webgl' is already registered
undefined
Platform node has already been set. Overwriting the platform with [object Object].
C:\Users\AW\node_modules\@tensorflow\tfjs-node\dist\index.js:49
    throw new Error("The Node.js native addon module (tfjs_binding.node) can not " +
    ^

Error: The Node.js native addon module (tfjs_binding.node) can not be found at path: C:\Users\Dominique.AW\node_modules\@tensorflow\tfjs-node\lib\napi-v7\tfjs_binding.node.
Please run command 'npm rebuild @tensorflow/tfjs-node build-addon-from-source' to rebuild the native addon module.
If you have problem with building the addon module, please check https://github.com/tensorflow/tfjs/blob/master/tfjs-node/WINDOWS_TROUBLESHOOTING.md or file an issue.
    at Object.<anonymous> (C:\Users\Dominique.AW\node_modules\@tensorflow\tfjs-node\dist\index.js:49:11)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (C:\Users\Dominique.AW\Desktop\TSTutorial-master\trial_tensorflowjs.js:8:1)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)

Process finished with exit code 1

Using node-gyp configure --verbose I get the following output:

gyp info it worked if it ends with ok
gyp verb cli [
gyp verb cli   'C:\\Program Files\\nodejs\\node.exe',
gyp verb cli   'C:\\Users\\AW\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js',
gyp verb cli   'configure',
gyp verb cli   '--verbose'
gyp verb cli ]
gyp info using node-gyp@7.1.2
gyp info using node@14.15.4 | win32 | x64
gyp verb command configure []
gyp verb find Python Python is not set from command line or npm configuration
gyp verb find Python Python is not set from environment variable PYTHON
gyp verb find Python checking if "python3" can be used
gyp verb find Python - executing "python3" to get executable path
gyp verb find Python - "python3" is not in PATH or produced an error
gyp verb find Python checking if "python" can be used
gyp verb find Python - executing "python" to get executable path
gyp verb find Python - executable path is "C:\Users\Dominique.AW\Anaconda3\python.exe"
gyp verb find Python - executing "C:\Users\AW\Anaconda3\python.exe" to get version
gyp verb find Python - version is "3.8.3"
gyp info find Python using Python version 3.8.3 found at "C:\Users\Dominique.AW\Anaconda3\python.exe"
gyp verb get node dir no --target version specified, falling back to host node version: 14.15.4
gyp verb command install [ '14.15.4' ]
gyp verb install input version string "14.15.4"
gyp verb install installing version: 14.15.4
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version is already installed, need to check "installVersion"
gyp verb got "installVersion" 9
gyp verb needs "installVersion" 9
gyp verb install version is good
gyp verb get node dir target node version installed: 14.15.4
gyp verb build dir attempting to create "build" dir: C:\Users\Dominique.AW\Desktop\TSTutorial-master\build
gyp verb build dir "build" dir needed to be created? undefined
gyp verb find VS msvs_version not set from command line or npm config
gyp verb find VS VCINSTALLDIR not set, not running in VS Command Prompt
gyp verb find VS checking VS2019 (16.7.30330.147) found at:
gyp verb find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community"
gyp verb find VS - found "Visual Studio C++ core features"
gyp verb find VS - found VC++ toolset: v142
gyp verb find VS - missing any Windows SDK
gyp verb find VS could not find a version of Visual Studio 2017 or newer to use
gyp verb find VS looking for Visual Studio 2015
gyp verb find VS - not found
gyp verb find VS not looking for VS2013 as it is only supported up to Node.js 8
gyp ERR! find VS
gyp ERR! find VS msvs_version not set from command line or npm config
gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
gyp ERR! find VS checking VS2019 (16.7.30330.147) found at:
gyp ERR! find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community"
gyp ERR! find VS - found "Visual Studio C++ core features"
gyp ERR! find VS - found VC++ toolset: v142
gyp ERR! find VS - missing any Windows SDK
gyp ERR! find VS could not find a version of Visual Studio 2017 or newer to use
gyp ERR! find VS looking for Visual Studio 2015
gyp ERR! find VS - not found
gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
gyp ERR! find VS
gyp ERR! find VS **************************************************************
gyp ERR! find VS You need to install the latest version of Visual Studio
gyp ERR! find VS including the "Desktop development with C++" workload.
gyp ERR! find VS For more information consult the documentation at:
gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
gyp ERR! find VS **************************************************************
gyp ERR! find VS
gyp ERR! configure error
gyp ERR! stack Error: Could not find any Visual Studio installation to use
gyp ERR! stack     at VisualStudioFinder.fail (C:\Users\AW\AppData\Roaming\npm\node_modules\node-gyp\lib\find-visualstudio.js:121:47)
gyp ERR! stack     at C:\Users\AW\AppData\Roaming\npm\node_modules\node-gyp\lib\find-visualstudio.js:74:16
gyp ERR! stack     at VisualStudioFinder.findVisualStudio2013 (C:\Users\AW\AppData\Roaming\npm\node_modules\node-gyp\lib\find-visualstudio.js:351:14)
gyp ERR! stack     at C:\Users\AW\AppData\Roaming\npm\node_modules\node-gyp\lib\find-visualstudio.js:70:14
gyp ERR! stack     at C:\Users\AW\AppData\Roaming\npm\node_modules\node-gyp\lib\find-visualstudio.js:372:16
gyp ERR! stack     at C:\Users\AW\AppData\Roaming\npm\node_modules\node-gyp\lib\util.js:54:7
gyp ERR! stack     at C:\Users\AW\AppData\Roaming\npm\node_modules\node-gyp\lib\util.js:33:16
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:315:5)
gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
gyp ERR! stack     at maybeClose (internal/child_process.js:1048:16)
gyp ERR! System Windows_NT 10.0.19041
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Dominique.AW\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--verbose"
gyp ERR! cwd C:\Users\AW\Desktop\TSTutorial-master
gyp ERR! node -v v14.15.4
gyp ERR! node-gyp -v v7.1.2
gyp ERR! not ok
rthadur commented 3 years ago

@rthadur can you please share your package.json ?

google-ml-butler[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you.

google-ml-butler[bot] commented 3 years ago

Closing as stale. Please @mention us if this needs more attention.

google-ml-butler[bot] commented 3 years ago

Are you satisfied with the resolution of your issue? Yes No