Unable to run v2 - /torch/lib/libtorch.so: cannot read file data

I upgraded torch/torchvision to 1.2.0 on my fastai server, and am running from the notebooks (specifically 12_optimizers).
However, I can’t get anywhere due to this error:

ImportError Traceback (most recent call last)
in
1 #export
----> 2 from local.imports import *
3 from local.test import *
4 from local.core import *
5 from local.notebook.showdoc import show_doc

~/fdev/dev/local/imports.py in
21
22 # External modules
—> 23 import torch,matplotlib.pyplot as plt,numpy as np,pandas as pd,scipy
24 import requests,yaml
25 from typeguard import typechecked

~/anaconda3/lib/python3.7/site-packages/torch/init.py in
79 del _dl_flags
80
—> 81 from torch._C import *
82
83 all += [name for name in dir(_C)

ImportError: /home/ubuntu/anaconda3/lib/python3.7/site-packages/torch/lib/libtorch.so: cannot read file data

=========================================
Any recommendations for what else to upgrade to fix? I’m not sure what a .so file is…I’ll try numpy, etc. as well but any pointers here would be appreciated.

Thanks!

This is a PyTorch install problem, so my advice would be to reinstall then search their forum if it persists.

1 Like

Thanks @sgugger!
That fixed it!

pip uninstall torch
pip install torch

I had tried to upgrade my salamander servers (two of them actually) and both failed with the above via pip install torch --upgrade.

So lesson is, don’t trust the upgrade, but uninstall/install.
Note - it might be nice to just have a v2 template for Salamander servers?

Thanks again, now I’m up and running after being stuck in the water all yesterday.

That might be because you used pip @LessW2020. Salamander uses conda, and often mixing and matching can cause problems. I just tried using conda to update on my salamander instance with the default fastai template and it worked fine.

1 Like

Glad to hear Conda works great re:upgrade, and thanks for the clarification re: pip vs Conda on Salamander! I will stick with conda then :slight_smile: