tensorflow.dll is missing from tfjs-node and I can't build it following the instructions
See original GitHub issueI’ve tried just about every potential fix I could find on mitigating this issue from this very own GitHub Repo and other sources. I’m going to apologize upfront, because I plan on detailing all the results here.
OS: Windows 10 Enterprise (OS Build 19042.572) CPU: Intel® Core™ i7-7500U CPU @ 2.70GHz 2.90 GHz Node: v14.15.1 npm: v6.14.5 python: v2.7 node-gyp: @7.1.2 Tensorflow: @tensorflow/tfjs-node": “^2.7.0”
The origin of the issue is as follows:
- Removed the entirety of node_modules from the project
- Deleted package-lock.json
npm install
- Creating a main.ts which has the following:
import * as tf from '@tensorflow/tfjs-node';
async function get_model() {
const model = tf.sequential();
model.add(tf.layers.dense({ inputShape: [7], units: 124, activation: 'relu', kernelInitializer: 'leCunNormal' }));
model.add(tf.layers.dense({ units: 64, activation: 'relu' }));
model.add(tf.layers.dense({ units: 32, activation: 'relu' }));
model.add(tf.layers.dense({ units: 1, activation: "sigmoid" }));
model.summary();
return model;
}
get_model();
- tsc
- running the main.ts, produces
Error: The specified module could not be found.
\\?\c:\workspace\my_project\node_modules\@tensorflow\tfjs-node\lib\napi-v6\tfjs_binding.node
When I peek into that directory "c:\workspace\my_project\node_modules@tensorflow\tfjs-node\lib\napi-v6" I notice the .dll that should be created is missing.
At this point, I should note that this project WAS WORKING up until I did a recent windows update, node version update, and I changed the version of Tensorflow in package.json from ‘^1.3.2’ to ‘^2.7.0’.
Separately, I do have a working tfjs-examples/baseball-node project that I built before the windows update. The contents of its tfjs-node directory (C:\workspace\ml_examples\tfjs-examples\baseball-node\node_modules@tensorflow\tfjs-node\lib\napi-v5) DOES have a tensorflow.dll. Its package.json has: “@tensorflow/tfjs-node”: “^1.3.2”
The difference between napi-v5 and napi-v6 hasn’t escaped me, but I’m a novice when it comes to compiling these c++ libraries to js.
Now, back to my project.
I then tried doing the suggested instructions from other issues.
First, I navigate into “c:\workspace\my_project\node_modules@tensorflow\tfjs-node” and run
npm install --build-from-source
It runs but no .dll is created. Not sure if the following means anything
> core-js@3.7.0 postinstall C:\workspace\my_project\node_modules\@tensorflow\tfjs-node\node_modules\core-js
> node -e "try{require('./postinstall')}catch(e){}"
Next, from the same “c:\workspace\my_project\node_modules@tensorflow\tfjs-node” dir, I try,
npm run build-addon-from-source
which produces
> @tensorflow/tfjs-node@2.7.0 build-addon-from-source C:\workspace\my_project\node_modules\@tensorflow\tfjs-node
> node-pre-gyp install --build-from-source
node-pre-gyp WARN Using needle for node-pre-gyp https download
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
tfjs_backend.cc
tfjs_binding.cc
win_delay_load_hook.cc
Creating library C:\workspace\my_project\node_modules\@tensorflow\tfjs-node\build\Release\tfjs_binding.lib and object C:\workspace\my_project\nod
e_modules\@tensorflow\tfjs-node\build\Release\tfjs_binding.exp
tfjs_binding.vcxproj -> C:\workspace\my_project\node_modules\@tensorflow\tfjs-node\build\Release\\tfjs_binding.node
tfjs_binding.vcxproj -> C:\workspace\my_project\node_modules\@tensorflow\tfjs-node\build\Release\tfjs_binding.pdb (Full PDB)
Copying C:\workspace\my_project\node_modules\@tensorflow\tfjs-node\build\Release\/tfjs_binding.node to C:/workspace/my_project/node_modules/@tensorf
low/tfjs-node/lib/napi-v6\tfjs_binding.node
1 file(s) copied.
Yet, no .dll is created. And same issue as above happens when I try to run:
Error: The specified module could not be found.
\\?\c:\workspace\my_project\node_modules\@tensorflow\tfjs-node\lib\napi-v6\tfjs_binding.node
Per the WINDOWS_TROUBLESHOOTING.md readme, I’ve run
node-gyp configure --verbose
Which does appear to have an issue and thus me creating this issue.
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\\me\\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.1 | win32 | x64
gyp verb command configure []
gyp verb find Python Python is not set from command line or npm configuration
gyp verb find Python checking Python explicitly set from environment variable PYTHON
gyp verb find Python - process.env.PYTHON is "C:\Python27\python.exe"
gyp verb find Python - executing "C:\Python27\python.exe" to get executable path
gyp verb find Python - "C:\Python27\python.exe" is not in PATH or produced an error
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:\Program Files (x86)\Python27\python.exe"
gyp verb find Python - executing "C:\Program Files (x86)\Python27\python.exe" to get version
gyp verb find Python - version is "2.7.0"
gyp info find Python using Python version 2.7.0 found at "C:\Program Files (x86)\Python27\python.exe"
gyp verb get node dir no --target version specified, falling back to host node version: 14.15.1
gyp verb command install [ '14.15.1' ]
gyp verb install input version string "14.15.1"
gyp verb install installing version: 14.15.1
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.1
gyp verb build dir attempting to create "build" dir: C:\workspace\my_project\node_modules\@tensorflow\tfjs-node\build
gyp verb build dir "build" dir needed to be created? C:\workspace\my_project\node_modules\@tensorflow\tfjs-node\build
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 VS2017 (15.9.28307.1300) found at:
gyp verb find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools"
gyp verb find VS - found "Visual Studio C++ core features"
gyp verb find VS - found VC++ toolset: v141
gyp verb find VS - found Windows SDK: 10.0.17763.0
gyp info find VS using VS2017 (15.9.28307.1300) found at:
gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools"
gyp info find VS run with --verbose for detailed information
gyp verb build/config.gypi creating config file
gyp verb build/config.gypi writing out config file: C:\workspace\my_project\node_modules\@tensorflow\tfjs-node\build\config.gypi
gyp verb config.gypi checking for gypi file: C:\workspace\my_project\node_modules\@tensorflow\tfjs-node\config.gypi
gyp verb common.gypi checking for gypi file: C:\workspace\my_project\node_modules\@tensorflow\tfjs-node\common.gypi
gyp verb gyp gyp format was not specified; forcing "msvs"
gyp info spawn C:\Program Files (x86)\Python27\python.exe
gyp info spawn args [
gyp info spawn args 'C:\\Users\\me\\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 '-I',
gyp info spawn args 'C:\\workspace\\my_project\\node_modules\\@tensorflow\\tfjs-node\\build\\config.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\\Users\\me\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args '-I',
gyp info spawn args 'C:\\Users\\me\\AppData\\Local\\node-gyp\\Cache\\14.15.1\\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\\me\\AppData\\Local\\node-gyp\\Cache\\14.15.1',
gyp info spawn args '-Dnode_gyp_dir=C:\\Users\\me\\AppData\\Roaming\\npm\\node_modules\\node-gyp',
gyp info spawn args '-Dnode_lib_file=C:\\\\Users\\\\me\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\14.15.1\\\\<(target_arch)\\\\node.lib',
gyp info spawn args '-Dmodule_root_dir=C:\\workspace\\my_project\\node_modules\\@tensorflow\\tfjs-node',
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:\\workspace\\my_project\\node_modules\\@tensorflow\\tfjs-node\\build',
gyp info spawn args '-Goutput_dir=.'
gyp info spawn args ]
gyp: Undefined variable module_name in binding.gyp 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\me\AppData\Roaming\npm\node_modules\node-gyp\lib\configure.js:351:16)
gyp ERR! stack at ChildProcess.emit (events.js:315:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
gyp ERR! System Windows_NT 10.0.19042
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\me\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--verbose"
gyp ERR! cwd C:\workspace\my_project\node_modules\@tensorflow\tfjs-node
gyp ERR! node -v v14.15.1
gyp ERR! node-gyp -v v7.1.2
gyp ERR! not ok
All of the above have been run from Adminstrative Powershell so I don’t suspect any permissions issues.
In the interest of keeping this “short”. I’ve also downloaded tfjs into its own project and followed all the steps above. which more or less produce the same issue. No .dll is being created (I think is the real issue).
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5
Top GitHub Comments
So it appears that this previous issue #2619 has a potential workaround. the built .dll can be found in the deps/lib. I moved into lib dir and it worked.
In the lib/napi-v4 folder, it should have tfjs_binding.node file and tensorflow.dll file. tensorflow.dll file is moved from deps/lib folder during installation. So it seems like the installation script failed to move it. Can you fork this repo, then go to tfjs-node folder and run npm install or yarn? Then paste the installation script and what is inside lib\napi-v4 folder?
@pyu10055, for what its worth, I’m on win64. And last I checked over the weekend, this is still broke.