tfjs: tfjs-node@4.2.0 install fails on Windows machine
System information
- Windows 11 Pro 21H2
- TensorFlow.js installed from (npm or script link): yarn@3.3.1 / npmjs
- TensorFlow.js version: “@tensorflow/tfjs-node”: “^4.2.0”
- CUDA/cuDNN version: None (CPU version)
When installing tfjs-node ^4.2.0 node-gyp fails to download the prebuilt binaries for napi-v8:
https://storage.googleapis.com/tf-builds/pre-built-binary/napi-v8/4.2.0/CPU-linux-4.2.0.tar.gz exists, but https://storage.googleapis.com/tf-builds/pre-built-binary/napi-v8/4.2.0/CPU-windows-4.2.0.zip doesn’t.
Command: yarn add @tensorflow/tfjs-node
Any other info / logs
# This file contains the result of Yarn building a package (@tensorflow/tfjs-node@npm:4.2.0)
# Script name: install
CPU-windows-4.2.0.zip
* Building TensorFlow Node.js bindings
node-pre-gyp install failed with error: Error: Command failed: node-pre-gyp install --fallback-to-build
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using node-pre-gyp@1.0.9
node-pre-gyp info using node@18.12.1 | win32 | x64
node-pre-gyp info check checked for "F:\Projekte\ebk-ml\node_modules\@tensorflow\tfjs-node\lib\napi-v8\tfjs_binding.node" (not found)
node-pre-gyp http GET https://storage.googleapis.com/tf-builds/pre-built-binary/napi-v8/4.2.0/CPU-windows-4.2.0.zip
node-pre-gyp ERR! install response status 404 Not Found on https://storage.googleapis.com/tf-builds/pre-built-binary/napi-v8/4.2.0/CPU-windows-4.2.0.zip
node-pre-gyp WARN Pre-built binaries not installable for @tensorflow/tfjs-node@4.2.0 and node@18.12.1 (node-v108 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp WARN Hit error response status 404 Not Found on https://storage.googleapis.com/tf-builds/pre-built-binary/napi-v8/4.2.0/CPU-windows-4.2.0.zip
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'node-gyp.cmd clean' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (F:\Projekte\ebk-ml\node_modules\@mapbox\node-pre-gyp\lib\util\compile.js:89:23)
node-pre-gyp ERR! stack at ChildProcess.emit (node:events:513:28)
node-pre-gyp ERR! stack at maybeClose (node:internal/child_process:1091:16)
node-pre-gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:302:5)
node-pre-gyp ERR! System Windows_NT 10.0.22000
node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "F:\\Projekte\\ebk-ml\\node_modules\\@mapbox\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd F:\Projekte\ebk-ml\node_modules\@tensorflow\tfjs-node
node-pre-gyp ERR! node -v v18.12.1
node-pre-gyp ERR! node-pre-gyp -v v1.0.9
node-pre-gyp ERR! not ok
About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 2
- Comments: 15 (4 by maintainers)
Commits related to this issue
- Fix for windows installation #7341 Fix a problem with the installation on windows. My problem on windows was that `./lib/napi-v9` directory didn't exist and `./scripts/deps-stage.js` on line **60** ... — committed to V1c70rB0b741l5w/tfjs by V1c70rB0b741l5w 3 years ago
- Fix for windows installation #7341 (#8122) * Fix for windows installation #7341 Fix a problem with the installation on windows. My problem on windows was that `./lib/napi-v9` directory didn't exi... — committed to tensorflow/tfjs by V1c70rB0b741l5w 3 years ago
I got the same error. I think this is because https://storage.googleapis.com/tf-builds/pre-built-binary/napi-v8/4.2.0/CPU-windows-4.2.0.zip doesn’t exist. I went to https://storage.googleapis.com/tf-builds/ to see what binaries exist and searched for
windows. The latest version I see ispre-built-binary/napi-v8/3.18.0/CPU-windows-3.18.0.zip.The workaround I had to do to get this working is to just use the older version
3.18.0so:Alright @gaikwadrahul8 , that’s great, but I need the support of the latest version of NodeJS, so, is there an other way to solve this problem, please?
My problem on windows was that
./lib/napi-v9directory didn’t exist and./scripts/deps-stage.json line 60 needed the path to symlink or copy the dll.My fix was to make sure that the directory
napi-v9exists with:await fs.mkdir(path.dirname(destLibTensorFlowPath), {recursive: true});I’m solving the copy issue with this patch(Edit: my patch was wrong)
I still have the same error (I think) - using npm install --save-exact @tensorflow/tfjs-node@3.18.0 I have all the required stuff installed and - get this error
`npm ERR! code 1 npm ERR! path C:\Users\tobia\tfjs\node_modules@tensorflow\tfjs-node npm ERR! command failed npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node scripts/install.js npm ERR! CPU-windows-3.18.0.zip npm ERR! https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-windows-x86_64-2.7.0.zip npm ERR! * Downloading libtensorflow npm ERR! npm ERR! * Building TensorFlow Node.js bindings npm ERR! symlink ./lib/napi-v9 failed: Error: Command failed: node scripts/deps-stage.js symlink ./lib/napi-v9 npm ERR! * Symlink of lib\napi-v9\tensorflow.dll failed, creating a copy on disk. npm ERR! node:internal/process/promises:289 npm ERR! triggerUncaughtException(err, true /* fromPromise */); npm ERR! ^ npm ERR! npm ERR! [Error: ENOENT: no such file or directory, copyfile ‘C:\Users\tobia\tfjs\node_modules@tensorflow\tfjs-node\deps\lib\tensorflow.dll’ -> ‘C:\Users\tobia\tfjs\node_modules@tensorflow\tfjs-node\lib\napi-v9\tensorflow.dll’] { npm ERR! errno: -4058, npm ERR! code: ‘ENOENT’, npm ERR! syscall: ‘copyfile’, npm ERR! path: ‘C:\Users\tobia\tfjs\node_modules\@tensorflow\tfjs-node\deps\lib\tensorflow.dll’, npm ERR! dest: ‘C:\Users\tobia\tfjs\node_modules\@tensorflow\tfjs-node\lib\napi-v9\tensorflow.dll’ npm ERR! } npm ERR! npm ERR! Node.js v20.5.0 npm ERR! npm ERR! at ChildProcess.exithandler (node:child_process:421:12) npm ERR! at ChildProcess.emit (node:events:514:28) npm ERR! at maybeClose (node:internal/child_process:1105:16) npm ERR! at ChildProcess._handle.onexit (node:internal/child_process:305:5) { npm ERR! code: 1, npm ERR! killed: false, npm ERR! signal: null, npm ERR! cmd: ‘node scripts/deps-stage.js symlink ./lib/napi-v9’ npm ERR! }
npm ERR! A complete log of this run can be found in: C:\Users\tobia\AppData\Local\npm-cache_logs\2023-09-10T09_33_52_091Z-debug-0.log`
I dont use any antivirus software or other stuff like that
Hi, @TobCraft3521, @georgzoeller , @amacsmith, @Iust1n2
I apologize for the delayed response and I’m able to install
tfjs-nodeon myWindows 10system with these Node.js versionsv19.9.0andv18.16.1with this commandnpm i @tensorflow/tfjs-nodeand it’s installing the latest version oftfjs-nodeand I see currently you’re using Node.js versionsv20.7.0andv20.5.0and gettingsymlink ./lib/napi-v9 failederror message which is known issue to us and our relevant team is working on this issue to fix it as soon as possible.I would request you to please give it try from your end and let us know is it working as expected or not with Node.js versions
v19.9.0andv18.16.1?If you face any issue while installing
tfjs-nodeonWindowssystem please feel free to create new issue with your error log, it would be helpful for us to investigate this issue further from our end and fix it as soon as possible.@enyineer, You also please give it try and let us know, is it working as expected.
Thank you for your understanding and patience.
Actually it is because the napi-v9 folder in libs does not exist and doesn’t have a bindings file
Same, Win11. The directories exist, as do the file
Having the same issue
Would love some additional information on this error.
Hi, @TobCraft3521, @amacsmith , @georgzoeller, @Iust1n2
Apologize for the delayed response and I see you’re using the
Node.js v20.5.0andNode.js v20.7.0versions so could you please give it try by downgrading toNode.js v18.16.1withpython 3.8orpython 3.9and try withnpm install --save-exact @tensorflow/tfjs-node@3.18.0it seems like solving the issue please refer this commentMeanwhile, our developer team will try to solve this issue with latest version of
Node.jsversions and will update you soon. Thank you!Hi, @enyineer
Apologize for the delayed response and I checked this link and
pre-built-binary/napi-v8/4.2.0/CPU-windows-4.2.0.zipfile is not available at the moment forwindowsand if someone is looking to use onWindowsso last supported file is availablepre-built-binary/napi-v8/3.18.0/CPU-windows-3.18.0.zipat the moment and for linuxCPUandGPUboth are available forpre-built-binary/napi-v8/4.2.0/Hi, @pyu10055 Do you have any update about
tfjs-node@4.2.0support forwindowsplease ? Thank you!