[resolved] PySlice_AdjustIndices Error

I am using python 3.6 on Ubuntu 16.04.

I have just updated pytorch via conda.

But, I got an following error when torch was imported.

Python 3.6.0 |Anaconda 4.3.1 (64-bit)| (default, Dec 23 2016, 12:22:00)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
Type “help”, “copyright”, “credits” or “license” for more information.

import torch
Traceback (most recent call last):
File “”, line 1, in
File “/home/sypark/anaconda3/lib/python3.6/site-packages/torch/init.py”, line 53, in
from torch._C import *
ImportError: /home/sypark/anaconda3/lib/python3.6/site-packages/torch/_C.cpython-36m-x86_64-linux-gnu.so: undefined symbol: PySlice_AdjustIndices

Please help me how to solve this problem.

this makes no sense yet, because python 3.6 should be having that. Let’s try to figure this out.

Can you please paste your output of the following command:

ldd /home/sypark/anaconda3/lib/python3.6/site-packages/torch/_C.cpython-36m-x86_64-linux-gnu.so

I downgraded pytorch to 0.1.10. Then, there is no problem.
Also, I found the same question on

He had the same problem.

The output is below.

linux-vdso.so.1 => (0x00007ffc94684000)
libshm.so => /home/sypark/anaconda3/lib/python3.6/site-packages/torch/lib/libshm.so (0x00007f9936bfa000)
libcudart.so.8.0 => /home/sypark/anaconda3/lib/python3.6/site-packages/torch/lib/libcudart.so.8.0 (0x00007f9936991000)
libcudnn.so.5 => /home/sypark/anaconda3/lib/python3.6/site-packages/torch/lib/libcudnn.so.5 (0x00007f9931bbb000)
libpython3.6m.so.1.0 => /home/sypark/anaconda3/lib/python3.6/site-packages/torch/…/…/…/libpython3.6m.so.1.0 (0x00007f99316b6000)
libTH.so.1 => /home/sypark/anaconda3/lib/python3.6/site-packages/torch/lib/libTH.so.1 (0x00007f9931106000)
libTHS.so.1 => /home/sypark/anaconda3/lib/python3.6/site-packages/torch/lib/libTHS.so.1 (0x00007f9930ed3000)
libTHPP.so.1 => /home/sypark/anaconda3/lib/python3.6/site-packages/torch/lib/libTHPP.so.1 (0x00007f9930b05000)
libTHNN.so.1 => /home/sypark/anaconda3/lib/python3.6/site-packages/torch/lib/libTHNN.so.1 (0x00007f9930800000)
libTHC.so.1 => /home/sypark/anaconda3/lib/python3.6/site-packages/torch/lib/libTHC.so.1 (0x00007f9922a49000)
libTHCS.so.1 => /home/sypark/anaconda3/lib/python3.6/site-packages/torch/lib/libTHCS.so.1 (0x00007f992282f000)
libTHCUNN.so.1 => /home/sypark/anaconda3/lib/python3.6/site-packages/torch/lib/libTHCUNN.so.1 (0x00007f991694d000)
libgcc_s.so.1 => /home/sypark/anaconda3/lib/python3.6/site-packages/torch/…/…/…/libgcc_s.so.1 (0x00007f9916737000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f99164fe000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f9916134000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f9915f2c000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f9915c22000)
/lib64/ld-linux-x86-64.so.2 (0x000055f3b1b3f000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f9915a1e000)
libstdc++.so.6 => /home/sypark/anaconda3/lib/python3.6/site-packages/torch/lib/…/…/…/…/libstdc++.so.6 (0x00007f9915708000)
libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007f9915504000)
libmkl_intel_lp64.so => /home/sypark/anaconda3/lib/python3.6/site-packages/torch/lib/…/…/…/…/libmkl_intel_lp64.so (0x00007f9914ae2000)
libmkl_intel_thread.so => /home/sypark/anaconda3/lib/python3.6/site-packages/torch/lib/…/…/…/…/libmkl_intel_thread.so (0x00007f991307c000)
libmkl_core.so => /home/sypark/anaconda3/lib/python3.6/site-packages/torch/lib/…/…/…/…/libmkl_core.so (0x00007f9911584000)
libiomp5.so => /home/sypark/anaconda3/lib/python3.6/site-packages/torch/lib/…/…/…/…/libiomp5.so (0x00007f99111da000)
libgomp.so.1 => /home/sypark/anaconda3/lib/python3.6/site-packages/torch/lib/…/…/…/…/libgomp.so.1 (0x00007f9910fca000)
libcublas.so.8.0 => /home/sypark/anaconda3/lib/python3.6/site-packages/torch/lib/libcublas.so.8.0 (0x00007f990e617000)
libcurand.so.8.0 => /home/sypark/anaconda3/lib/python3.6/site-packages/torch/lib/libcurand.so.8.0 (0x00007f990a6ac000)
libcusparse.so.8.0 => /home/sypark/anaconda3/lib/python3.6/site-packages/torch/lib/libcusparse.so.8.0 (0x00007f9907b99000)

it would help me if you gave the output of the command:

python --version

Thanks.

My python version is below.

Python 3.6.0 :: Anaconda 4.3.1 (64-bit)

Also, I updated pytorch by the command as

conda update pytorch torchvision -c soumith

Thanks.

this is helpful, thank you. I’ll try to fix this error by tomorrow in the new binaries.

Thanks for your help!!

this should now be fixed in the latest binaries.
Thanks for waiting.

I will check it.

Thanks for your help.

I do not the reason, I got the out of memory error.
Compared to the latest, the previous version consumes 9GB only (12GB total).
I should stay at the previous version for a while.

Thanks.

what is your application? is your code available somewhere to look?

My application is Inception-resnetv2 based autoencoder.

I would like to share my code to solve this problem, but I am not allowed to do this by the company for a while.

I will post the github address if I am allowed.

Sorry.

Hey Man, I upgrade my pytorch with conda update pytorch torchvision -c soumith. But after updating i get this error:

in ()
----> 1 import torch

/home/mohammad/anaconda3/lib/python3.6/site-packages/torch/init.py in ()
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/mohammad/anaconda3/lib/python3.6/site-packages/torch/lib/libTHC.so.1: cannot read file data

So what shoud i do then? How can I solve this?

I am using python 3.6 on Amazon linux.
I have just updated pytorch via conda too.
I also encountered a similar problem。

import torchvision
Traceback (most recent call last):
File “”, line 1, in
File “/home/ec2-user/anaconda3/lib/python3.6/site-packages/torchvision-0.1.8-py3.6.egg/torchvision/init.py”, line 2, in
File “/home/ec2-user/anaconda3/lib/python3.6/site-packages/torchvision-0.1.8-py3.6.egg/torchvision/datasets/init.py”, line 1, in
File “/home/ec2-user/anaconda3/lib/python3.6/site-packages/torchvision-0.1.8-py3.6.egg/torchvision/datasets/lsun.py”, line 2, in
File “/home/ec2-user/anaconda3/lib/python3.6/site-packages/PIL/Image.py”, line 56, in
from . import _imaging as core
ImportError: /home/ec2-user/anaconda3/lib/python3.6/site-packages/PIL/_imaging.cpython-36m-x86_64-linux-gnu.so: undefined symbol: PySlice_Unpack

@leegang how did you install pytorch? from wheel or from conda?

conda install pytorch torchvision cuda80 -c soumith

@smth

that is weird. what is your output of:

python --version

and what is the output of conda list | grep pytorch

$ python --version
Python 3.6.0 :: Anaconda custom (64-bit)
$ conda list | grep pytorch
pytorch 0.1.11 py360_4cu80 [cuda80] soumith

ok the problem is pytorch version 0.1.11_4. It had this problem and I updated it to 0.1.11_5 which did not have this issue.
Can you do:

conda uninstall pytorch
conda install pytorch -c soumith

Verify that it is installing 0.1.11_5

[ec2-user@ip-172-31-40-200 Notebooks]$ conda install pytorch -c soumith
Fetching package metadata .....
......
Solving package specifications: .

Package plan for installation in environment /home/ec2-user/anaconda3:

The following NEW packages will be INSTALLED:

    pytorch: 0.1.11-py360_4cu80 soumith [cuda80]

Proceed ([y]/n)?
y

ec2-user@ip-172-31-40-200 Notebooks]$ conda list | grep pytorch
    pytorch                   0.1.11              py360_4cu80  [cuda80]  soumith