Error in importing utils or contrib

Hi everyone I just got started with pyro (deep markov model: and unfortunately I cannot find a way to properly run the code.

indeed concerning the polyphonic data loader script i get the following import errors:

  • from pyro.contrib.examples.util import get_data_directory

same problem with the line

  • from torch._utils import ExceptionWrapper

any idea how to solve them?

can you post your python, pytorch, pyro versions and also the error message? make sure you’re using the release versions of everything

Hi sure,

sorry for the delay
python: 3.6.8
pytorch: 1.14.0
pyro: 1.16.4

and the error is :

ImportError Traceback (most recent call last)
in ()
23 from torch.nn.utils.rnn import pad_sequence
—> 25 from pyro.contrib.examples.util import get_data_directory

7 frames
/usr/local/lib/python3.6/dist-packages/pyro/contrib/examples/ in ()
2 import sys
----> 4 import torchvision
5 import torchvision.datasets as datasets
6 from import DataLoader

/usr/local/lib/python3.6/dist-packages/torchvision/ in ()
1 from torchvision import models
----> 2 from torchvision import datasets
3 from torchvision import ops
4 from torchvision import transforms
5 from torchvision import utils

/usr/local/lib/python3.6/dist-packages/torchvision/datasets/ in ()
----> 1 from .lsun import LSUN, LSUNClass
2 from .folder import ImageFolder, DatasetFolder
3 from .coco import CocoCaptions, CocoDetection
4 from .cifar import CIFAR10, CIFAR100
5 from .stl10 import STL10

/usr/local/lib/python3.6/dist-packages/torchvision/datasets/ in ()
----> 1 from .vision import VisionDataset
2 from PIL import Image
3 import os
4 import os.path
5 import six

/usr/local/lib/python3.6/dist-packages/torchvision/datasets/ in ()
1 import os
2 import torch
----> 3 import as data

/usr/local/lib/python3.6/dist-packages/torch/utils/data/ in ()
2 from .distributed import DistributedSampler # noqa: F401
3 from .dataset import Dataset, IterableDataset, TensorDataset, ConcatDataset, ChainDataset, Subset, random_split # noqa: F401
----> 4 from .dataloader import DataLoader, _DatasetKind, get_worker_info # noqa: F401

/usr/local/lib/python3.6/dist-packages/torch/utils/data/ in ()
10 import torch.multiprocessing as multiprocessing
11 from . import IterableDataset, Sampler, SequentialSampler, RandomSampler, BatchSampler
—> 12 from . import _utils
13 from torch._utils import ExceptionWrapper
14 import threading

/usr/local/lib/python3.6/dist-packages/torch/utils/data/_utils/ in ()
13 # old private location of the ExceptionWrapper that some users rely on:
—> 14 from torch._utils import ExceptionWrapper # noqa: F401

ImportError: cannot import name ‘ExceptionWrapper’

NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the
“Open Examples” button below.

you installed the wrong pyro.

Hi, thank you for the answer,
I m working on google colab and to install it I used the
!pip3 install pyro-ppl

which one should i use then?

the correct version is 3.0.1?