Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

undefined symbol: PySlice_AdjustIndices when importing PyTorch

I am trying to use PyTorch, and I think there is some version of something that isn't lining up.

From what little I can suss out, it seems that there are some functions in the newest version of PyTorch (?) that can't be accessed on my system. I suspect it has something to do with Python version 3.6.1 as opposed to 3.6.0. But I can't figure it out. If anyone has any advice on what I can do to rectify this error:

/home/ubuntu/nbs/torch_utils.py in <module>()
----> 1 import torch
      2 import torch.nn as nn
      3 import torch.nn.parallel
      4 import torch.utils.data
      5 from torch import optim

/home/ubuntu/anaconda3/lib/python3.6/site-packages/torch/__init__.py in <module>()
     51 sys.setdlopenflags(_dl_flags.RTLD_GLOBAL | _dl_flags.RTLD_NOW)
     52 
---> 53 from torch._C import *
     54 
     55 __all__ += [name for name in dir(_C)

ImportError: /home/ubuntu/anaconda3/lib/python3.6/site-packages/torch/_C.cpython-36m-x86_64-linux-gnu.so: undefined symbol: PySlice_AdjustIndices

Here's the details on my system:

I am running Ubuntu on AWS, Ubuntu 16.04.2 LTS

my Cuda info is Cuda compilation tools, release 8.0, V8.0.61

I have Anaconda, conda 4.3.15

My python version is Python 3.6.0 :: Anaconda custom (64-bit)

Thanks.

like image 651
Monica Heddneck Avatar asked Mar 29 '17 21:03

Monica Heddneck


2 Answers

I have the same problem, maybe the build is broken for Ubuntu / Python 3.6.

Anyway, until they fix this problem, you can install PyTorch by downgrading one version:

conda install pytorch=0.1.10 torchvision -c soumith

This version runs just fine on all my tests.

like image 59
Pedro Tabacof Avatar answered Nov 15 '22 19:11

Pedro Tabacof


this is now fixed if you reinstall pytorch via conda:

conda install pytorch torchvision -c soumith

like image 21
smhx Avatar answered Nov 15 '22 21:11

smhx