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

tfjs-node Installation Issue #8481

Open
tmeehanpw opened this issue Dec 15, 2024 · 3 comments
Open

tfjs-node Installation Issue #8481

tmeehanpw opened this issue Dec 15, 2024 · 3 comments
Assignees

Comments

@tmeehanpw
Copy link

System information

  • OS Platform and Distribution: macOS Sequoia Version 15.1.1 (24B91)
  • TensorFlow.js installed from (npm or script link): pnpm install @tensorflow/tfjs
  • TensorFlow.js version: 4.22.0

Describe the problem

Unable to install @tensorflow/tfjs-node.

I've tried using different versions of node and have followed some troubleshooting guides. I'm happy to follow up and try whatever suggestions you may have. Please let me know if you need any additional information.

Thank you in advance.

Any other info / logs

❯ pnpm install @tensorflow/tfjs-node

 WARN  9 deprecated subdependencies found: @esbuild-kit/[email protected], @esbuild-kit/[email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Packages: +29
+++++++++++++++++++++++++++++
Progress: resolved 989, reused 807, downloaded 0, added 0, done
node_modules/.pnpm/@[email protected][email protected]/node_modules/@tensorflow/tfjs-node: Running install script, failed in 2s
.../node_modules/@tensorflow/tfjs-node install$ node scripts/install.js
│ CPU-darwin-4.22.0.tar.gz
│ * 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 [email protected]
│ node-pre-gyp info using [email protected] | darwin | x64
│ node-pre-gyp info check checked for "/Users/x/projects/x/node_modules/.pnpm/@[email protected][email protected]/node_modules/@tensorflow/tfjs-node/lib/napi-v8/tf…
│ node-pre-gyp http GET https://storage.googleapis.com/tf-builds/pre-built-binary/napi-v8/4.22.0/CPU-darwin-4.22.0.tar.gz
│ node-pre-gyp ERR! install response status 404 Not Found on https://storage.googleapis.com/tf-builds/pre-built-binary/napi-v8/4.22.0/CPU-darwin-4.22.0.tar.gz 
│ node-pre-gyp WARN Pre-built binaries not installable for @tensorflow/[email protected] and [email protected] (node-v115 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.22.0/CPU-darwin-4.22.0.tar.gz 
│ gyp info it worked if it ends with ok
│ gyp info using [email protected]
│ gyp info using [email protected] | darwin | x64
│ gyp info ok 
│ gyp info it worked if it ends with ok
│ gyp info using [email protected]
│ gyp info using [email protected] | darwin | x64
│ gyp info find Python using Python version 3.10.12 found at "/Users/x/.pyenv/versions/3.10.12/bin/python3"
│ gyp info spawn /Users/x/.pyenv/versions/3.10.12/bin/python3
│ gyp info spawn args [
│ gyp info spawn args '/usr/local/Cellar/pnpm/9.15.0/libexec/lib/node_modules/pnpm/dist/node_modules/node-gyp/gyp/gyp_main.py',
│ gyp info spawn args 'binding.gyp',
│ gyp info spawn args '-f',
│ gyp info spawn args 'make',
│ gyp info spawn args '-I',
│ gyp info spawn args '/Users/x/projects/x/node_modules/.pnpm/@[email protected][email protected]/node_modules/@tensorflow/tfjs-node/build/config.gypi',
│ gyp info spawn args '-I',
│ gyp info spawn args '/usr/local/Cellar/pnpm/9.15.0/libexec/lib/node_modules/pnpm/dist/node_modules/node-gyp/addon.gypi',
│ gyp info spawn args '-I',
│ gyp info spawn args '/Users/x/Library/Caches/node-gyp/20.9.0/include/node/common.gypi',
│ gyp info spawn args '-Dlibrary=shared_library',
│ gyp info spawn args '-Dvisibility=default',
│ gyp info spawn args '-Dnode_root_dir=/Users/x/Library/Caches/node-gyp/20.9.0',
│ gyp info spawn args '-Dnode_gyp_dir=/usr/local/Cellar/pnpm/9.15.0/libexec/lib/node_modules/pnpm/dist/node_modules/node-gyp',
│ gyp info spawn args '-Dnode_lib_file=/Users/x/Library/Caches/node-gyp/20.9.0/<(target_arch)/node.lib',
│ gyp info spawn args '-Dmodule_root_dir=/Users/x/projects/x/node_modules/.pnpm/@[email protected][email protected]/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 'build',
│ gyp info spawn args '-Goutput_dir=.'
│ gyp info spawn args ]
│ gyp info ok 
│ gyp info it worked if it ends with ok
│ gyp info using [email protected]
│ gyp info using [email protected] | darwin | x64
│ gyp info spawn make
│ gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
│ In file included from ../binding/tfjs_backend.cc:18:
│ ../binding/tfjs_backend.h:22:10: fatal error: 'memory' file not found
│    22 | #include <memory>
│       |          ^~~~~~~~
│ 1 error generated.
│ make: *** [Release/obj.target/tfjs_binding/binding/tfjs_backend.o] Error 1
│ gyp ERR! build error 
│ gyp ERR! stack Error: `make` failed with exit code: 2
│ gyp ERR! stack at ChildProcess.<anonymous> (/usr/local/Cellar/pnpm/9.15.0/libexec/lib/node_modules/pnpm/dist/node_modules/node-gyp/lib/build.js:216:23)
│ gyp ERR! System Darwin 24.1.0
│ gyp ERR! command "/Users/x/Library/pnpm/nodejs/20.9.0/bin/node" "/usr/local/Cellar/pnpm/9.15.0/libexec/lib/node_modules/pnpm/dist/node_modules/node-gyp/bin/node-gyp.js" "build" "…
│ gyp ERR! cwd /Users/x/projects/x/node_modules/.pnpm/@[email protected][email protected]/node_modules/@tensorflow/tfjs-node
│ gyp ERR! node -v v20.9.0
│ gyp ERR! node-gyp -v v10.2.0
│ gyp ERR! not ok 
│ node-pre-gyp ERR! build error 
│ node-pre-gyp ERR! stack Error: Failed to execute '/Users/x/Library/pnpm/nodejs/20.9.0/bin/node /usr/local/Cellar/pnpm/9.15.0/libexec/lib/node_modules/pnpm/dist/node_modules/node-…
│ node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/x/projects/x/node_modules/.pnpm/@[email protected]/node_modules/@mapbox/node-pre-gyp/lib/util/compi…
│ node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:514:28)
│ node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1105:16)
│ node-pre-gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:305:5)
│ node-pre-gyp ERR! System Darwin 24.1.0
│ node-pre-gyp ERR! command "/Users/x/Library/pnpm/nodejs/20.9.0/bin/node" "/Users/x/projects/x/node_modules/.pnpm/@[email protected]/node_modules/@mapbox/node-…
│ node-pre-gyp ERR! cwd /Users/x/projects/x/node_modules/.pnpm/@[email protected][email protected]/node_modules/@tensorflow/tfjs-node
│ node-pre-gyp ERR! node -v v20.9.0
│ node-pre-gyp ERR! node-pre-gyp -v v1.0.9
│ node-pre-gyp ERR! not ok 
└─ Failed in 2s at /Users/x/projects/x/node_modules/.pnpm/@[email protected][email protected]/node_modules/@tensorflow/tfjs-node
 ELIFECYCLE  Command failed with exit code 1.
@shmishra99
Copy link
Contributor

Hi @tmeehanpw ,

I could see from the error logs that the command node-pre-gyp install --fallback-to-build is failing. This indicates that the node-pre-gyp command itself not working. You can upgrade your node-pre-gyp dependency by running npm i -g node-pre-gyp. Let me know if this resolves the issue.

Thank You!!

@MRmeehan
Copy link

Thanks for the response.

❯ pnpm i -g node-pre-gyp
 WARN  deprecated [email protected]: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future
 WARN  19 deprecated subdependencies found: @npmcli/[email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Already up to date
Progress: resolved 1078, reused 976, downloaded 0, added 0, done
Done in 3.8s
❯ pnpm i -g @mapbox/node-pre-gyp
 WARN  deprecated [email protected]: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future
 WARN  19 deprecated subdependencies found: @npmcli/[email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Already up to date
Progress: resolved 1078, reused 976, downloaded 0, added 0, done
 WARN  @mapbox/node-pre-gyp has no binaries
Done in 3.7s
❯ pnpm install @tensorflow/tfjs-node
 WARN  9 deprecated subdependencies found: @esbuild-kit/[email protected], @esbuild-kit/[email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Packages: +29
+++++++++++++++++++++++++++++
Progress: resolved 1011, reused 805, downloaded 0, added 0, done
node_modules/.pnpm/@[email protected][email protected]/node_modules/@tensorflow/tfjs-node: Running install script, failed in 2.7s
.../node_modules/@tensorflow/tfjs-node install$ node scripts/install.js
│ CPU-darwin-4.22.0.tar.gz
│ * 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 [email protected]
│ node-pre-gyp info using [email protected] | darwin | x64
│ (node:7427) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
│ (Use `node --trace-deprecation ...` to show where the warning was created)
│ node-pre-gyp info check checked for "/Users/x/projects/x/node_modules/.pnpm/@[email protected][email protected]/node_modules/@tensorflow/tfjs-node/lib/napi-v8/tfjs_binding.node" (n…
│ node-pre-gyp http GET https://storage.googleapis.com/tf-builds/pre-built-binary/napi-v8/4.22.0/CPU-darwin-4.22.0.tar.gz
│ node-pre-gyp ERR! install response status 404 Not Found on https://storage.googleapis.com/tf-builds/pre-built-binary/napi-v8/4.22.0/CPU-darwin-4.22.0.tar.gz 
│ node-pre-gyp WARN Pre-built binaries not installable for @tensorflow/[email protected] and [email protected] (node-v127 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.22.0/CPU-darwin-4.22.0.tar.gz 
│ gyp info it worked if it ends with ok
│ gyp info using [email protected]
│ gyp info using [email protected] | darwin | x64
│ gyp info ok 
│ gyp info it worked if it ends with ok
│ gyp info using [email protected]
│ gyp info using [email protected] | darwin | x64
│ gyp info find Python using Python version 3.10.12 found at "/Users/x/.pyenv/versions/3.10.12/bin/python3"
│ gyp info spawn /Users/x/.pyenv/versions/3.10.12/bin/python3
│ gyp info spawn args [
│ gyp info spawn args '/Users/x/Library/pnpm/global/5/.pnpm/[email protected]/node_modules/pnpm/dist/node_modules/node-gyp/gyp/gyp_main.py',
│ gyp info spawn args 'binding.gyp',
│ gyp info spawn args '-f',
│ gyp info spawn args 'make',
│ gyp info spawn args '-I',
│ gyp info spawn args '/Users/x/projects/x/node_modules/.pnpm/@[email protected][email protected]/node_modules/@tensorflow/tfjs-node/build/config.gypi',
│ gyp info spawn args '-I',
│ gyp info spawn args '/Users/x/Library/pnpm/global/5/.pnpm/[email protected]/node_modules/pnpm/dist/node_modules/node-gyp/addon.gypi',
│ gyp info spawn args '-I',
│ gyp info spawn args '/Users/x/Library/Caches/node-gyp/22.11.0/include/node/common.gypi',
│ gyp info spawn args '-Dlibrary=shared_library',
│ gyp info spawn args '-Dvisibility=default',
│ gyp info spawn args '-Dnode_root_dir=/Users/x/Library/Caches/node-gyp/22.11.0',
│ gyp info spawn args '-Dnode_gyp_dir=/Users/x/Library/pnpm/global/5/.pnpm/[email protected]/node_modules/pnpm/dist/node_modules/node-gyp',
│ gyp info spawn args '-Dnode_lib_file=/Users/x/Library/Caches/node-gyp/22.11.0/<(target_arch)/node.lib',
│ gyp info spawn args '-Dmodule_root_dir=/Users/x/projects/x/node_modules/.pnpm/@[email protected][email protected]/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 'build',
│ gyp info spawn args '-Goutput_dir=.'
│ gyp info spawn args ]
│ gyp info ok 
│ gyp info it worked if it ends with ok
│ gyp info using [email protected]
│ gyp info using [email protected] | darwin | x64
│ gyp info spawn make
│ gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
│ In file included from ../binding/tfjs_backend.cc:18:
│ ../binding/tfjs_backend.h:22:10: fatal error: 'memory' file not found
│    22 | #include <memory>
│       |          ^~~~~~~~
│ 1 error generated.
│ make: *** [Release/obj.target/tfjs_binding/binding/tfjs_backend.o] Error 1
│ gyp ERR! build error 
│ gyp ERR! stack Error: `make` failed with exit code: 2
│ gyp ERR! stack at ChildProcess.<anonymous> (/Users/x/Library/pnpm/global/5/.pnpm/[email protected]/node_modules/pnpm/dist/node_modules/node-gyp/lib/build.js:216:23)
│ gyp ERR! System Darwin 24.1.0
│ gyp ERR! command "/Users/x/.nvm/versions/node/v22.11.0/bin/node" "/Users/x/Library/pnpm/global/5/.pnpm/[email protected]/node_modules/pnpm/dist/node_modules/node-gyp/bin/node-gyp.js" "build" "--fall…
│ gyp ERR! cwd /Users/x/projects/x/node_modules/.pnpm/@[email protected][email protected]/node_modules/@tensorflow/tfjs-node
│ gyp ERR! node -v v22.11.0
│ gyp ERR! node-gyp -v v10.2.0
│ gyp ERR! not ok 
│ node-pre-gyp ERR! build error 
│ node-pre-gyp ERR! stack Error: Failed to execute '/Users/x/.nvm/versions/node/v22.11.0/bin/node /Users/x/Library/pnpm/global/5/.pnpm/[email protected]/node_modules/pnpm/dist/node_modules/node-gyp/bi…
│ node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/x/projects/x/node_modules/.pnpm/@[email protected]/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
│ node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:518:28)
│ node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1104:16)
│ node-pre-gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:304:5)
│ node-pre-gyp ERR! System Darwin 24.1.0
│ node-pre-gyp ERR! command "/Users/x/.nvm/versions/node/v22.11.0/bin/node" "/Users/x/projects/x/node_modules/.pnpm/@[email protected]/node_modules/@mapbox/node-pre-gyp/bin/node-p…
│ node-pre-gyp ERR! cwd /Users/x/projects/x/node_modules/.pnpm/@[email protected][email protected]/node_modules/@tensorflow/tfjs-node
│ node-pre-gyp ERR! node -v v22.11.0
│ node-pre-gyp ERR! node-pre-gyp -v v1.0.9
│ node-pre-gyp ERR! not ok 
└─ Failed in 2.7s at /Users/x/projects/x/node_modules/.pnpm/@[email protected][email protected]/node_modules/@tensorflow/tfjs-node
 ELIFECYCLE  Command failed with exit code 1.

I saw WARN  deprecated [email protected]: Please upgrade to @mapbox/node-pre-gyp and then tried to install that as a follow up. Still a bit stuck.

@MRmeehan
Copy link

I'll note that I was able to install with wsl2 on windows but I'd love to get this working on my mac.

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

3 participants