No module named 'pyhive'
Solution 1
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.
Solution 2
I agree with Steltron in that there may be multiple python instances. If you don't have Anaconda (or even if you do), here is the general way to diagnose and fix the issue.
You can check the version of your default python interpreter with
python --version
If it is not python3 (likely python2), you can do a few things to correct it. I've listed two possible solutions below:
- Install PyHive for python2 if it is available.
- Add the python3 directory to your
PYTHONPATH
in your.bashrc
orprofile
file in the home directory. Then, activate python3 in the command line with some variant ofsource activate python3
.
Stacker
Updated on July 14, 2022Comments
-
Stacker almost 2 years
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.