Pyro: import issue

Created on 18 Nov 2017  路  8Comments  路  Source: pyro-ppl/pyro

Hi! It seems that I can install pyro within some conda environment, but I can't import it

Here's the message, showing that installation is normal:

(brainiak) Qihong@:test_pytorch$ pip3 install pyro-ppl
Requirement already satisfied: pyro-ppl in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
Requirement already satisfied: numpy>=1.7 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from pyro-ppl)
Requirement already satisfied: scipy>=0.19.0 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from pyro-ppl)
Requirement already satisfied: cloudpickle>=0.3.1 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from pyro-ppl)
Requirement already satisfied: graphviz>=0.8 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from pyro-ppl)
Requirement already satisfied: networkx>=2.0.0 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from pyro-ppl)
Requirement already satisfied: observations>=0.1.4 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from pyro-ppl)
Requirement already satisfied: torch in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from pyro-ppl)
Requirement already satisfied: six>=1.10.0 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from pyro-ppl)
Requirement already satisfied: decorator>=4.1.0 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from networkx>=2.0.0->pyro-ppl)
Requirement already satisfied: pyyaml in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from torch->pyro-ppl)

Here's the error message I got when I tried to import pyro:

(brainiak) Qihong@:test_pytorch$ python3
Python 3.6.1 |Anaconda custom (x86_64)| (default, May 11 2017, 13:04:09)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyro
Traceback (most recent call last):
File "", line 1, in
ModuleNotFoundError: No module named 'pyro'

Any clue what is going on here? Thanks!

Most helpful comment

I think the issue is that pip3 install pyro-ppl is not using your conda environment when installing those python packages, but rather the location -
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages. Once you have created a conda environment with python=3.6, pip (not pip3) should just work out of the box, and you should be able to install using pip install pyro-ppl (no need for pip3).

We should probably clarify this on our website for conda users.

All 8 comments

Not sure. Those site-packages paths don't look like the conda site package paths on my system. Can you paste output of which pip3 and which python3. Maybe you created a Python2 conda env and so python3 is referring to the global installed version?

Thanks! I'm pretty sure this environment is python3...

(brainiak) Qihong@:test_pytorch$ which python3
/Users/Qihong/anaconda/envs/brainiak/bin/python3
(brainiak) Qihong@:test_pytorch$ which python
/Users/Qihong/anaconda/envs/brainiak/bin/python

btw, python also didn't work...

can you print your $PYTHON_PATH?

@jpchen Thanks!
Do you mean the default python path outside of the anaconda environment?

Qihong@:test_pyro$ which python
/Users/Qihong/anaconda/bin/python

I think the issue is that pip3 install pyro-ppl is not using your conda environment when installing those python packages, but rather the location -
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages. Once you have created a conda environment with python=3.6, pip (not pip3) should just work out of the box, and you should be able to install using pip install pyro-ppl (no need for pip3).

We should probably clarify this on our website for conda users.

@neerajprad You are right!

(brainiak) Qihong@:test_pyro$ which pip
/Users/Qihong/anaconda/envs/brainiak/bin/pip
(brainiak) Qihong@:test_pyro$ which pip3
/Library/Frameworks/Python.framework/Versions/3.6/bin/pip3

So pip install pyro-ppl solved the problem. Thank you very much!

glad you were able to resolve it! as an aside, feel free to post these things in the community forum in the future so others can benefit from your question as well

@jpchen Got it! Thanks again!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

neerajprad picture neerajprad  路  4Comments

tobyclh picture tobyclh  路  3Comments

fehiepsi picture fehiepsi  路  3Comments

lundlab-kaltinel picture lundlab-kaltinel  路  3Comments

null-a picture null-a  路  4Comments