vladmandic / tfjs

Custom build of Tensorflow/JS for Browsers as pure ESNext
https://vladmandic.github.io/tfjs
MIT License
5 stars 3 forks source link

dependencies issues #3

Closed davie-robertson closed 2 years ago

davie-robertson commented 2 years ago

Thanks for this great little fork of TSJS; I've been having lots of issues getting the original to work in a web-dev-server buildless environment using lit and the open-wc scaffolding so I thought I would give your build a try.

There seems to be some problems around the dependencies that npm i --force isn't able to resolve either

 npm i
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: @vladmandic/tfjs@3.11.0-20211118
npm ERR! Found: @tensorflow/tfjs-core@3.11.0
npm ERR! node_modules/@tensorflow/tfjs-core
npm ERR!   dev @tensorflow/tfjs-core@"^3.11.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @tensorflow/tfjs-core@"3.9.0" from @tensorflow/tfjs-backend-webgpu@0.0.1-alpha.8
npm ERR! node_modules/@tensorflow/tfjs-backend-webgpu
npm ERR!   dev @tensorflow/tfjs-backend-webgpu@"^0.0.1-alpha.8" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
davie-robertson commented 2 years ago

I believe there's also a dependency to have python installed as npm i --legacy-peer-deps seems to do the install without any errors, but the build fails with:

ERROR: /home/user/development/tfjs/src/tfjs-backend-wasm/src/cc/BUILD:78:15: Action tfjs-backend-wasm/src/cc/tfjs-backend-wasm/tfjs-backend-wasm.js failed: (Exit 127): wasm_binary failed: error executing command bazel-out/k8-opt-exec-2B5CBBC6/bin/external/emsdk/emscripten_toolchain/wasm_binary '--output_path=bazel-out/k8-opt/bin/tfjs-backend-wasm/src/cc/tfjs-backend-wasm' ... (remaining 1 argument(s) skipped)
/usr/bin/env: 'python': No such file or directory
Target //tfjs-backend-wasm/src/cc:tfjs-backend-wasm failed to build
Use --verbose_failures to see the command lines of failed build steps.
davie-robertson commented 2 years ago

running Ubuntu in WSL2/3 (win11) sudo apt-get install python-is-python3 fixed it (although Python was already installed) - I was able to build without any errors

vladmandic commented 2 years ago

glad you figured it out - i'll add a note regarding python in README

btw, none of those @tensorflow/* dependencies are needed for anything except re-export of typedefs
(see https://github.com/vladmandic/tfjs/blob/main/types/index.d.ts)

i have a process that builds typedefs from sources, but since tfjs uses typescript 3.x,
it results in couple of namespaces with errors

as soon as i fix that (easy with manual edits of resulting .d.ts, but i need to make it work automatically),
all of the @tensorflow dependencies will be gone!