tensorflow / tfjs

A WebGL accelerated JavaScript library for training and deploying ML models.
https://js.tensorflow.org
Apache License 2.0
18.45k stars 1.92k forks source link

[Compatibility and installation] Installing @tensorflow/tfjs-node results in unexpected compiling errors #8142

Closed NickWong77 closed 9 months ago

NickWong77 commented 9 months ago

System information

Describe the current behavior After installing @tensorflow/tfjs-node , a lot of modules are reporting errors like below

_BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:

Describe the expected behavior Installing @tensorflow/tfjs-node should not results in so many errors from other npm modules

Standalone code to reproduce the issue Provide a reproducible test case that is the bare minimum necessary to generate the problem. If possible, please share a link to Colab/CodePen/any notebook.

Use following dependencies in package.json "dependencies": { "@angular/common": "^14.3.0", "@angular/core": "^14.3.0", "@angular/forms": "^14.3.0", "@angular/platform-browser": "^14.3.0", "@angular/platform-browser-dynamic": "^14.3.0", "@angular/router": "^14.3.0", "@capacitor/android": "^5.5.1", "@capacitor/app": "5.0.6", "@capacitor/core": "5.5.1", "@capacitor/haptics": "5.0.6", "@capacitor/ios": "^5.5.1", "@capacitor/keyboard": "5.0.6", "@capacitor/status-bar": "5.0.6", "@eclipse-ditto/ditto-javascript-client-dom": "^3.4.0", "@google/generative-ai": "^0.1.3", "@influxdata/influxdb-client": "^1.33.2", "@ionic-native/core": "^5.0.0", "@ionic-native/splash-screen": "^5.0.0", "@ionic-native/status-bar": "^5.0.0", "@ionic/angular": "^7.5.1", "@ionic/core": "^7.5.1", "@ionic/storage": "^4.0.0", "@tensorflow/tfjs": "^4.15.0", "@tensorflow/tfjs-node": "3.19.0", "@types/long": "^5.0.0", "@types/ws": "8.5.4", "core-js": "^3.6.4", "echarts": "^5.4.3", "highcharts": "^11.2.0", "ml-regression-simple-linear": "^3.0.0", "ngx-mqtt": "^16.1.0", "path-browserify": "^1.0.1", "rxjs": "~6.5.4", "typescript": "4.8.4", "url": "^0.11.3", "zone.js": "~0.10.2" }, "devDependencies": { "@angular-devkit/architect": "^0.1402.13", "@angular-devkit/build-angular": "^14.2.13", "@angular-devkit/core": "^14.2.13", "@angular-devkit/schematics": "^14.2.13", "@angular/cli": "^14.2.13", "@angular/compiler": "^14.3.0", "@angular/compiler-cli": "^14.3.0", "@angular/language-service": "^14.3.0", "@capacitor/cli": "5.5.1", "@google/generative-ai": "^0.1.3", "@ionic/angular-toolkit": "^7.0.0", "@types/highcharts": "^7.0.0", "@types/jasmine": "~3.5.7", "@types/jasminewd2": "~2.0.3", "@types/node": "~13.7.7", "codelyzer": "~5.2.1", "jasmine-core": "~3.5.0", "jasmine-spec-reporter": "~4.2.1", "karma": "~4.4.1", "karma-chrome-launcher": "~3.1.0", "karma-coverage-istanbul-reporter": "~2.1.1", "karma-jasmine": "~3.1.1", "karma-jasmine-html-reporter": "^1.5.2", "protractor": "~5.4.0", "ts-node": "~8.6.2", "tslint": "~6.0.0", "webpack-cli": "^5.1.4" },

Other info / logs Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached. Please see the attached compiling error logs log.md

gaikwadrahul8 commented 9 months ago

Hi, @NickWong77

Thank you for brining this issue to our attention and I see currently you're using Node.js version v18.13.0 so I would suggest you to please go with either Node.js version v18.16.1 or v19.9.0 with Python version 3.8, 3.9, 3.10 or 3.11 ( any one of the Python version ) and it should work, Make sure that you're following all the instructions mentioned in my comment

I would request you to please give it try with above temporary workaround and see is it resolving your issue or not ? if issue still persists please let us know with error log to investigate your issue further after running this command node-gyp configure

Thank you for your cooperation and patience.

gaikwadrahul8 commented 9 months ago

Hi, @NickWong77

I'm following up on our previous conversation about installing tfjs-node on your Windows system. I'm curious if you had the opportunity to try the workaround I suggested earlier.

If you've attempted the workaround, please let me know if you were able to successfully install tfjs-node. If it resolved the issue, feel free to close this issue.

If you need any further assistance with Tensorflow.js , please don't hesitate to create a new issue. We're always happy to help.

Thank you for your cooperation and patience.

github-actions[bot] commented 9 months ago

This issue has been marked stale because it has no recent activity since 7 days. It will be closed if no further activity occurs. Thank you.

gaikwadrahul8 commented 9 months ago

Hi, @NickWong77

We haven't got confirmation from your end so now I'm closing this issue and tfjs-node installation on Windows 10 system should work with Node.js v19.9.0 and v18.16.1 with Python version 3.8, 3.9, 3.10 and 3.11 (At the moment it does not support Python 3.12 version) and latest Node.js versions v20 0r later it's not working as expected but that is known issue to us and our relavant team is working on that issue so please refer this issue for future update https://github.com/tensorflow/tfjs/issues/7341

Please refer this comment and I already tested from my end please refer my comment

If you face any issue while installing tfjs-nodewith either Node.js v19.9.0 or v18.16.1, please feel free to post your comment with new error log and will re-open this issue.

Thank you for your understanding and patience.

google-ml-butler[bot] commented 9 months ago

Are you satisfied with the resolution of your issue? Yes No