Runtime Error: Cannot initialize ATen Cuda Library

Trying to run lesson2-immage_models and am getting stuck trying to run the cell with:


with error at:

RuntimeError Traceback (most recent call last)
in ()
----> 1 plt.imshow(data.val_ds.denorm(to_np(x))[0]*1.4);

~/Desktop/Kodiranje/fastai_home/courses/dl1/fastai/ in to_np(v)
68 if isinstance(v, (list,tuple)): return [to_np(o) for o in v]
69 if isinstance(v, Variable):
—> 70 if isinstance(v, torch.cuda.HalfTensor): v=v.float()
71 return v.cpu().numpy()

and saying:

RuntimeError: Cannot initialize CUDA without ATen_cuda library. PyTorch splits its backend into two shared libraries: a CPU library and a CUDA library; this error has occurred because you are trying to use some CUDA functionality, but the CUDA library has not been loaded by the dynamic linker for some reason. The CUDA library MUST be loaded, EVEN IF you don’t directly use any symbols from the CUDA library! One common culprit is a lack of -Wl,–no-as-needed in your link arguments; many dynamic linkers will delete dynamic library dependencies if you don’t depend on any of their symbols. You can check if this has occurred by using ldd on your binary to see if there is a dependency on * library.

I used to be able to run the code smoothly, I think something broke with the updates via Git Pull

How can I fix this problem? Presuming I can modify some lines in
Additional info: am on MacOS where I try to run short version before running my Paperspace instances.

Edit: Running this on Paperspace there are no problems.

Resolved it via …grudgingly… installing anaconda and doing a fastai-cpu environment install. The weird part is It all ran before perfectly (even without specifically having a cuda gpu card)… C’est La Vie

1 Like

I got the same problem on Pytorch 0.4.1 install from conda.
I’m not sure this happened because it had conflicted with path from fastai library’s Pytorch.
So I just edit fastai-cpu.yml to use recent version of Pytorch (because I need 0.4) and reinstall conda environment. All working fine.

hmm I am having the same problem with both fastai and fastai-cpu

check your torch version .
the pytorch version 0.4.1 causes issues
as @Woodstock mentioned
iI downgraded to torch 0.4.0 and it works fine for me
conda install pytorch=0.4.0 cuda92 -c pytorch

1 Like