4

I've installed pytorch and fastai via conda:

conda list
...
fastai                    1.0.28                     py_1    fastai
pytorch                   1.0.0                   py3.6_1    pytorch
torchtext                 0.3.1                     <pip>
torchvision               0.2.1                      py_2    pytorch

I'm using one of the fastai models. The code to load the model is this ( the very last line is the one that fails):

import numpy as np
import torch
from fastai import untar_data, URLs
import pickle
from fastai.text import get_language_model
from torchtext import data

# puzzling the pieces together
# get weights and itos
model_path = untar_data(URLs.WT103, data=False)
fnames = [list(model_path.glob(f'*.{ext}'))[0] for ext in ['pth', 'pkl']]
wgts_fname, itos_fname = fnames
itos = pickle.load(open(itos_fname, 'rb'))
wgts = torch.load(wgts_fname, map_location=lambda storage, loc: storage)

It produces the error:

dyld: Symbol not found: _PySlice_Unpack
  Referenced from: /anaconda3/envs/t1/lib/python3.6/site-packages/torch/lib/libtorch_python.dylib
  Expected in: flat namespace

After browsing SO, I found this related question: dyld: Symbol not found: error how to resolve this issue

Apparently an error about dyld symbols is related to missing dependencies/broken paths to binaries.

In this case it looks like a pytorch internal problem to me. How can something like this happen when using a package manager like conda? My operating system is MacOS 10.14.2

lhk
  • 27,458
  • 30
  • 122
  • 201

0 Answers0