kakao / n2

TOROS N2 - lightweight approximate Nearest Neighbor library which runs fast even with large datasets
Apache License 2.0
567 stars 71 forks source link

Cannot use with pytorch due to libgomp issue #42

Open fjsj opened 3 years ago

fjsj commented 3 years ago

I've found the following issue when trying to use n2 with pytorch in the same project. It only happens when pytorch is imported BEFORE n2. When n2 is imported, I get this:

>>> import n2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: /home/user/workspace/n2/venv/lib/python3.8/site-packages/torch/lib/libgomp-7c85b1e2.so.1: version `GOMP_5.0' not found (required by /home/user/workspace/n2/venv/lib/python3.8/site-packages/n2.cpython-38-x86_64-linux-gnu.so)

Steps to reproduce are very simple. Just run pip install torch n2 ,then run:

import torch
import n2

My machine is:

Any available workarounds other than forcing import order?

sanmai-NL commented 1 year ago

See https://github.com/pytorch/pytorch/issues/98836#issue-1662240823 for a workaround that could perhaps be applied in this case too.