Error creating Hail Context

I’m having trouble creating a HailContext. We’ve installed hail and its dependencies (Java, spark and python - can I double check which version of python is needed as the website say 2 yet the installation docs specify python 3?).

It happily imports hail but then gives me this error when I try creating a HailContext:

In [2]: from hail import *

In [3]: hc = HailContext

NameError Traceback (most recent call last)
in ()
----> 1 hc = HailContext
NameError: name ‘HailContext’ is not defined

Do you know what might be going on?

Many thanks!

Ruth

Hi Ruth,
This sounds like a Hail version issue. There are currently two versions of Hail people are using –

0.1: the stable version released about a year ago.
https://www.hail.is/docs/stable

0.2: the development version that has been in open beta for a few months
https://www.hail.is/docs/devel

We’re recommending that all new users start with 0.2 – it’s significantly better than 0.1 in many ways.

HailContext was an important part of 0.1, but it’s been removed in 0.2. I think you have 0.2 installed (which is good!).

Thank so much Tim! You are very correct! The kind folk at HPC services installed it for me and they obviously installed the right one but not the one I thought they were installing!

It is now happier but with hl.init() it gives me this error:
‘TypeError: ‘JavaPackage’ object is not callable’

Is this something to do with the hail-all-spark.jar? as I can’t find that within the installation and the only thing in /libs is this: genomicsdb-0.6.4.jar
I’m double checking with HPC folk about this.

Yes, exactly right. That error message means that Hail’s Python lib can’t find the JAR.

What configuration have you set? In particular, the section here should help:
https://hail.is/docs/devel/getting_started.html#running-on-a-spark-cluster

If you’re missing the extraClassPath stuff, I’d expect a message like this.

Yeah, I haven’t been able to set the extraClassPath stuff as the JAR file doesn’t exist.
I’ve tried to generate with:
./gradlew -Dspark.version=2.2.0 shadowJar archiveZip
but it doesn’t have a git repository
(‘fatal: Not a git repository (or any parent up to mount point /mnt/storage)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).’) and this is not something I can create so I’ll go back to the guy who kindly installed it. Unless there is another round it?

you shouldn’t need to recompile – you can download the distributions with the jar / python zip from here:
https://hail.is/docs/devel/getting_started.html#running-hail-locally-with-a-pre-compiled-distribution

Then you unzip, put the jar somewhere, and do the setup yourself, I think.

Yep, that’s worked - thank you!!