Skip to content
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

Trying hard to install tfjs-node-gpu on Windows 10 #1589

Closed
theodorDiaconu opened this issue May 17, 2019 · 10 comments
Closed

Trying hard to install tfjs-node-gpu on Windows 10 #1589

theodorDiaconu opened this issue May 17, 2019 · 10 comments
Assignees

Comments

@theodorDiaconu
Copy link

Using python2.7
Installed windows utilities

Stuck here:

ENOENT 'C:\Projects\tsflow\node_modules\@tensorflow\tfjs-node-gpu\build\Release\tensorflow.dll' 
gyp info it worked if it ends with ok
gyp info using node-gyp@3.8.0
gyp info using node@10.15.3 | win32 | x64
gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.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:9872) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, rename 'C:\Projects\tsflow\node_modules\@tensorflow\tfjs-node-gpu\deps\lib\tensorflow.dl
  l' -> 'C:\Projects\tsflow\node_modules\@tensorflow\tfjs-node-gpu\build\Release\tensorflow.dll'
  (node:9872) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rej
  ecting a promise which was not handled with .catch(). (rejection id: 1)
  (node:9872) [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
  fs.js:114
      throw err;
      ^

CUSTOMBUILD : error : ENOENT: no such file or directory, open 'C:\Projects\tsflow\node_modules\@tensorflow\tfjs-node-gpu\build\Release\tensorflow.dll' [C:\Projects\tsflow\node_mo
dules\@tensorflow\tfjs-node-gpu\build\tfjs_binding.vcxproj]
      at Object.openSync (fs.js:438:3)
      at Object.readFileSync (fs.js:343:35)
      at files.map (C:\Projects\tsflow\node_modules\@tensorflow\tfjs-node-gpu\scripts\generate_defs.js:23:40)
      at Array.map (<anonymous>)
      at Object.<anonymous> (C:\Projects\tsflow\node_modules\@tensorflow\tfjs-node-gpu\scripts\generate_defs.js:23:23)
      at Module._compile (internal/modules/cjs/loader.js:701:30)
      at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
      at Module.load (internal/modules/cjs/loader.js:600:32)
      at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
      at Function.Module._load (internal/modules/cjs/loader.js:531:3)
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Users\Pc\AppData\Roaming\npm\node_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:189:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Windows_NT 10.0.17763
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Pc\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "build"
gyp ERR! cwd C:\Projects\tsflow\node_modules\@tensorflow\tfjs-node-gpu
gyp ERR! node -v v10.15.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok```
@nkreeger
Copy link
Contributor

Can you try deleting your node_modules folder and trying again? We also have some troubleshooting tips here:

https://github.com/tensorflow/tfjs-node/blob/master/WINDOWS_TROUBLESHOOTING.md

@theodorDiaconu
Copy link
Author

@nkreeger yes I followed those. I made sure the msvs_version of npm is 2013, I have python 2.7 installed. I ran this also: npm --add-python-to-path='true' --debug install --global windows-build-tools

I'm still getting:

* Building TensorFlow Node.js bindings
C:\Projects\tsflow\node_modules\@tensorflow\tfjs-node\scripts\install.js:165
      throw new Error('node-gyp rebuild failed with: ' + err);
      ^

Error: node-gyp rebuild failed with: Error: Command failed: node-gyp rebuild
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:189:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Windows_NT 10.0.17763
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Projects\tsflow\node_modules\@tensorflow\tfjs-node
gyp ERR! node -v v10.15.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok

    at cp.exec (C:\Projects\tsflow\node_modules\@tensorflow\tfjs-node\scripts\install.js:165:13)
    at ChildProcess.exithandler (child_process.js:301:5)
    at ChildProcess.emit (events.js:189:13)
    at maybeClose (internal/child_process.js:970:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
npm WARN rollup-plugin-visualizer@1.1.1 requires a peer of rollup@>=0.60.0 but none is installed. You must install peer dependencies yourself.
npm WARN tsflow@1.0.0 No description
npm WARN tsflow@1.0.0 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @tensorflow/tfjs-node@1.1.2 install: `node scripts/install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @tensorflow/tfjs-node@1.1.2 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Pc\AppData\Roaming\npm-cache\_logs\2019-05-17T16_47_58_637Z-debug.log

@theodorDiaconu
Copy link
Author

What I did and it worked for tfjs-node:

npm i -S @tensorflow/tfjs-node -f

Let it fail. Go to node_modules folder. And run node-gyp rebuild it worked.

@theodorDiaconu
Copy link
Author

However, my plan is to run training with the GPU, to have 10x speeds. But if I apply the same strategy there here's what I get:

$ 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.15.3 | win32 | x64
gyp info spawn C:\Python27\python.EXE
gyp info spawn args [ 'C:\\Users\\Pc\\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=2015',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Projects\\tsflow\\node_modules\\@tensorflow\\tfjs-node-gpu\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\Pc\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\Pc\\.node-gyp\\10.15.3\\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\\Pc\\.node-gyp\\10.15.3',
gyp info spawn args   '-Dnode_gyp_dir=C:\\Users\\Pc\\AppData\\Roaming\\npm\\node_modules\\node-gyp',
gyp info spawn args   '-Dnode_lib_file=C:\\Users\\Pc\\.node-gyp\\10.15.3\\<(target_arch)\\node.lib',
gyp info spawn args   '-Dmodule_root_dir=C:\\Projects\\tsflow\\node_modules\\@tensorflow\\tfjs-node-gpu',
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:\\Projects\\tsflow\\node_modules\\@tensorflow\\tfjs-node-gpu\\build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.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
  generate_def
CUSTOMBUILD : FATAL error : CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory [C:\Projects\tsflow\node_modules\@tensorflow\tfjs-node-gpu\build\tfjs_binding.vcxproj]
   1: 00007FF6AFE4F04A v8::internal::GCIdleTimeHandler::GCIdleTimeHandler+5114
   2: 00007FF6AFE2A0C6 node::MakeCallback+4518
   3: 00007FF6AFE2AA30 node_module_register+2032
   4: 00007FF6B00B20EE v8::internal::FatalProcessOutOfMemory+846
   5: 00007FF6B00B201F v8::internal::FatalProcessOutOfMemory+639
   6: 00007FF6B05D2BC4 v8::internal::Heap::MaxHeapGrowingFactor+9556
   7: 00007FF6B05D10CB v8::internal::Heap::MaxHeapGrowingFactor+2651
   8: 00007FF6B018CA3B v8::internal::Factory::AllocateRawWithImmortalMap+59
   9: 00007FF6B018F4ED v8::internal::Factory::NewRawTwoByteString+77
  10: 00007FF6B018E67E v8::internal::Factory::NewStringFromUtf8+238
  11: 00007FF6B00CD8FB v8::String::NewFromUtf8+363
  12: 00007FF6AFE184C1 node::Buffer::New+24225
  13: 00007FF6B062C122 v8::internal::OptimizingCompileDispatcher::Unblock+59890
  14: 00007FF6B062D5AD v8::internal::OptimizingCompileDispatcher::Unblock+65149
  15: 00007FF6B062C606 v8::internal::OptimizingCompileDispatcher::Unblock+61142
  16: 00007FF6B062C4EB v8::internal::OptimizingCompileDispatcher::Unblock+60859
  17: 0000021BD9CDC5C1
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Users\Pc\AppData\Roaming\npm\node_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:189:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Windows_NT 10.0.17763
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Pc\\AppData\\Roaming\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Projects\tsflow\node_modules\@tensorflow\tfjs-node-gpu
gyp ERR! node -v v10.15.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok

@adwellj
Copy link

adwellj commented May 17, 2019

@theodorDiaconu, does 0.3.2 install?
I (along with others) struggled with installing tfjs-node-gpu on Windows, but had success with 0.3.2 Trying any of the versions after would result in installation errors.

#1098 (comment)

@theodorDiaconu
Copy link
Author

@adwellj I managed to be able to install that, by doing npm i -S {package}--force, then going manually inside it and running node-gyp configure and node-gyp rebuild.

Still with 1.1.2 node-gyp:
This is the error:

CUSTOMBUILD : FATAL error : CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory [C:\Projects\tsflow2\node_modules\@tensorflow\tfjs-node-gpu\build\tfjs_binding.vcxproj]
   1: 00007FF61F62F04A v8::internal::GCIdleTimeHandler::GCIdleTimeHandler+5114
   2: 00007FF61F60A0C6 node::MakeCallback+4518
   3: 00007FF61F60AA30 node_module_register+2032
   4: 00007FF61F8920EE v8::internal::FatalProcessOutOfMemory+846
   5: 00007FF61F89201F v8::internal::FatalProcessOutOfMemory+639
   6: 00007FF61FDB2BC4 v8::internal::Heap::MaxHeapGrowingFactor+9556
   7: 00007FF61FDB10CB v8::internal::Heap::MaxHeapGrowingFactor+2651
   8: 00007FF61F96CA3B v8::internal::Factory::AllocateRawWithImmortalMap+59
   9: 00007FF61F96F4ED v8::internal::Factory::NewRawTwoByteString+77
  10: 00007FF61F96E67E v8::internal::Factory::NewStringFromUtf8+238
  11: 00007FF61F8AD8FB v8::String::NewFromUtf8+363
  12: 00007FF61F5F84C1 node::Buffer::New+24225
  13: 00007FF61FE0C122 v8::internal::OptimizingCompileDispatcher::Unblock+59890
  14: 00007FF61FE0D5AD v8::internal::OptimizingCompileDispatcher::Unblock+65149
  15: 00007FF61FE0C606 v8::internal::OptimizingCompileDispatcher::Unblock+61142
  16: 00007FF61FE0C4EB v8::internal::OptimizingCompileDispatcher::Unblock+60859
  17: 000003C9C1B5C5C1

@theodorDiaconu
Copy link
Author

I am now happily using 0.3.2. The experience to get it working was absolutely awful. Still I was expecting better improvements node vs node-gpu. For a sample set that I used the difference is 16000ms vs 8000ms. So almost twice. Not bad but was expecting 10x.

@adwellj
Copy link

adwellj commented May 20, 2019

@theodorDiaconu, glad to hear you got it working! Agreed, GPU installation is a very poor experience at this time. Fingers crossed that with enough feedback the team will be able to fix the GPU installations for the new versions.

For future reference, I didn't have to apply any special flags or go back and do any rebuilds. I simply install npm i @tensorflow/tfjs-node-gpu@0.3.2.

Regarding the GPU performance, I'm going from 550 sec/epoch with CPU to 103 sec/epoch with GPU. I would imagine that some models will see a larger benefit with GPU than others. For instance: #468 (comment)

@theodorDiaconu
Copy link
Author

Understood, indeed I had a small model. I'm still learning about this. Very glad that I know when I have to do serious training I can use my GPU.

This ticket should still be open. Building doesn't work on ^0.3.2

@kangyizhang
Copy link
Contributor

With the latest tfjs-node/tfjs-node-gpu package, we are shipping pre-compile addon and there should be no compilation on your machine. This issue should have been fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants