javascriptdata / danfojs

Danfo.js is an open source, JavaScript library providing high performance, intuitive, and easy to use data structures for manipulating and processing structured data.
https://danfo.jsdata.org/
MIT License
4.79k stars 209 forks source link

Error: Fail on fresh ubuntu 20.04 install #21

Closed mkaatman closed 4 years ago

mkaatman commented 4 years ago

This could very well be user error but it would be great if someone could either validate that something has gone terribly wrong or not.

Using proxmox container image: ubuntu-20.04-standard_20.04-1_amd64.tar.gz

Steps:

At this point here are my versions:

Now time for the fireworks.

npm install danfojs-node

> @tensorflow/tfjs-node@2.1.0 install /root/node_modules/@tensorflow/tfjs-node
> node scripts/install.js

CPU-linux-2.1.0.tar.gz
* Downloading libtensorflow
[==============================] 2774145/bps 100% 0.0s
* Building TensorFlow Node.js bindings

> core-js@3.6.5 postinstall /root/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"

Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js on Open Collective or Patreon: 
> https://opencollective.com/core-js 
> https://www.patreon.com/zloirock 

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)

npm WARN saveError ENOENT: no such file or directory, open '/root/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/root/package.json'
npm WARN @tensorflow/tfjs-converter@2.1.0 requires a peer of @tensorflow/tfjs-core@2.1.0 but none is installed. You must install peer dependencies yourself.
npm WARN @tensorflow/tfjs-data@2.1.0 requires a peer of @tensorflow/tfjs-core@2.1.0 but none is installed. You must install peer dependencies yourself.
npm WARN @tensorflow/tfjs-backend-webgl@2.1.0 requires a peer of @tensorflow/tfjs-core@2.1.0 but none is installed. You must install peer dependencies yourself.
npm WARN @tensorflow/tfjs-backend-cpu@2.1.0 requires a peer of @tensorflow/tfjs-core@2.1.0 but none is installed. You must install peer dependencies yourself.
npm WARN @tensorflow/tfjs-layers@2.1.0 requires a peer of @tensorflow/tfjs-core@2.1.0 but none is installed. You must install peer dependencies yourself.
npm WARN root No description
npm WARN root No repository field.
npm WARN root No README data
npm WARN root No license field.

+ danfojs-node@0.1.4
added 128 packages from 121 contributors and audited 128 packages in 83.191s

3 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

npm init -y

index.js:

console.log("before");
const dfd = require("danfojs-node");
console.log("after");
root@tensor3:~# node index.js
before
Platform node has already been set. Overwriting the platform with [object Object].
Platform node has already been set. Overwriting the platform with [object Object].
node-pre-gyp info This Node instance does not support builds for N-API version 6
node-pre-gyp info This Node instance does not support builds for N-API version 6
Illegal instruction

For fun:

npm install @tensorflow/tfjs-converter@2.1.0 @tensorflow/tfjs-core@2.1.0 @tensorflow/tfjs-data@2.1.0 @tensorflow/tfjs-backend-webgl@2.1.0 @tensorflow/tfjs-backend-cpu@2.1.0 @tensorflow/tfjs-layers@2.1.0

Packages installed fine. Same result.

nano node_modules/danfojs-node/dist/index.js

console.log('series danfo'); // This logs
var _series = require("./core/series");
console.log('frame danfo'); // This does not
var _frame = require("./core/frame");

nano node_modules/danfojs-node/dist/core/series.js

console.log('tf'); // This logs
var tf = _interopRequireWildcard(require("@tensorflow/tfjs-node"));
console.log('mathjs'); // This does not

Uh oh, seems to be a tensorflow issue.

I kept going down the rabbit hole and because I don't know how to use a debugger on the node side, it was painful.

nano node_modules/@tensorflow/tfjs-node/dist/index.js

It fails on this line: var bindings = require(bindingPath);

bindingPath is defined as: var bindingPath = binary.find(path.resolve(path.join(__dirname, '/../package.json')));

logging bindingPath: /root/node_modules/@tensorflow/tfjs-node/lib/napi-v5/tfjs_binding.node

Aha!

npm install @tensorflow/tfjs-node

Then I installed nvm and node v14.9.0

npm rebuild @tensorflow/tfjs-node build-addon-from-source

Now my index.js consists only of: import * as tf from '@tensorflow/tfjs-node';

And I'm still getting that ILLEGAL INSTRUCTION. Clearly not a danfo issue, but still hoping someone here can point me in the right direction.

risenW commented 4 years ago

Have you checked the Tensorflowjs issues page. I'm definitely sure this is a TFjs build issue.

mkaatman commented 4 years ago

Yeah I'm still going through their docs. I'm just surprised that it's so difficult to get it setup. Do you know if there's any docker image that already has it setup by chance?

I will go ahead and close this and post an update if I can figure it out.