tfjs
tfjs copied to clipboard
error on Raspberry pi for tfjs-node
System information
- OS Platform and Distribution (e.g., Linux Ubuntu 16.04): ubuntu 22.04
- Mobile device : raspberry pi 4b
- TensorFlow.js installed from (npm or script link): npm i @tensorflow/tfjs-node
- TensorFlow.js version: 3.19.0
Describe the problem
- throw error: cannot open shared object file: No such file or directory
- and "npm rebuild @tensorflow/tfjs-node --build-from-source" stuck
Any other info / logs
Thanks for the bug report, @lijianyu1985. I'm not sure what's causing this, and I'm unable to reproduce it on my x86_64 machine. I'll try to reproduce it on a Raspberry pi, but in the meantime, I have some questions and things you can try.
- What version of NodeJS are you using?
- Can you try requiring the
tfjs_binding.node
file directly? To try this, move to the directory containing it, run Node, and then runrequire('./tfjs_binding.node')
. - What is the output of
ldd tfjs_binding.node
? If you don't haveldd
, you can usereadelf -d tfjs_binding.node
instead.
Closing as stale. Please @mention us if this needs more attention.
Thanks for the bug report, @lijianyu1985. I'm not sure what's causing this, and I'm unable to reproduce it on my x86_64 machine. I'll try to reproduce it on a Raspberry pi, but in the meantime, I have some questions and things you can try.
- What version of NodeJS are you using?
- Can you try requiring the
tfjs_binding.node
file directly? To try this, move to the directory containing it, run Node, and then runrequire('./tfjs_binding.node')
.- What is the output of
ldd tfjs_binding.node
? If you don't haveldd
, you can usereadelf -d tfjs_binding.node
instead.
Hi @mattsoulanille , Thanks for your response, I fixed this issue finally, it's a network issue.
Thanks for the bug report, @lijianyu1985. I'm not sure what's causing this, and I'm unable to reproduce it on my x86_64 machine. I'll try to reproduce it on a Raspberry pi, but in the meantime, I have some questions and things you can try.
- What version of NodeJS are you using?
- Can you try requiring the
tfjs_binding.node
file directly? To try this, move to the directory containing it, run Node, and then runrequire('./tfjs_binding.node')
.- What is the output of
ldd tfjs_binding.node
? If you don't haveldd
, you can usereadelf -d tfjs_binding.node
instead.Hi @mattsoulanille , Thanks for your response, I fixed this issue finally, it's a network issue.
@lijianyu1985 What was the issue? I'm stuck with the same error.
Thanks for the bug report, @lijianyu1985. I'm not sure what's causing this, and I'm unable to reproduce it on my x86_64 machine. I'll try to reproduce it on a Raspberry pi, but in the meantime, I have some questions and things you can try.
- What version of NodeJS are you using?
- Can you try requiring the
tfjs_binding.node
file directly? To try this, move to the directory containing it, run Node, and then runrequire('./tfjs_binding.node')
.- What is the output of
ldd tfjs_binding.node
? If you don't haveldd
, you can usereadelf -d tfjs_binding.node
instead.
@mattsoulanille I hope these helps to figure out what's happening:
Context: Docker (node:16-buster-slim) OS: Debian GNU/Linux 10 (buster) Node version: v16.17.0 Package: @tensorflow/tfjs-node Installed packages with apt-get:
apt-get install -y build-essential \
wget \
python3 \
make \
gcc \
libc6-dev \
libcairo2-dev \
libpango1.0-dev \
libjpeg-dev \
libgif-dev \
librsvg2-dev \
node@4eae90eab5d7:/home/site/wwwroot/node_modules/@tensorflow/tfjs-node/lib/napi-v8$ ls -la
total 96
drwxr-xr-x 2 root root 4096 Aug 23 11:13 .
drwxr-xr-x 3 root root 4096 Aug 23 11:13 ..
-rwxr-xr-x 1 root root 87272 Jul 22 22:53 tfjs_binding.node
node@4eae90eab5d7:/home/site/wwwroot/node_modules/@tensorflow/tfjs-node/lib/napi-v8$ node
Welcome to Node.js v16.17.0.
Type ".help" for more information.
> require('./tfjs_binding.node')
Uncaught:
Error: /home/site/wwwroot/node_modules/@tensorflow/tfjs-node/lib/napi-v8/tfjs_binding.node: cannot open shared object file: No such file or directory
at Object.Module._extensions..node (node:internal/modules/cjs/loader:1210:18)
at Module.load (node:internal/modules/cjs/loader:1004:32)
at Function.Module._load (node:internal/modules/cjs/loader:839:12)
at Module.require (node:internal/modules/cjs/loader:1028:19)
at require (node:internal/modules/cjs/helpers:102:18) {
code: 'ERR_DLOPEN_FAILED'
}
node@4eae90eab5d7:/home/site/wwwroot/node_modules/@tensorflow/tfjs-node/lib/napi-v8$ ldd tfjs_binding.node
not a dynamic executable
node@4eae90eab5d7:/home/site/wwwroot/node_modules/@tensorflow/tfjs-node/lib/napi-v8$ readelf -d tfjs_binding.node
Dynamic section at offset 0x10d80 contains 32 entries:
Tag Type Name/Value
0x0000000000000001 (NEEDED) Shared library: [libtensorflow.so.2]
0x0000000000000001 (NEEDED) Shared library: [libtensorflow_framework.so.2]
0x0000000000000001 (NEEDED) Shared library: [libstdc++.so.6]
0x0000000000000001 (NEEDED) Shared library: [libm.so.6]
0x0000000000000001 (NEEDED) Shared library: [libgcc_s.so.1]
0x0000000000000001 (NEEDED) Shared library: [libpthread.so.0]
0x0000000000000001 (NEEDED) Shared library: [libc.so.6]
0x000000000000000e (SONAME) Library soname: [tfjs_binding.node]
0x000000000000001d (RUNPATH) Library runpath: [$ORIGIN/../../deps/lib]
0x000000000000000c (INIT) 0x4000
0x000000000000000d (FINI) 0xe3cc
0x0000000000000019 (INIT_ARRAY) 0x11d20
0x000000000000001b (INIT_ARRAYSZ) 24 (bytes)
0x000000000000001a (FINI_ARRAY) 0x11d38
0x000000000000001c (FINI_ARRAYSZ) 8 (bytes)
0x000000006ffffef5 (GNU_HASH) 0x260
0x0000000000000005 (STRTAB) 0x13e0
0x0000000000000006 (SYMTAB) 0x408
0x000000000000000a (STRSZ) 6531 (bytes)
0x000000000000000b (SYMENT) 24 (bytes)
0x0000000000000003 (PLTGOT) 0x12000
0x0000000000000002 (PLTRELSZ) 3576 (bytes)
0x0000000000000014 (PLTREL) RELA
0x0000000000000017 (JMPREL) 0x3108
0x0000000000000007 (RELA) 0x2f28
0x0000000000000008 (RELASZ) 480 (bytes)
0x0000000000000009 (RELAENT) 24 (bytes)
0x000000006ffffffe (VERNEED) 0x2eb8
0x000000006fffffff (VERNEEDNUM) 3
0x000000006ffffff0 (VERSYM) 0x2d64
0x000000006ffffff9 (RELACOUNT) 8
0x0000000000000000 (NULL) 0x0
Repro steps:
- Docker file
FROM public.ecr.aws/docker/library/node:16-buster-slim
RUN apt-get update && \
apt-get install -y build-essential \
wget \
python3 \
make \
gcc \
libc6-dev \
libcairo2-dev \
libpango1.0-dev \
libjpeg-dev \
libgif-dev \
librsvg2-dev
WORKDIR /home/site/wwwroot
RUN npm install @tensorflow/tfjs-node
CMD [ "echo hello" ]
- Start the container, go to the specific folder, run
node
and try to import thetfjs_binding.node
file:
root@3ac3d6a6a3c3:/home/site/wwwroot# cd /home/site/wwwroot/node_modules/@tensorflow/tfjs-node/lib/napi-v8
root@3ac3d6a6a3c3:/home/site/wwwroot/node_modules/@tensorflow/tfjs-node/lib/napi-v8# node
Welcome to Node.js v16.17.0.
Type ".help" for more information.
> require('./tfjs_binding.node')
Uncaught:
Error: /home/site/wwwroot/node_modules/@tensorflow/tfjs-node/lib/napi-v8/tfjs_binding.node: cannot open shared object file: No such file or directory
at Object.Module._extensions..node (node:internal/modules/cjs/loader:1210:18)
at Module.load (node:internal/modules/cjs/loader:1004:32)
at Function.Module._load (node:internal/modules/cjs/loader:839:12)
at Module.require (node:internal/modules/cjs/loader:1028:19)
at require (node:internal/modules/cjs/helpers:102:18) {
code: 'ERR_DLOPEN_FAILED'
}
Hi @norbertnemeth , In my case the issue is that the tfjs_binding.node file is downloaded from cloud, but the downloaded file is not fit for my platform (raspberry pi), So I rebuild it for my platform then it worked. So, I think you can rebuild that file in your docker
how to rebuild: https://github.com/tensorflow/tfjs/tree/master/tfjs-node#rebuild-the-package-on-raspberry-pi
Thanks @lijianyu1985 , it resolved my issue too.
Ran into the same issue and I confirm that
npm rebuild @tensorflow/tfjs-node --build-from-source
fully resolves it and lets me run on AWS ARM CPUs.
Ran into the same issue and I confirm that
npm rebuild @tensorflow/tfjs-node --build-from-source
fully resolves it and lets me run on AWS ARM CPUs.
THIS^
thank you so much, worked like a charm!