Hail import into python error

I’m fumbling along with installing hail locally. When importing into python, I get this error (ImportError: No module named py4j.protocol). Any help is appreciated.
Jeff

VIPBGB1L01130AB:hail jalexander4$ ipython
Python 2.7.13 |Anaconda 4.3.1 (x86_64)| (default, Dec 20 2016, 23:05:08)
Type “copyright”, “credits” or “license” for more information.

IPython 5.1.0 – An enhanced Interactive Python.
? -> Introduction and overview of IPython’s features.
%quickref -> Quick reference.
help -> Python’s own help system.
object? -> Details about ‘object’, use ‘object??’ for extra details.

In [1]: import hail

ImportError Traceback (most recent call last)
in ()
----> 1 import hail

/Users/jalexander4/hail/python/hail/init.py in ()
----> 1 from hail.context import HailContext
2 from hail.dataset import VariantDataset
3 from hail.keytable import KeyTable
4 from hail.utils import TextTableConfig
5 from hail.type import Type

/Users/jalexander4/hail/python/hail/context.py in ()
1 from future import print_function # Python 2 and 3 print compatibility
2
----> 3 from pyspark.sql import SQLContext
4
5 from hail.dataset import VariantDataset

/Users/jalexander4/spark-2.1.0-bin-hadoop2.7/python/pyspark/init.py in ()
42
43 from pyspark.conf import SparkConf
—> 44 from pyspark.context import SparkContext
45 from pyspark.rdd import RDD
46 from pyspark.files import SparkFiles

/Users/jalexander4/spark-2.1.0-bin-hadoop2.7/python/pyspark/context.py in ()
27 from tempfile import NamedTemporaryFile
28
—> 29 from py4j.protocol import Py4JError
30
31 from pyspark import accumulators

ImportError: No module named py4j.protocol

In [2]:

Make sure that you’ve added the py4j library to your python path, as here: https://hail.is/hail/getting_started.html

If you’re using a slightly different version of spark, it’s possible that the py4j version is different, too – make sure you’ve actually got the 0.10.3 version at $SPARK_HOME/python/lib/py4j-0.10.3-src.zip, or modify it to match.

1 Like

Thanks, it’s working now. I had Spark 10.4.