# Spark version problem

**URL:** <https://discuss.hail.is/t/spark-version-problem/936>\
**Category:** Hail Query & hailctl\
**Created:** [April 15, 2019, 8:24am UTC](https://discuss.hail.is/t/spark-version-problem/936 "2019-04-15T08:24:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jerry](https://avatars.discourse-cdn.com/v4/letter/j/5daacb/32.png) [@Jerry](https://discuss.hail.is/u/Jerry)\
**Post date:** [April 15, 2019, 8:24am UTC](https://discuss.hail.is/t/spark-version-problem/936/1 "2019-04-15T08:24:48Z")

</div>

Hi!

When I tried to use hail 0.2, it says:

Py4JJavaError: An error occurred while calling z:is.hail.HailContext.apply.  
: is.hail.utils.HailException: This Hail JAR was compiled for Spark 2.2.0, cannot run with Spark 2.4.0.  
…

But [https://hail.is/docs/0.2/getting\_started.html](https://hail.is/docs/0.2/getting_started.html) says " For all methods _other than using pip_ , you will additionally need [Spark 2.4.x](https://www.apache.org/dyn/closer.lua/spark/spark-2.4.0/spark-2.4.0-bin-hadoop2.7.tgz)."

When I change the spark version to 2.2.0, it shows the following message in the end:

Java gateway process exited before sending its port number

What should I do?

Jerry

---

<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:** [April 15, 2019, 1:18pm UTC](https://discuss.hail.is/t/spark-version-problem/936/2 "2019-04-15T13:18:46Z")

</div>

Ah, this is sort of a docs versioning problem. Last week we switched from building against 2.2.0 to 2.4.0, but haven’t deployed a new version to PyPI that uses 2.4.0.

How did you install Hail?

---

<div class="post-metadata">

**Author:** ![Jerry](https://avatars.discourse-cdn.com/v4/letter/j/5daacb/32.png) [@Jerry](https://discuss.hail.is/u/Jerry)\
**Post date:** [April 15, 2019, 2:48pm UTC](https://discuss.hail.is/t/spark-version-problem/936/3 "2019-04-15T14:48:29Z")

</div>

Hi, Tpoterba.

After days of trying, I finally successfully installed and initiated hail. But one more error occured…

ERROR:py4j.java\_gateway:An error occurred while trying to connect to the Java server (127.0.0.1:36348)

Jerry

---

<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:** [April 18, 2019, 8:04pm UTC](https://discuss.hail.is/t/spark-version-problem/936/4 "2019-04-18T20:04:45Z")

</div>

Did you install hail using `pip` or did you compile a JAR yourself?

Can you run the following and copy paste the entire output to here?

```auto
echo $SPARK_HOME
echo $HAIL_HOME
echo $PYTHONPATH
python -m pip show hail
python -m pip show pyspark
which pyspark
which python
which pip
python -c 'import hail as hl; hl.balding_nichols_model(3, 100, 100)._force_count_rows()'

```

Then run this:

```auto
ls -rt hail*.log | tail -n 1

```

That should print a filename. Can you please attach that file here?

Finally run this:

```auto
ls -lrt *hs_err_pid* | tail -n 1

```

If that outputs a filename, can you please attach that file here?

With that information, we will be able to diagnose your issue.
