Installing tensorflow error on windows

Hi! I'm new with node-red and I wanted to install tensor flow, using this in cmd:

C:\Users\mahya>npm install @tensorflow/tfjs-node

But I keep getting this error. I even uninstalled Node.js and ticked the box to install necessary tools. But nothing has changed. Please help. Thanks.
The error messages:

C:\Users\mahya>npm install @tensorflow/tfjs-node
npm ERR! code 1
npm ERR! path C:\Users\mahya\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-4.10.0.zip
npm ERR! * Downloading libtensorflow
npm ERR! C:\Users\mahya\node_modules\@tensorflow\tfjs-node\scripts\install.js:110
npm ERR!     throw new Error(`Unsupported system: ${libType}-${platform}-${os.arch()}`);
npm ERR!           ^
npm ERR!
npm ERR! Error: Unsupported system: cpu-win32-ia32
npm ERR!     at getPlatformLibtensorflowUri (C:\Users\mahya\node_modules\@tensorflow\tfjs-node\scripts\install.js:110:11)
npm ERR!     at downloadLibtensorflow (C:\Users\mahya\node_modules\@tensorflow\tfjs-node\scripts\install.js:143:15)
npm ERR!     at async run (C:\Users\mahya\node_modules\@tensorflow\tfjs-node\scripts\install.js:212:5)
npm ERR!
npm ERR! Node.js v18.17.1

npm ERR! A complete log of this run can be found in: C:\Users\mahya\AppData\Local\npm-cache\_logs\2023-08-27T19_40_16_234Z-debug-0.log

C:\Users\mahya>npm install node-red-contrib-tf-model
npm ERR! code 1
npm ERR! path C:\Users\mahya\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-4.10.0.zip
npm ERR! * Downloading libtensorflow
npm ERR! C:\Users\mahya\node_modules\@tensorflow\tfjs-node\scripts\install.js:110
npm ERR!     throw new Error(`Unsupported system: ${libType}-${platform}-${os.arch()}`);
npm ERR!           ^
npm ERR!
npm ERR! Error: Unsupported system: cpu-win32-ia32
npm ERR!     at getPlatformLibtensorflowUri (C:\Users\mahya\node_modules\@tensorflow\tfjs-node\scripts\install.js:110:11)
npm ERR!     at downloadLibtensorflow (C:\Users\mahya\node_modules\@tensorflow\tfjs-node\scripts\install.js:143:15)
npm ERR!     at async run (C:\Users\mahya\node_modules\@tensorflow\tfjs-node\scripts\install.js:212:5)
npm ERR!
npm ERR! Node.js v18.17.1

npm ERR! A complete log of this run can be found in: C:\Users\mahya\AppData\Local\npm-cache\_logs\2023-08-27T19_40_23_935Z-debug-0.log

You should be installing it from the node-red userDir, which is probably c:/Users/mahya/.node-red, but I do not think that is the cause of the error.

npm ERR! Error: Unsupported system: cpu-win32-ia32

See Error: Unsupported system: cpu-win32-ia32 · Issue #2772 · tensorflow/tfjs · GitHub
I assume you are running a 32 bit version of Windows.

No I just checked in the setting, I have and my device has 64-bit operating system, x64-based processor.

Which version of windows and which version of nodejs are you using. For nodejs use node -v to find out.

I use windows 10 Home version 22H2. I just downloaded another version of node js for x64. and it is: v20.5.1
I tried to run this code and yet I got this error message:


C:\Windows\system32>npm install node-red-contrib-tensorflow
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated request-promise@4.2.6: request-promise has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN cleanup Failed to remove some directories [
npm WARN cleanup   [
npm WARN cleanup     'C:\\Windows\\system32\\node_modules\\@tensorflow\\tfjs',
npm WARN cleanup     [Error: EPERM: operation not permitted, rmdir 'C:\Windows\system32\node_modules\@tensorflow\tfjs\node_modules\@tensorflow\tfjs-converter'] {
npm WARN cleanup       errno: -4048,
npm WARN cleanup       code: 'EPERM',
npm WARN cleanup       syscall: 'rmdir',
npm WARN cleanup       path: 'C:\\Windows\\system32\\node_modules\\@tensorflow\\tfjs\\node_modules\\@tensorflow\\tfjs-converter'
npm WARN cleanup     }
npm WARN cleanup   ]
npm WARN cleanup ]
npm ERR! code 1
npm ERR! path C:\Windows\system32\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-4.1.0.zip
npm ERR! https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-windows-x86_64-2.9.1.zip
npm ERR! * Downloading libtensorflow
npm ERR!
npm ERR! C:\Windows\system32\node_modules\adm-zip\zipFile.js:101
npm ERR!         if (!~endOffset) throw new Error(Utils.Errors.INVALID_FORMAT);
npm ERR!                                ^
npm ERR!
npm ERR! Error: Invalid or unsupported zip format. No END header found
npm ERR!     at readMainHeader (C:\Windows\system32\node_modules\adm-zip\zipFile.js:101:32)
npm ERR!     at new module.exports (C:\Windows\system32\node_modules\adm-zip\zipFile.js:19:9)
npm ERR!     at new module.exports (C:\Windows\system32\node_modules\adm-zip\adm-zip.js:62:18)
npm ERR!     at WriteStream.<anonymous> (C:\Windows\system32\node_modules\@tensorflow\tfjs-node\scripts\resources.js:72:29)
npm ERR!     at WriteStream.emit (node:events:514:28)
npm ERR!     at emitCloseNT (node:internal/streams/destroy:132:10)
npm ERR!     at process.processTicksAndRejections (node:internal/process/task_queues:81:21)
npm ERR!
npm ERR! Node.js v20.5.1

npm ERR! A complete log of this run can be found in: C:\Users\mahya\AppData\Local\npm-cache\_logs\2023-08-28T10_12_35_612Z-debug-0.log

You are still in the wrong folder, now you are trying to install it to system32, so you get the permissions error. You should be in your .node-red folder as I pointed out earlier.

ok but this still doesn't work :frowning:

C:\Users\mahya\.node-red>npm install @tensorflow/tfjs-node
npm ERR! code 1
npm ERR! path C:\Users\mahya\.node-red\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-4.10.0.zip
npm ERR! https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-windows-x86_64-2.9.1.zip
npm ERR! * Downloading libtensorflow
npm ERR!
npm ERR! C:\Users\mahya\.node-red\node_modules\adm-zip\zipFile.js:101
npm ERR!         if (!~endOffset) throw new Error(Utils.Errors.INVALID_FORMAT);
npm ERR!                                ^
npm ERR!
npm ERR! Error: Invalid or unsupported zip format. No END header found
npm ERR!     at readMainHeader (C:\Users\mahya\.node-red\node_modules\adm-zip\zipFile.js:101:32)
npm ERR!     at new module.exports (C:\Users\mahya\.node-red\node_modules\adm-zip\zipFile.js:19:9)
npm ERR!     at new module.exports (C:\Users\mahya\.node-red\node_modules\adm-zip\adm-zip.js:62:18)
npm ERR!     at WriteStream.<anonymous> (C:\Users\mahya\.node-red\node_modules\@tensorflow\tfjs-node\scripts\resources.js:72:29)
npm ERR!     at WriteStream.emit (node:events:514:28)
npm ERR!     at emitCloseNT (node:internal/streams/destroy:132:10)
npm ERR!     at process.processTicksAndRejections (node:internal/process/task_queues:81:21)
npm ERR!
npm ERR! Node.js v20.5.1

npm ERR! A complete log of this run can be found in: C:\Users\mahya\AppData\Local\npm-cache\_logs\2023-08-28T10_34_05_589Z-debug-0.log

Also note that nodejs 20 is not officially supported by node-red yet, so you would be better to stick to 18. Tensorflow probably hasn't been tested against 20 either.

Though I would not expect the zip format error to be caused by the nodejs version. If you run the install again do you get the same error?

you mean installing node-red again or Node.js?
I uninstalled nodejs.20 and installed 18 again.
but these errors are still here:

C:\Users\mahya\.node-red>npm install @tensorflow/tfjs-node
npm ERR! code 1
npm ERR! path C:\Users\mahya\.node-red\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-4.10.0.zip
npm ERR! https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-windows-x86_64-2.9.1.zip
npm ERR! * Downloading libtensorflow
npm ERR!
npm ERR! C:\Users\mahya\.node-red\node_modules\adm-zip\zipFile.js:101
npm ERR!         if (!~endOffset) throw new Error(Utils.Errors.INVALID_FORMAT);
npm ERR!                                ^
npm ERR!
npm ERR! Error: Invalid or unsupported zip format. No END header found
npm ERR!     at readMainHeader (C:\Users\mahya\.node-red\node_modules\adm-zip\zipFile.js:101:32)
npm ERR!     at new module.exports (C:\Users\mahya\.node-red\node_modules\adm-zip\zipFile.js:19:9)
npm ERR!     at new module.exports (C:\Users\mahya\.node-red\node_modules\adm-zip\adm-zip.js:62:18)
npm ERR!     at WriteStream.<anonymous> (C:\Users\mahya\.node-red\node_modules\@tensorflow\tfjs-node\scripts\resources.js:72:29)
npm ERR!     at WriteStream.emit (node:events:514:28)
npm ERR!     at emitCloseNT (node:internal/streams/destroy:132:10)
npm ERR!     at process.processTicksAndRejections (node:internal/process/task_queues:81:21)
npm ERR!
npm ERR! Node.js v18.17.1

npm ERR! A complete log of this run can be found in: C:\Users\mahya\AppData\Local\npm-cache\_logs\2023-08-28T10_46_31_638Z-debug-0.log

C:\Users\mahya\.node-red>
























I meant if you installer tensorflow again.

I suggest you submit an issue on the node's github page. Hopefully the author will be able to help.

Ok thank you.