# Hail-overview:error in running the first two lines in the tutorial

**URL:** <https://discuss.hail.is/t/hail-overview-error-in-running-the-first-two-lines-in-the-tutorial/338>\
**Category:** Help \[0.1\]\
**Created:** [October 25, 2017, 4:36am UTC](https://discuss.hail.is/t/hail-overview-error-in-running-the-first-two-lines-in-the-tutorial/338 "2017-10-25T04:36:00Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![alerodriguez](https://avatars.discourse-cdn.com/v4/letter/a/898d66/32.png) [@alerodriguez](https://discuss.hail.is/u/alerodriguez)\
**Post date:** [October 25, 2017, 4:36am UTC](https://discuss.hail.is/t/hail-overview-error-in-running-the-first-two-lines-in-the-tutorial/338/1 "2017-10-25T04:36:00Z")

</div>

## from hail import \* hc = HailContext()

ImportError Traceback (most recent call last)  
 in ()  
----\> 1 from hail import \*  
2 hc = HailContext()

/Users/AleRodriguez/bin/hail/python/hail/ **init**.py in ()  
----\> 1 import hail.expr  
2 from hail.representation import \*  
3 from hail.context import HailContext  
4 from hail.dataset import VariantDataset  
5 from hail.expr import \*

/Users/AleRodriguez/bin/hail/python/hail/expr.py in ()  
1 import abc  
----\> 2 from hail.java import scala\_object, Env, jset  
3 from hail.representation import Variant, AltAllele, Genotype, Locus, Interval, Struct, Call  
4  
5

/Users/AleRodriguez/bin/hail/python/hail/java.py in ()  
----\> 1 import SocketServer  
2 import socket  
3 import sys  
4 from threading import Thread  
5

ImportError: No module named ‘SocketServer’

---

<div class="post-metadata">

**Author:** ![tpoterba](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/tpoterba/32/61_2.png) [@tpoterba](https://discuss.hail.is/u/tpoterba)\
**Post date:** [October 25, 2017, 9:59am UTC](https://discuss.hail.is/t/hail-overview-error-in-running-the-first-two-lines-in-the-tutorial/338/2 "2017-10-25T09:59:25Z")

</div>

Are you possibly using Python 3? Hail currently only supports Python 2, and it looks like `SocketServer` is one module that was renamed in Python 3.

---

<div class="post-metadata">

**Author:** ![alerodriguez](https://avatars.discourse-cdn.com/v4/letter/a/898d66/32.png) [@alerodriguez](https://discuss.hail.is/u/alerodriguez)\
**Post date:** [October 25, 2017, 2:32pm UTC](https://discuss.hail.is/t/hail-overview-error-in-running-the-first-two-lines-in-the-tutorial/338/3 "2017-10-25T14:32:22Z")

</div>

I changed my default to python 2 and got the same error

---

<div class="post-metadata">

**Author:** ![tpoterba](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/tpoterba/32/61_2.png) [@tpoterba](https://discuss.hail.is/u/tpoterba)\
**Post date:** [October 25, 2017, 2:33pm UTC](https://discuss.hail.is/t/hail-overview-error-in-running-the-first-two-lines-in-the-tutorial/338/4 "2017-10-25T14:33:11Z")

</div>

Which Python 2? Maybe SocketServer was a late addition.

---

<div class="post-metadata">

**Author:** ![alerodriguez](https://avatars.discourse-cdn.com/v4/letter/a/898d66/32.png) [@alerodriguez](https://discuss.hail.is/u/alerodriguez)\
**Post date:** [October 25, 2017, 4:21pm UTC](https://discuss.hail.is/t/hail-overview-error-in-running-the-first-two-lines-in-the-tutorial/338/5 "2017-10-25T16:21:43Z")

</div>

Python 2.7.10

I was originally running python 3 and if I type python -V on my terminal I am running Python 2.7.10  
However i am Not sure if this is also happening in the Jupyter note book.  
This is how I was able to set python 2 as default in my computer:  
**_set python 2 as default to my computer_** \*\*\*\*\*\*\*\*\*  
Use this to create your temporary python “install”

# (Assuming that is the correct path to the python interpreter you want to use.)

virtualenv -p /usr/bin/python2.7 --distribute temp-python

# Type this command when you want to use your temporary python.

# While you are using your temporary python you will also have access to a temporary pip,

# which will keep all packages installed with it separate from your main python install.

# A shorter version of this command would be “. temp-python/bin/activate”

source temp-python/bin/activate

# When you no longer wish to use you temporary python type

deactivate

* * *

Thanks for your help

---

<div class="post-metadata">

**Author:** ![tpoterba](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/tpoterba/32/61_2.png) [@tpoterba](https://discuss.hail.is/u/tpoterba)\
**Post date:** [October 25, 2017, 4:49pm UTC](https://discuss.hail.is/t/hail-overview-error-in-running-the-first-two-lines-in-the-tutorial/338/6 "2017-10-25T16:49:30Z")

</div>

inside the jupyter notebook, can you give us the output of:

```python
import sys
print(sys.version_info)

```

---

<div class="post-metadata">

**Author:** ![alerodriguez](https://avatars.discourse-cdn.com/v4/letter/a/898d66/32.png) [@alerodriguez](https://discuss.hail.is/u/alerodriguez)\
**Post date:** [October 25, 2017, 6:01pm UTC](https://discuss.hail.is/t/hail-overview-error-in-running-the-first-two-lines-in-the-tutorial/338/7 "2017-10-25T18:01:49Z")

</div>

sys.version\_info(major=3, minor=5, micro=2, releaselevel=‘final’, serial=0)

---

<div class="post-metadata">

**Author:** ![tpoterba](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/tpoterba/32/61_2.png) [@tpoterba](https://discuss.hail.is/u/tpoterba)\
**Post date:** [October 25, 2017, 6:08pm UTC](https://discuss.hail.is/t/hail-overview-error-in-running-the-first-two-lines-in-the-tutorial/338/8 "2017-10-25T18:08:54Z")

</div>

Yep, your notebook still has python 3. The below link has instructions for now to set up multiple ipython kernels for jupyter, which will let you make a python 2 version for hail and python 3 version for other projects (if necessary)

> <https://stackoverflow.com/questions/30492623/using-both-python-2-x-and-python-3-x-in-ipython-notebook>

---

<div class="post-metadata">

**Author:** ![alerodriguez](https://avatars.discourse-cdn.com/v4/letter/a/898d66/32.png) [@alerodriguez](https://discuss.hail.is/u/alerodriguez)\
**Post date:** [October 25, 2017, 6:13pm UTC](https://discuss.hail.is/t/hail-overview-error-in-running-the-first-two-lines-in-the-tutorial/338/9 "2017-10-25T18:13:46Z")

</div>

> [@tpoterba](#):
>
> ple ipython kernels for jupyter, which will let you make a python 2 version for hail and python 3 version for other

I fixed that :  
sys.version\_info(major=2, minor=7, micro=14, releaselevel=‘final’, serial=0)

## but there is still a different error:

ImportError Traceback (most recent call last)  
 in ()  
----\> 1 from hail import \*  
2 hc = HailContext()

/Users/AleRodriguez/bin/hail/python/hail/ **init**.py in ()  
----\> 1 import hail.expr  
2 from hail.representation import \*  
3 from hail.context import HailContext  
4 from hail.dataset import VariantDataset  
5 from hail.expr import \*

/Users/AleRodriguez/bin/hail/python/hail/expr.py in ()  
1 import abc  
----\> 2 from hail.java import scala\_object, Env, jset  
3 from hail.representation import Variant, AltAllele, Genotype, Locus, Interval, Struct, Call  
4  
5

/Users/AleRodriguez/bin/hail/python/hail/java.py in ()  
4 from threading import Thread  
5  
----\> 6 import py4j  
7 from decorator import decorator  
8

ImportError: No module named py4j

---

<div class="post-metadata">

**Author:** ![alerodriguez](https://avatars.discourse-cdn.com/v4/letter/a/898d66/32.png) [@alerodriguez](https://discuss.hail.is/u/alerodriguez)\
**Post date:** [October 25, 2017, 6:16pm UTC](https://discuss.hail.is/t/hail-overview-error-in-running-the-first-two-lines-in-the-tutorial/338/10 "2017-10-25T18:16:03Z")

</div>

I did used the following to build kernels:  
conda create -n py27 python=2.7 ipykernel  
conda create -n py36 python=3.6 ipykernel

---

<div class="post-metadata">

**Author:** ![tpoterba](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/tpoterba/32/61_2.png) [@tpoterba](https://discuss.hail.is/u/tpoterba)\
**Post date:** [October 25, 2017, 6:31pm UTC](https://discuss.hail.is/t/hail-overview-error-in-running-the-first-two-lines-in-the-tutorial/338/11 "2017-10-25T18:31:45Z")

</div>

OK, this is good, we’ve gotten to a new error!

How did you install Hail? Are you using the distribution? If so, then you should be able to follow the instructions on the [getting started page](https://hail.is/docs/stable/getting_started.html) to use the `jhail` script.

---

<div class="post-metadata">

**Author:** ![alerodriguez](https://avatars.discourse-cdn.com/v4/letter/a/898d66/32.png) [@alerodriguez](https://discuss.hail.is/u/alerodriguez)\
**Post date:** [October 25, 2017, 11:25pm UTC](https://discuss.hail.is/t/hail-overview-error-in-running-the-first-two-lines-in-the-tutorial/338/12 "2017-10-25T23:25:07Z")

</div>

I installed Hail by following the instructions on the page you are suggesting, to make sure I also went back and did this again. There is a serious problem with this instructions because I noticed that many people are having trouble with the installations and somehow their always instructed to go back to the getting started page.

**First**  
Here, fill in the path to the **unzipped** Hail distribution.  
#this is the location where Hail-0.1-0ab38b4c77e7-Spark-2.0.2.zip is located.  
also where the unzipped folder is located **hail** so I have edited these lines to include the path to these two:  
export HAIL\_HOME=/Users/AleRodriguez/  
I am not sure if the instruction is to keep this line intact but that is what I did:  
export PATH=$PATH:$HAIL\_HOME/bin/

---

<div class="post-metadata">

**Author:** ![alerodriguez](https://avatars.discourse-cdn.com/v4/letter/a/898d66/32.png) [@alerodriguez](https://discuss.hail.is/u/alerodriguez)\
**Post date:** [October 25, 2017, 11:29pm UTC](https://discuss.hail.is/t/hail-overview-error-in-running-the-first-two-lines-in-the-tutorial/338/13 "2017-10-25T23:29:42Z")

</div>

also  
java -version  
java version "9.0.1"  
Java™ SE Runtime Environment (build 9.0.1+11)  
Java HotSpot™ 64-Bit Server VM (build 9.0.1+11, mixed mode)

---

<div class="post-metadata">

**Author:** ![tpoterba](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/tpoterba/32/61_2.png) [@tpoterba](https://discuss.hail.is/u/tpoterba)\
**Post date:** [October 25, 2017, 11:32pm UTC](https://discuss.hail.is/t/hail-overview-error-in-running-the-first-two-lines-in-the-tutorial/338/14 "2017-10-25T23:32:44Z")

</div>

Thanks for the feedback, it’s good to know what’s not clear! I’ll update the doc to be more specific about using the path to the unzipped distribution folder, not the directory containing it.

I think for you the first line should be:

```nohighlight
export HAIL_HOME=/Users/AleRodriguez/Hail-0.1-0ab38b4c77e7-Spark-2.0.2

```

I also just saw your latest post about your java version. Hail isn’t tested or built against java 9, so you’ll need to install java 8. Sorry for the strict dependencies, we’re working on making things more flexible!

---

<div class="post-metadata">

**Author:** ![alerodriguez](https://avatars.discourse-cdn.com/v4/letter/a/898d66/32.png) [@alerodriguez](https://discuss.hail.is/u/alerodriguez)\
**Post date:** [October 26, 2017, 4:22am UTC](https://discuss.hail.is/t/hail-overview-error-in-running-the-first-two-lines-in-the-tutorial/338/15 "2017-10-26T04:22:27Z")

</div>

Here is what I have  
I both typed these into the command line and also edited my ~/.bash\_profile (added all 3 lines)

**export SPARK\_HOME=/Users/AleRodriguez/spark-2.2.0-bin-hadoop2.7.tgz**  
**export HAIL\_HOME=/Users/AleRodriguez/Hail-0.1-0ab38b4c77e7-Spark-2.0.2.zip**  
**export PATH=$PATH:$HAIL\_HOME/bin/**

I have also set Java 8 as default:  
java version "1.8.0\_151"  
Java™ SE Runtime Environment (build 1.8.0\_151-b12)  
Java HotSpot™ 64-Bit Server VM (build 25.151-b12, mixed mode)

still not working very frustrating

---

<div class="post-metadata">

**Author:** ![danking](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/danking/32/43_2.png) [@danking](https://discuss.hail.is/u/danking)\
**Post date:** [October 26, 2017, 3:00pm UTC](https://discuss.hail.is/t/hail-overview-error-in-running-the-first-two-lines-in-the-tutorial/338/16 "2017-10-26T15:00:20Z")

</div>

Before anything else, I notice that you have:

```python
/Users/AleRodriguez/spark-2.2.0-bin-hadoop2.7.tgz

```

But the getting started page notes:

> - Spark 2.0.2. Hail should work with other versions of Spark 2, see below.

followed by:

> Hail uploads distributions to Google Storage as part of our continuous  
> integration suite. You can download a pre-built distribution from the below  
> links. Make sure you download the distribution that matches your Spark  
> version!

But it looks like the distribution you downloaded is

```python
/Users/AleRodriguez/Hail-0.1-0ab38b4c77e7-Spark-2.0.2.zip

```

Note the `Spark-2.0.2`. Your hail distribution must be compatible with your  
Spark version, as noted above. Try downloading Spark 2.0.2 instead:

> **[Apache Download Mirrors](https://www.apache.org/dyn/closer.lua/spark/spark-2.0.2/spark-2.0.2-bin-hadoop2.7.tgz)**
>
> Home page of The Apache Software Foundation

* * *

Now, let’s take this from the top:

```python
# cd /Users/AleRodriguez
# ls

```

I assume this prints a list of files including: `spark-2.0.2-bin-hadoop2.7.tgz`  
and `Hail-0.1-0ab38b4c77e7-Spark-2.0.2.zip`.

> Unzip the distribution after you download it.

```python
# unzip Hail-0.1-0ab38b4c77e7-Spark-2.0.2.zip
# ls

```

Now there should be a folder `/Users/AleRodriguez/hail` that contains five  
sub-folders:

```python
# ls /Users/AleRodriguez/hail
bin docs jars python tutorials

```

> Next, edit and copy the below bash commands to set up the Hail environment  
> variables. You may want to add these to your bash dot-file (~/.bash\_profile,  
> ~/.bashrc, etc) so that you don’t need to rerun these commands in each new  
> session.
> 
> Here, fill in the path to the un-tarred Spark package.
> 
> ```python
> export SPARK_HOME=???
> 
> ```

At this point, if you have not yet un-tarred the Spark package, do that:

```python
# pwd
/Users/AleRodriguez
# tar -xvf spark-2.0.2-bin-hadoop2.7.tgz

```

You can read more about `tar` at it’s man page:

```python
man tar

```

Back to the issue of editing `~/.bashrc`, let’s fill in the “path to the  
_un-tarred_ Spark package”:

```python
export SPARK_HOME=/Users/AleRodriguez/spark-2.0.2-bin-hadoop2.7

```

> Here, fill in the path to the unzipped Hail distribution.
> 
> ```python
> export HAIL_HOME=???
> export PATH=$PATH:$HAIL_HOME/bin/
> 
> ```

Let’s enter the _unzipped_ Hail distribution:

```python
export HAIL_HOME=/Users/AleRodriguez/hail
export PATH=$PATH:$HAIL_HOME/bin/

```

Now let’s save `~/.bashrc`. Back at the terminal, [we need to load the changes we  
just made](https://stackoverflow.com/questions/2518127/how-do-i-reload-bashrc-without-logging-out-and-back-in):

```python
# source ~/.bashrc

```

Now let’s get hailing:

```python
# ihail

```

---

<div class="post-metadata">

**Author:** ![alerodriguez](https://avatars.discourse-cdn.com/v4/letter/a/898d66/32.png) [@alerodriguez](https://discuss.hail.is/u/alerodriguez)\
**Post date:** [October 26, 2017, 5:48pm UTC](https://discuss.hail.is/t/hail-overview-error-in-running-the-first-two-lines-in-the-tutorial/338/17 "2017-10-26T17:48:47Z")

</div>

great this works, I was not loading the changes using **source ~/.bashrc**  
and yes my spark version was not compatible with hail  
Thank you very much!!!
