ga0/pyprotect

libpyprotect.so: undefined symbol: PyThread_tss_get

Rishi-Chandr opened this issue · 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
I also encountered this problem, I don’t know if you have solved it, please help

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

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.