# Error when using the write() function

**URL:** <https://discuss.hail.is/t/error-when-using-the-write-function/4215>\
**Category:** Hail Query & hailctl\
**Created:** [November 17, 2025, 2:55pm UTC](https://discuss.hail.is/t/error-when-using-the-write-function/4215 "2025-11-17T14:55:48Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![ehigham](https://yyz2.discourse-cdn.com/flex036/user_avatar/discuss.hail.is/ehigham/32/943_2.png) [@ehigham](https://discuss.hail.is/u/ehigham)\
**Post date:** [November 18, 2025, 5:51pm UTC](https://discuss.hail.is/t/error-when-using-the-write-function/4215/2 "2025-11-18T17:51:07Z")

</div>

Hi @marise,

A couple of things to note here:

First, I suspect this is a problem with the classpath. Can you try running `hl.init` without starting a spark session? If this works, then you’ll need to manually configure spark as Dan suggested in the post below before you create the session. You can do this via `pyspark.SparkConf` in your python session.

> [@Initialise Hail with existing Spark](https://discuss.hail.is/t/initialise-hail-with-existing-spark/3376/2):
>
> Hi @ireneisdoomed ! Are the Hail JARs in the class path of your Spark cluster? There are some details on using [arbitrary Spark clusters in the docs](https://hail.is/docs/0.2/install/other-cluster.html). For example, if you’re using spark-submit, you need to specify the JAR paths: HAIL\_HOME=$(pip3 show hail | grep Location | awk -F' ' '{print $2 "/hail"}') spark-submit \ --jars $HAIL\_HOME/hail-all-spark.jar \ --conf spark.driver.extraClassPath=$HAIL\_HOME/hail-all-spark.jar \ --conf spark.executor.extraClassPath=./hail-all-spark.jar \ --co…

Secondly, `driver_cores` has no effect if you’re creating your own spark session. Also `worker_memory` applies to the `'batch'` backend only.

Hope this helps,

---

_[View the full topic](https://discuss.hail.is/t/error-when-using-the-write-function/4215)._
