Colab import error update_worker_pids


I’m trying to use on google colab. When I try:

import from *

I get the following error:

ImportError: cannot import name '_update_worker_pids'

Here is the last part of the error trace:

  2 import torch
  3 import torch.multiprocessing as multiprocessing
----> 4 from torch._C import _set_worker_signal_handlers, _update_worker_pids, \
  5     _remove_worker_pids, _error_if_any_worker_fails
  6 from . import SequentialSampler, RandomSampler, BatchSampler

And this is how I’m installing torch v1/fastai v1:

from os.path import exists
from wheel.pep425tags import get_abbr_impl, get_impl_ver, get_abi_tag
platform = '{}{}-{}'.format(get_abbr_impl(), get_impl_ver(), get_abi_tag())
cuda_output = !ldconfig -p|grep|sed -e 's/.*\.\([0-9]*\)\.\([0-9]*\)$/cu\1\2/'
accelerator = cuda_output[0] if exists('/dev/nvidia0') else 'cpu'
!pip3 install torch_nightly -f{accelerator}/torch_nightly.html
import torch

!pip3 install fastai

Thanks for any advice!


Well, I feel silly now. I had not selected the GPU runtime in google colab!