Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import Error when calling the propagator #27

Closed
erellaz opened this issue Mar 30, 2021 · 15 comments
Closed

Import Error when calling the propagator #27

erellaz opened this issue Mar 30, 2021 · 15 comments

Comments

@erellaz
Copy link

erellaz commented Mar 30, 2021

Thanks for writing Deepwave and generously putting it on Github.

Each time I try to use the propagator I have the following import error. I have tried with various versions of pytorch (18 and 17.1), as well as with various examples (the main example and the seam example provided on kolab) and am not sure which direction to go from here. Any pointer would be helpful. Thanks!

Traceback (most recent call last):
File "deepwave_demo.py", line 26, in
receiver_amplitudes = prop(source_amplitudes, x_s, x_r, dt)
File "/home/gu/anaconda3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 722, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/gu/.local/lib/python3.8/site-packages/deepwave/base/propagator.py", line 144, in forward
return self.propfunc.apply(source_amplitudes, source_locations,
File "/home/gu/.local/lib/python3.8/site-packages/deepwave/scalar/scalar.py", line 90, in forward
scalar_wrapper = _select_propagator(model.ndim, vp.dtype, vp.is_cuda)
File "/home/gu/.local/lib/python3.8/site-packages/deepwave/scalar/scalar.py", line 320, in _select_propagator
import scalar2d_cpu_iso_4_float as scalar_wrapper
ImportError: /home/gu/.local/lib/python3.8/site-packages/scalar2d_cpu_iso_4_float.cpython-38-x86_64-linux-gnu.so: undefined symbol: _ZN6caffe28TypeMeta21_typeMetaDataInstanceISt7complexIdEEEPKNS_6detail12TypeMetaDataEv

@ar4
Copy link
Owner

ar4 commented Mar 30, 2021 via email

@erellaz
Copy link
Author

erellaz commented Mar 30, 2021

Thanks for your very prompt response and your time. Really appreciated.

I just did an install of Ubuntu 20.10, which comes with Nvidia GPU drivers for my card. Then I installed cuda (sudo apt install nvidia-cuda-toolkit), then Anaconda, then pytorch (conda install pytorch torchvision cudatoolkit=10.1 -c pytorch) then deepwave. I tried both versions of deepwave (stable and dev) with (pip3 install deepwave). This installed pytorch 1.8. As it was not working I tried pytorch 1.7.1 (pip3 install "torch==1.7.1") since it seems to be the version preferred by deepwave. The message when calling the propagator remains the same.
The Python environment should be clean, as Deepwave and its dependency are the only things I have installed since installing Linux.
I will try to repeat the procedure, but without using Anaconda in a new virtual environment.

@ar4
Copy link
Owner

ar4 commented Mar 31, 2021 via email

@erellaz
Copy link
Author

erellaz commented Mar 31, 2021

Thanks again for your continued support!

When changing torch versions I removed deepwave first, then reinstalled deepwave after the other version of torch is set up:
pip3 uninstall deepwave
pip3 uninstall torch
pip3 install "torch==1.7.1"
pip3 install deepwave

Both CPU and GPU give similar error, with caffe in the symbol of the compiled object.

Caffe2 comes with the Cuda toolkit, so I tested removing the Cuda toolkit:

sudo apt-get remove nvidia-cuda-toolkits
sudo apt-get autoremove nvidia-cuda-toolkit
sudo apt-get remove --purge nvidia*

and re installed torch & deepwave without Cuda toolkit, but the error persists. However, I am not 100% sure that I removed all the dependencies coming with the first install of the Cuda toolkit. At this point I am testing various combinations of Cuda & pytorch versions to see if the error goes away. I will also test various Nvidia drivers. If that fails I will reinstall Ubuntu, which may be the quickest way to get rid of all cuda dependencies with certainty.

@ar4
Copy link
Owner

ar4 commented Mar 31, 2021 via email

@ar4
Copy link
Owner

ar4 commented Mar 31, 2021 via email

@erellaz
Copy link
Author

erellaz commented Mar 31, 2021

Just tried Cuda toolkit 11. Unfortunately it did not help.

@ar4
Copy link
Owner

ar4 commented Apr 1, 2021 via email

@erellaz
Copy link
Author

erellaz commented Apr 1, 2021

I tried the above procedure on a new install of Ubuntu 20.10, and it works perfectly. No more error message. So I will stay on CPUs for the time being and enjoy the possibilities of Deepwave.

Thanks again.

@ar4
Copy link
Owner

ar4 commented Apr 1, 2021 via email

@ar4
Copy link
Owner

ar4 commented Apr 2, 2021 via email

@erellaz
Copy link
Author

erellaz commented Apr 7, 2021

Thanks again!
I tried the above method to install Pytorch with cudatoolkit 11.1. When installing Deepwave it gives an error (CUDA_HOME variable not set) and indeed Cuda is not installed (at least not in /usr/local/cuda). I did not investigate too deeply, but instead reversed to CPUs only, which should be fine for my current application.
Thanks a lot for all the help and the time spent on it. At this point I am very happy to have a functional version of deepwave and will focus on my application.

@ar4
Copy link
Owner

ar4 commented Apr 7, 2021 via email

@Shipeng-Xiao
Copy link

HI ,Thanks for writing Deepwave!
I ran into the same problem as erellaz, and I can't even implement it on the CPU. I installed deepwave on the computers of friends around me, but we encountered many warnings during the installation process.
Thanks for your sharing. If you have a good way, please let me know.

@ar4
Copy link
Owner

ar4 commented Dec 2, 2021

Hi Shipeng,

Thank you for your comment. I created a new issue (#38) for this in case it turns out to be a separate problem to that encountered by @erellaz .

@ar4 ar4 closed this as completed Jun 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants