Monday, October 30, 2017

self-study lab - Python Tutorial Basic

Error and Issue of Pytorch Installation




After a couple of trial and error, here is the most promising way to install Pytorch in Ubuntu.

If you have already tried different ways to install Pytorch or you have  followed different posts to fix your problem, you need to first uninstall everything related to Pytorch.

To uninstall pytorch, here is what is suggested by soumith(https://github.com/pytorch/pytorch/issues/2036).

conda uninstall -y pytorch
pip uninstall torch
pip uninstall torch # yes run this twice


Now, reinstall pytorch. From the official website, we have different options. Here we recommand using conda. Go to the Pytorch website and choose your command. For example,

conda install pytorch torchvision -c soumith

Now, if you go to your IDE and try to import pytorch, you may get some error similiar to the error message below:

ImportError: /home/ruikun/anaconda/lib/python2.7/site-packages/torch/lib/libTHC.so.1: undefined symbol: THLongStorage_inferSizeN


To solve this problem, type:

conda uninstall libtorch



Summary

1. uninstall pytorch completely
2. reinstall pytorch via conda
3. conda uninstall libtorch