Module 'pyro' has no attribute 'set_rng_seed'


I’m just started using pyro,
I’m using latest pyro stable release install it using pip (version 0.3.1.post1)
while I try to run the tutorial on
my program return error :
> AttributeError: module ‘pyro’ has no attribute ‘set_rng_seed’

did I miss something?
(I’m using visual studio code and anaconda)


That’s strange. Could you try importing pyro in a python shell, and printing the output of dir(pyro)? Is it possible that you also installed a different library leading to a namespace clash?


I tried the python shell, the result was :

[’__all__’, ‘__builtins__’, ‘__cached__’, ‘__doc__’, ‘__file__’, ‘__loader__’, ‘__name__’, ‘__package__’, ‘__path__’, ‘__spec__’, ‘__version__’, ‘_version’, ‘absolute_import’, ‘clear_param_store’, ‘condition’, ‘distributions’, ‘division’, ‘do’, ‘enable_validation’, ‘get_param_store’, ‘iarange’, ‘infer’, ‘irange’, ‘log’, ‘logger’, ‘markov’, ‘module’, ‘ops’, ‘param’, ‘params’, ‘plate’, ‘poutine’, ‘primitives’, ‘print_function’, ‘random_module’, ‘sample’, ‘set_rng_seed’, ‘util’, ‘validation_enabled’, ‘version_prefix’]

but when I do the same from Jupiter notebook inside my vs code the result was only :

[’__builtins__’, ‘__cached__’, ‘__doc__’, ‘__file__’, ‘__loader__’, ‘__name__’, ‘__package__’, ‘__spec__’]

I’m not really sure but I only installed pytorch, torchvision, spyder, matplotlib, and jupyter other than pyro.


are you using an environment manager and if so, are you using the local jupyter installed in your environment? if not, it won’t use the correct package. as neeraj suggested, this looks like a namespace clash.


As @jpchen said, jupyter notebook does not use the local environment by default. You will need to configure jupyter to detect and use your local environment. You might find this article useful -


I tried but it seems not compatible with packages inside my current local env:

(pytorch) λ pip install environtment_kernels
Collecting environtment_kernels
Could not find a version that satisfies the requirement environtment_kernels (from versions: )
No matching distribution found for environtment_kernels

The problem seems to come from the visual studio code. i tried to run the python shell inside vs code terminal and the problem arises. but when I use the python shell from cmd and standard in-browser jupyter notebook it runs well.
I’ll use the standard in-browser jupyter notebook or spyder instead.

Thank you for the help @jpchen @neerajprad