An error occurred while calling z:is.hail.backend.spark.SparkBackend.apply. : java.lang.ExceptionInInitializerError

Hello,

I installed hail in my Mac M2 Pro with pip:

pip install hail

Then I tried to run my first query, using your example, to verify everything was okay:

ipython
import hail as hl
mt = hl.balding_nichols_model(n_populations=3,
                              n_samples=10,
                              n_variants=100)
mt.show()

But the command

mt = hl.balding_nichols_model(n_populations=3,
                              n_samples=10,
                              n_variants=100)

gives me an error that I donā€™t know how to solve:

An error occurred while calling z:is.hail.backend.spark.SparkBackend.apply.
: java.lang.ExceptionInInitializerError

I was trying to do what you specified here How do I fix "java.net.BindException: Can't assign requested address"? - #4 by tpoterba :

"First try this:

sudo /bin/sh -c ā€œecho "127.0.0.1 $(hostname)" >> /etc/hostnameā€
Now try to use Hail. If Hail gives the same error, try this:

echo ā€˜export PYSPARK_SUBMIT_ARGS=ā€™'ā€˜ā€“driver-memory 16g --executor-memory 16g --conf ā€œspark.driver.bindAddress=127.0.0.1ā€ pyspark-shellā€™' >> ~/.(basename {SHELL})rc

Now try Hail again. If it still fails, respond to this thread."

But no success.

Some other info that may be useful:

java --version
openjdk 21 2023-09-19

OpenJDK Runtime Environment Zulu21.28+85-CA (build 21+35)

OpenJDK 64-Bit Server VM Zulu21.28+85-CA (build 21+35, mixed mode, sharing)
$python --version

Python 3.11.5



$ipython --version

8.15.0

Could you please help me to solve this?

Thank you very much!

Hey @ldomenech !

Can you post the complete stack trace and any other output? I need all that info to be certain what is wrong.

In the meantime, you should try using Java 8 or Java 11. Iā€™m not certain Hail will work with Java 21. We have some links about install java here. If youā€™re using a Mac, you can check these instructions for changing the version of Java once youā€™ve installed an older version:

Hi @danking ,

Iā€™ve installed Java 8 and used it, and the example query is working now!

Thank you so much!

(let me know if you want more information about the error anyway)

1 Like