tch-rs icon indicating copy to clipboard operation
tch-rs copied to clipboard

clion and pycharm debuggers can't find libtorch_cpu.so

Open drewm1980 opened this issue 4 years ago • 2 comments
trafficstars

I would like to be able to debug a crate using tch-rs in pycharm or clion, but I'm hitting:

"error while loading shared libraries: libtorch_cpu.so"

More details at: https://youtrack.jetbrains.com/issue/CPP-26265

I'm not sure if this is purely an IDE issue, or if tch-rs's doing something ~really non-standard in its build, but as the crate author you might have some insight.

The build binary ~does run fine with "cargo run".

Thanks!

drewm1980 avatar Aug 20 '21 11:08 drewm1980

Sorry I wouldn't really know on this as I'm not using clion, the libraries are found via some rpath set up, maybe just setting your LD_LIBRARY_PATH (if on linux) to include the directory that contains libtorch_cpu.so would help.

LaurentMazare avatar Aug 23 '21 12:08 LaurentMazare

I ran into the same issue with CLion, but was able to fix it by adding LIBTORCH and LD_LIBRARY_PATH as environment variables in my run/debug configurations. See the following image.

Screenshot from 2022-04-19 10-18-54

ac-freeman avatar Apr 19 '22 14:04 ac-freeman

Closing this as it has been a while, feel free to re-open if there are still some issues.

LaurentMazare avatar May 14 '23 11:05 LaurentMazare