tfjs icon indicating copy to clipboard operation
tfjs copied to clipboard

Error: libtensorflow.so.1: cannot open shared object file: No such file or directory

Open cheneyweb opened this issue 6 years ago • 16 comments

OS

CentOS7.6

TensorFlow.js version

@tensorflow/tfjs-node

1.7.4 AND 2.0.0-rc.4

Describe the problem or feature request

Since I got the message for AVX512 FMA can speed up tf. so I follow the readme doc and build the tensorflow-r2.2 version.

I have got the libtensorflow.tar.gz, and I have already put it on {myproject}/node_modules/@tensorflow/tfjs-node/deps and tar -xf

but when I run my project, I got errors

internal/modules/cjs/loader.js:1226 return process.dlopen(module, path.toNamespacedPath(filename)); ^ Error: libtensorflow.so.1: cannot open shared object file: No such file or directory at Object.Module._extensions..node (internal/modules/cjs/loader.js:1226:18) at Module.load (internal/modules/cjs/loader.js:1040:32) at Function.Module._load (internal/modules/cjs/loader.js:929:14) at Module.require (internal/modules/cjs/loader.js:1080:19) at require (internal/modules/cjs/helpers.js:72:18) at Object. (/usr/local/node/aim/server/node_modules/@tensorflow/tfjs-node/dist/index.js:58:16) at Module._compile (internal/modules/cjs/loader.js:1176:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1196:10) at Module.load (internal/modules/cjs/loader.js:1040:32) at Function.Module._load (internal/modules/cjs/loader.js:929:14)

now the lib in my deps is

lrwxrwxrwx 1 root root 28 1月 1 2000 libtensorflow_framework.so -> libtensorflow_framework.so.2 lrwxrwxrwx 1 root root 32 1月 1 2000 libtensorflow_framework.so.2 -> libtensorflow_framework.so.2.2.0 -r-xr-xr-x 1 root root 35836504 1月 1 2000 libtensorflow_framework.so.2.2.0 lrwxrwxrwx 1 root root 18 1月 1 2000 libtensorflow.so -> libtensorflow.so.2 lrwxrwxrwx 1 root root 22 1月 1 2000 libtensorflow.so.2 -> libtensorflow.so.2.2.0 -r-xr-xr-x 1 root root 233333824 1月 1 2000 libtensorflow.so.2.2.0

cheneyweb avatar May 19 '20 02:05 cheneyweb

Anyone know how solve this problem?

cheneyweb avatar May 22 '20 15:05 cheneyweb

I'm facing the same issue. Context: I'm playing around with bodypix on a linux (gentoo). I tried to use docker nvidia images, but the available TF requires cuda 6.0 and I have 5.0. Out of curiosity I compiled TF on my machine and set it to 5.0 but the resulting libs are always 2.0 (proceeding as recommended in the tfjs readme in order to use custom TF). I'm not able to get --config=v1 to work, so the other option is to have tfjs-node-gpu using libtensorflow 2.0 but it seems that it needs lib 1.0 as I get the error posted above. Besides my playing with bodypix (I don't care too much), I can't understand how to solve this situation :)

cova-fe avatar May 22 '20 20:05 cova-fe

Maybe https://stackoverflow.com/a/57156500/1460422 will help? I'm still experiencing issues however, so I can't say whether this has actually ultimately fixed my issue - as the version of Tensorflow.js that I compiled from source doesn't appear to be CPU accelerated (despite the fact that I enabled that during the compilation process).

sbrl avatar Jun 17 '20 18:06 sbrl

@cheneyweb similar to another issue, you are compiling TF 2.x. tfjs-node should be using TF C version 1.15.0

You might have to hack the line if you are compiling 2.x, and have tfjs-node pointing at the right so file.

pyu10055 avatar Jul 10 '20 23:07 pyu10055

Ah, I see - thanks @pyu10055! The documentation whose whereabouts currently escapes me didn't mention what version to compile, so I assumed the latest version. This should really be better documented than some random variable in the code......

sbrl avatar Jul 17 '20 14:07 sbrl

I've just taken a look @pyu10055, and unfortunately I can't actually build any of the v1.15.x versions Tensorflow. It directs me to https://github.com/bazelbuild/bazel/releases to download v0.26.1 or lower of bazel, but when I download bael 0.26.1 from here, it claims it's actually version 0.19.2, and that I need to upgrade!

$ ./configure
Extracting Bazel installation...
WARNING: --batch mode is deprecated. Please instead explicitly shut down your Bazel server using the command "bazel shutdown".
You have bazel 0.19.2 installed.
Please upgrade your bazel installation to version 0.24.1 or higher to build TensorFlow!

I'm confused.

sbrl avatar Jul 22 '20 16:07 sbrl

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 dyas if no further activity occurs. Thank you.

google-ml-butler[bot] avatar Jul 29 '20 16:07 google-ml-butler[bot]

I have the same problem. My context is running tfjs-node in an electron environment.

OS Ubuntu 18.04

TensorFlow.js version @tensorflow/tfjs-node

1.7.4

Describe the problem or feature request

I successfully build my electron package but when running it, I get the same error as described above.

My deps/lib looks like:

$ ll node_modules/@tensorflow/tfjs-node/deps/lib/
total 244492
drwxr-xr-x 2 daniel daniel      4096 Aug  3 12:45 ./
drwxr-xr-x 4 daniel daniel      4096 Aug  3 12:45 ../
lrwxrwxrwx 1 daniel daniel        28 Aug  3 12:45 libtensorflow_framework.so -> libtensorflow_framework.so.1*
lrwxrwxrwx 1 daniel daniel        33 Aug  3 12:45 libtensorflow_framework.so.1 -> libtensorflow_framework.so.1.15.0*
-r-xr-xr-x 1 daniel daniel  35226832 Dec 31  1999 libtensorflow_framework.so.1.15.0*
lrwxrwxrwx 1 daniel daniel        18 Aug  3 12:45 libtensorflow.so -> libtensorflow.so.1*
lrwxrwxrwx 1 daniel daniel        23 Aug  3 12:45 libtensorflow.so.1 -> libtensorflow.so.1.15.0*
-r-xr-xr-x 1 daniel daniel 215119120 Dec 31  1999 libtensorflow.so.1.15.0*

dhasegan avatar Aug 03 '20 20:08 dhasegan

Same issue as @dhasegan .

Using tfjs-node in Electron application. Developing on Mac OSX. When built with electron-builder for Mac, the application works in Mac OSX.

When using the electron-builder Docker image to build for linux, the application builds fine. But when running it on an Ubuntu 18.04 VM I get the exact same error message.

Tensorflow.js version @tensorflow/tfjs-node 1.7.4

Electron version electron 8.2.5

saxelsen avatar Aug 05 '20 12:08 saxelsen

Well excuse me, @tensorflowbutler. I'm not the one who isn't replying here........

Anyway, to update here - I found that you do indeed need to build libtensorflow 1.15.3, not the latest master. Basically do git checkout v1.15.3, and then build as normal. Make sure you get the right version of bazel though.

I'm on holiday from University work at the moment, but if anyone should have any issues building libtensorflow in the future I'm happy to assist (comment here).

@dhasegan, @saxelsen: That sounds like a separate issue to me. This issue is about Node.js - and you're experiencing issues with electron.

sbrl avatar Aug 08 '20 22:08 sbrl

Thank you all , closing this issue as this been resolved , please @mention if you need more attention.

rthadur avatar Aug 13 '20 19:08 rthadur

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

google-ml-butler[bot] avatar Aug 13 '20 19:08 google-ml-butler[bot]

I am getting the same error with tensorflow version 1.13.0. Any solution? I am trying to use it inside a Docker container based on debian. Installed with npm as a subdependency of Danfo package. How did you resolve it?

alfonso-vidal avatar Feb 14 '22 14:02 alfonso-vidal

I have the same problem. My context is running tfjs-node in an electron environment.

OS Ubuntu 18.04

TensorFlow.js version @tensorflow/tfjs-node

1.7.4

Describe the problem or feature request

I successfully build my electron package but when running it, I get the same error as described above.

My deps/lib looks like:

$ ll node_modules/@tensorflow/tfjs-node/deps/lib/
total 244492
drwxr-xr-x 2 daniel daniel      4096 Aug  3 12:45 ./
drwxr-xr-x 4 daniel daniel      4096 Aug  3 12:45 ../
lrwxrwxrwx 1 daniel daniel        28 Aug  3 12:45 libtensorflow_framework.so -> libtensorflow_framework.so.1*
lrwxrwxrwx 1 daniel daniel        33 Aug  3 12:45 libtensorflow_framework.so.1 -> libtensorflow_framework.so.1.15.0*
-r-xr-xr-x 1 daniel daniel  35226832 Dec 31  1999 libtensorflow_framework.so.1.15.0*
lrwxrwxrwx 1 daniel daniel        18 Aug  3 12:45 libtensorflow.so -> libtensorflow.so.1*
lrwxrwxrwx 1 daniel daniel        23 Aug  3 12:45 libtensorflow.so.1 -> libtensorflow.so.1.15.0*
-r-xr-xr-x 1 daniel daniel 215119120 Dec 31  1999 libtensorflow.so.1.15.0*

@dhasegan @saxelsen I am too facing same issue in electron. Have you found any solution? please share.

Using below version @tensorflow/tfjs-node - ^3.20.0 Electron version - 18.2.0

The application builds fine. But when running it on an Ubuntu 18.04 getting below error

A JavaScript error occurred in the main process
Uncaught Exception:
Error: libtensorflow.so.2: cannot open shared object file: No such file or directory
    at process.func [as dlopen] (node:electron/js2c/asar_bundle:5:1812)
    at Object.Module._extensions..node (node:internal/modules/cjs/loader:1199:18)
    at Object.func [as .node] (node:electron/js2c/asar_bundle:5:2039)
    at Module.load (node:internal/modules/cjs/loader:988:32)
    at Module._load (node:internal/modules/cjs/loader:829:12)
    at Function.c._load (node:electron/js2c/asar_bundle:5:13343)
    at Module.require (node:internal/modules/cjs/loader:1012:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/var/www/html/focusro-electron-app-v2/focusro-app/dist/electron-build/Focusro-linux-x64/resources/app.asar/node_modules/@tensorflow/tfjs-node/dist/index.js:60:16)
    at Module._compile (node:internal/modules/cjs/loader:1116:14)

Thanks in advance

SarathKmrM avatar Sep 05 '22 13:09 SarathKmrM

For me install scripts wouldn't properly install the tensorflow C library for linux; and for some reason install script never throw any error : ( but anyway the problem solved by manually installing it: here -> https://www.tensorflow.org/install/lang_c#setup

Mhmdrza avatar Feb 10 '23 19:02 Mhmdrza

Same issue here! Error: libtensorflow.so.2: cannot open shared object file: No such file or directory at Module._extensions..node (node:internal/modules/cjs/loader:1332:18) at Module.load (node:internal/modules/cjs/loader:1103:32) at Module._load (node:internal/modules/cjs/loader:942:12) at Module.require (node:internal/modules/cjs/loader:1127:19) at require (node:internal/modules/helpers:112:18) at Object.<anonymous> (/home/alireza/Desktop/Node Projects/Faceapi Microservice/node_modules/@tensorflow/tfjs-node/dist/index.js:60:16) at Module._compile (node:internal/modules/cjs/loader:1246:14) at Module._extensions..js (node:internal/modules/cjs/loader:1300:10) at Module.load (node:internal/modules/cjs/loader:1103:32) at Module._load (node:internal/modules/cjs/loader:942:12) { code: 'ERR_DLOPEN_FAILED' } Node.js v19.6.0 Any Solution?

Alireza17224 avatar Feb 17 '23 06:02 Alireza17224