No module named 'pyhive'

Stacker picture Stacker · Jan 24, 2017 · Viewed 10.5k times · Source

I'm trying to access data from Hive in a iPython Notebook. So I run

pip3 install PyHive

This returns

Requirement already satisfied: PyHive in /usr/local/lib/python3.5/site-packages

But then when I run the following import

from pyhive import hive

I get the following error message

ImportError                               Traceback (most recent call last)
<ipython-input-4-747088b97eb4> in <module>()
----> 1 from pyhive import hive

ImportError: No module named 'pyhive'

Why can't I access pyhive when it's already installed.

Answer

Nate picture Nate · Jan 24, 2017

It sounds like you have multiple instances of python installed on your computer. In order to change environments from one instance to another, you will need to activate the environment. If you're using conda, you can use the command

conda env list

which will list all of your installed environments. You can use a particular environment with

activate py2

"py2" is an example name, insert your own environment name. From there, you can find whether that particular instance has a PyHive installed with

pip list

if not, install it with pip or pip3.