Unable to import PyroModule

624 views Asked by At

I am trying to import PyroModule using: from pyro.nn import PyroModule but, I am getting this error:

ImportError: cannot import name 'PyroModule' from 'pyro.nn' (/home/karima/anaconda3/envs/my_env/lib/python3.7/site-packages/pyro/nn/init.py)

Here is the whole piece of code:

import os
from functools import partial
import torch
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import pyro
import pyro.distributions as dist
from torch import nn
import seaborn as sns
from pyro.nn import PyroModule
2

There are 2 answers

9
Dhinesh Sunder Ganapathi On

I think the issue is due to wrong installation of pyro module,

instead of this

pip install pyronn

can you try this

pip install pyro-ppl

Let me know how this goes

0
Joy On

I was facing the same problem with my MAC. None of the suggestions worked for me. I resolved it by running python -m pip install pyro-ppl I hope this helps.