masadcv / FastGeodis

Fast Implementation of Generalised Geodesic Distance Transform for CPU (OpenMP) and GPU (CUDA)
https://fastgeodis.readthedocs.io
BSD 3-Clause "New" or "Revised" License
90 stars 14 forks source link

[BUG] ImportError: undefined symbol: _ZN3c104cuda20CUDACachingAllocator9allocatorE #50

Closed umutdundar99 closed 1 year ago

umutdundar99 commented 1 year ago

Describe the bug I use virtual environment and all my pytorch and cuda versions are compatible with FastGeodis. I downloaded FastGeodis with all three combination: -pip install FastGeodis -pip install git+https://github.com/masadcv/FastGeodis -pip install FastGeodis --no-build-isolation Important Note: I have tried to delete and create new virtual env or conda env. It did not solve my problem.

But, still I got this error: import FastGeodis File "/home/umut_dundar_smartalpha_ai/alpha_trainer/.venv/lib/python3.8/site-packages/FastGeodis/init.py", line 33, in import FastGeodisCpp ImportError: /home/umut_dundar_smartalpha_ai/alpha_trainer/.venv/lib/python3.8/site-packages/FastGeodisCpp.cpython-38-x86_64-linux-gnu.so: undefined symbol: _ZN3c104cuda20CUDACachingAllocator9allocatorE

It can not find the FastGeodisCpp file in FastGeodis library.

Expected behavior I want to know how can I fix it.

Desktop (please complete the following information):

CUDA VERSION == 11.8.0 efficientnet-pytorch 0.7.1
FastGeodis 1.0.3
filelock 3.12.0
flatbuffers 23.5.26
flatten-dict 0.4.2
flufl.lock 7.1.1
frozenlist 1.3.3
fsspec 2023.5.0
funcy 2.0
gitdb 4.0.10
GitPython 3.1.31
google-api-core 2.11.0
google-auth 2.19.0
google-cloud-core 2.3.2
google-cloud-storage 2.9.0
google-crc32c 1.5.0
google-resumable-media 2.5.0
googleapis-common-protos 1.59.0
grandalf 0.8
huggingface-hub 0.14.1
humanfriendly 10.0
hydra-colorlog 1.2.0
hydra-core 1.3.2
idna 3.4
imageio 2.30.0
importlib-resources 5.12.0
iterative-stratification 0.1.7
iterative-telemetry 0.0.8
joblib 1.2.0
kombu 5.2.4
kornia 0.6.12
lazy-loader 0.2
lightning-utilities 0.8.0
markdown-it-py 2.2.0
mdurl 0.1.2
mpmath 1.3.0
multidict 6.0.4
munch 3.0.0
nanotime 0.5.2
networkx 3.1
numpy 1.24.3
omegaconf 2.3.0
onnx 1.14.0
onnxruntime 1.15.0
onnxsim 0.4.28
opencv-python-headless 4.7.0.72
orjson 3.8.14
packaging 23.1
pandas 2.0.2
pathspec 0.11.1
pathtools 0.1.2
Pillow 9.5.0
pip 20.0.2
pkg-resources 0.0.0
platformdirs 3.5.1
pretrainedmodels 0.7.4
prompt-toolkit 3.0.38
protobuf 4.23.2
psutil 5.9.5
pyasn1 0.5.0
pyasn1-modules 0.3.0
pycparser 2.21
pydot 1.4.2
pygit2 1.12.1
Pygments 2.15.1
pygtrie 2.5.0
pyparsing 3.0.9
python-dateutil 2.8.2
pytorch-lightning 1.9.5
pytorch-ranger 0.1.1
pytz 2023.3
PyWavelets 1.4.1
PyYAML 6.0
qudida 0.0.4
regex 2023.5.5
requests 2.31.0
rich 13.4.1
rsa 4.9
ruamel.yaml 0.17.31
ruamel.yaml.clib 0.2.7
safetensors 0.3.1
scikit-image 0.20.0
scikit-learn 1.2.2
scipy 1.10.1
scmrepo 1.0.3
segmentation-models-pytorch 0.3.3
sentry-sdk 1.24.0
setproctitle 1.3.2
setuptools 44.0.0
shortuuid 1.0.11
shtab 1.6.1
six 1.16.0
smmap 5.0.0
sqltrie 0.3.1
sympy 1.12
tabulate 0.9.0
threadpoolctl 3.1.0
tifffile 2023.4.12
timm 0.9.2
tokenizers 0.13.3
tomlkit 0.11.8
torch 1.13.1+cu117 torch-optimizer 0.3.0
torchmetrics 0.11.0
torchvision 0.14.1+cu117 tqdm 4.65.0
transformers 4.29.2

masadcv commented 1 year ago

Hi, Similar issue was reported earlier here: https://github.com/masadcv/FastGeodis/issues/39 - can you try debugging using information there. It seemed to have fixed with fresh venv/python3.9 venv.

In case it still does not work, can you follow the steps here to try manual compile and paste the output here as a comment: https://github.com/masadcv/FastGeodis/issues/35#issuecomment-1247305033

umutdundar99 commented 1 year ago

35 has solved the problem, thank you so much for quick respond!

umutdundar99 commented 1 year ago

I built it successfully and I can import the FastGeodis now, but another error arises as i want to use the function of a library.

fg_dist = FastGeodis.generalised_geodesic2d(fg_mask, fg_mask, self.v, self.lamb, self.iterations) AttributeError: module 'FastGeodis' has no attribute 'generalised_geodesic2d'

I faced this error during the loss calculation.

masadcv commented 1 year ago

Seems like now you have a conflicting installation of the library.

Can you try again with a fresh virtualenv? If issues then report here with output of: pip list and the specific steps you followed to install/test

masadcv commented 1 year ago

Hi @umutdundar99 , Just checking, did you manage to solve this issues? If so, could you add a few lines how you did it so it may help anyone in future going through similar setup issues...

umutdundar99 commented 1 year ago

Hi @masadcv , sorry for the late reply, I've fixed the issue recently. Deleting and reinstalling Cuda and using Python 3.8 solved my problem. Only Cuda 11.7 version worked for me. Thank you a lot for your help!

masadcv commented 1 year ago

Great! Many thanks for reporting... I am glad I could be of help here. I will close this issue now.