pyprotect icon indicating copy to clipboard operation
pyprotect copied to clipboard

libpyprotect.so: undefined symbol: PyThread_tss_get

Open Rishi-Chandr opened this issue 4 years ago • 3 comments

  1. After make, i get the file "libpyprotect.cpython-37m-x86_64-linux-gnu.so", then from the same directory i do "import libpyprotect" i get ModuleNotFound error,
  2. Then I rename it to "libpyprotect.so". Now when in python I do "import libpyprotect" from the same directory where the ".so" file is kept, i get this error: ImportError: /home/Rishi/pyprotect/libpyprotect.so: undefined symbol: PyThread_tss_get

Rishi-Chandr avatar Mar 31 '20 05:03 Rishi-Chandr

@Rishi-Chandr I also encountered this problem, I don’t know if you have solved it, please help

le-wei avatar Sep 15 '20 05:09 le-wei

I just happened to come across this thread doing some research on the same ImportError with a completely different project and I thought I'd offer a guess as to what's happening.

TSS refers to the Python thread specific storage API which was introduced in Python 3.7. Usage of this API is in pybind11. You can see it only uses the API if it detects the Python version is >= 3.7.

So I suspect the issue here is libpyprotect/pybind11 were built with Python >= 3.7 (based on the original file name -37m) but you're trying to import it with some other Python interpreter < 3.7. Automatically finding the Python installation isn't trivial so I could see how the pybind11 build might find one you don't intend to use.

ixjlyons avatar Jan 21 '21 01:01 ixjlyons

@ixjlyons

Thanks, ixjlyons. I think you are right. I had the same error while importing normalSpeed.

It turns out when installing normalSpeed, it weirdly refers to libpython3.7.so even thought my conda env is in python3.6. I couldn't find a way to specify the python version to the CMake. So I just recreated conda env with python3.7 and the problem solved.

hongsukchoi avatar Aug 24 '22 18:08 hongsukchoi