anandanand84 / technicalindicators

A javascript technical indicators written in typescript with pattern recognition right in the browser
MIT License
2.18k stars 563 forks source link

anandanand84/technicalindicators in docker raised an error with tfjs-node #160

Closed AranDekar closed 4 years ago

AranDekar commented 5 years ago

I am running a docker container for my project which uses the technicalindicators module, internally the module uses @tensorflow/tfjs-node, if you refer to their website (tfjs-node:https://github.com/tensorflow/tfjs-node) it is stated as below:

Before executing any TensorFlow.js code, import the node package:

// Load the binding
import * as tf from '@tensorflow/tfjs-node';

// Or if running with GPU:
import * as tf from '@tensorflow/tfjs-node-gpu';
Note: you do not need to add the @tensorflow/tfjs package to your dependencies or import it directly.

I see that the tfjs-node is included in the package.json of technicalindicators module, but suppose you want to run it in a docker where runs on unix, linux, you need the '@tensorflow/tfjs-node-gpu'; version I guess. and I think the error I get from my container is because of that, can you please confirm this? The error:

Error: Error loading shared library /usr/src/app/node_modules/technicalindicators/node_modules/@tensorflow/tfjs-node/build/Release/tfjs_binding.node: Exec format error

the docker file:

FROM node:10.15.0-alpine
WORKDIR /usr/src/app
COPY package*.json  yarn.lock ./
RUN apk add --no-cache --virtual .gyp \
  python \
  make \
  g++ \
  && yarn install \
  && apk del .gyp
COPY . .
EXPOSE 8080
CMD [ "yarn", "start" ]

and also I get this warning from container which is relevant too:

Hi there 👋. Looks like you are running TensorFlow.js in Node.js. To speed things up dramatically, install our node backend, which binds to TensorFlow C++, by running npm i @tensorflow/tfjs-node, or npm i @tensorflow/tfjs-node-gpu if you have CUDA. Then call require('@tensorflow/tfjs-node'); (-gpu suffix for CUDA) at the start of your program. Visit https://github.com/tensorflow/tfjs-node for more details.

anandanand84 commented 4 years ago

Tensorflow removed in version 3.0. It should work now