What is the problem?
I am fairly new to pyro. So am trying to run a Bayesian neural network using pyro on google colab. I installed Pytorch first and when wrote : !pip3 install pyro-ppl
it shows requirements satisfied. But on importing gives No module called ‘Constraints’ error… What to do? Pls help.
import pyro
from pyro.distributions import Normal, Bernoulli # noqa: F401
from pyro.infer import SVI
from pyro.optim import Adam
pyro.get_param_store().clear()
Error:
ImportError Traceback (most recent call last)
in ()
----> 1 import pyro
2 from pyro.distributions import Normal, Bernoulli # noqa: F401
3 from pyro.infer import SVI
4 from pyro.optim import Adam
5
/usr/local/lib/python3.6/dist-packages/pyro/init.py in ()
3 import logging
4
----> 5 import pyro.poutine as poutine
6 from pyro.poutine import condition, do
7 from pyro.primitives import (clear_param_store, enable_validation, get_param_store, iarange, irange, module, param,
/usr/local/lib/python3.6/dist-packages/pyro/poutine/init.py in ()
1 from future import absolute_import, division, print_function
2
----> 3 from .handlers import block, condition, do, enum, escape, indep, infer_config, lift, replay, queue, scale, trace
4 from .runtime import NonlocalExit
5 from .trace_struct import Trace
/usr/local/lib/python3.6/dist-packages/pyro/poutine/handlers.py in ()
55 from pyro.poutine import util
56
—> 57 from .block_messenger import BlockMessenger
58 from .condition_messenger import ConditionMessenger
59 from .enumerate_messenger import EnumerateMessenger
/usr/local/lib/python3.6/dist-packages/pyro/poutine/block_messenger.py in ()
1 from future import absolute_import, division, print_function
2
----> 3 from .messenger import Messenger
4
5
/usr/local/lib/python3.6/dist-packages/pyro/poutine/messenger.py in ()
1 from future import absolute_import, division, print_function
2
----> 3 from .runtime import _PYRO_STACK
4
5
/usr/local/lib/python3.6/dist-packages/pyro/poutine/runtime.py in ()
----> 1 from pyro.params.param_store import _MODULE_NAMESPACE_DIVIDER, ParamStoreDict # noqa: F401
2
3 # the global pyro stack
4 _PYRO_STACK = []
5
/usr/local/lib/python3.6/dist-packages/pyro/params/init.py in ()
1 from future import absolute_import, division, print_function
2
----> 3 from pyro.params.param_store import module_from_param_with_module_name, param_with_module_name, user_param_name
4
5 all = [
/usr/local/lib/python3.6/dist-packages/pyro/params/param_store.py in ()
4
5 import torch
----> 6 from torch.distributions import constraints, transform_to
7
8
ImportError: cannot import name ‘constraints’
What version of Pyro, Pytorch, Python are you using? What OS version?
Please include all input and output where relevant, and steps to reproduce