# BLAS/LAPACK Linking Issues

**URL:** <https://discuss.hail.is/t/blas-lapack-linking-issues/3534>\
**Category:** Hail Query & hailctl\
**Created:** [August 7, 2023, 2:08am UTC](https://discuss.hail.is/t/blas-lapack-linking-issues/3534 "2023-08-07T02:08:10Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![sk4](https://avatars.discourse-cdn.com/v4/letter/s/65b543/32.png) [@sk4](https://discuss.hail.is/u/sk4)\
**Post date:** [November 9, 2023, 3:51am UTC](https://discuss.hail.is/t/blas-lapack-linking-issues/3534/4 "2023-11-09T03:51:24Z")

</div>

Hi @danking,

It appears that the BLAS linking issue isn’t fully solved for me. While setting the `--conf` flag to point to the OpenBLAS/LAPACK paths when running `spark-submit` works for `hl.hwe_normalized_pca`, the same setting doesn’t work for `hl.logistic_regression_rows`. I’ve tried different settings based on the fixes you suggested, but none of them have worked so far.

Option 1: set the `--conf` path to directly point to OpenBLAS/LAPACK, i.e.

```python
--conf spark.executor.extraClassPath=/usr/lib64/libopenblas.so:/usr/lib64/liblapack.so

```

Option 2: create symlinks to OpenBLAS/LAPACK and add to `LD_LIBRARY_PATH`, i.e.

```python
ln -s /usr/lib64/libopenblas.so ~/lib/libblas.so`
ln -s /usr/lib64/liblapack.so ~/lib/liblapack.so`
export LD_LIBRARY_PATH=~/lib:$LD_LIBRARY_PATH

```

Option 3: set the `--conf` path to point to the symlink for OpenBLAS/LAPACK, i.e.

```python
--conf spark.executor.extraClassPath=~/lib/libblas.so:~/lib/liblapack.so

```

Option 4: enable both Option 2 + 3

This is the example I’m trying to run, initially posted in this forum:

> [@While running a GWAS / linear regression I get: "Answer from Java side empty" and "undefined symbol: cblas\_dgemv"](https://discuss.hail.is/t/while-running-a-gwas-linear-regression-i-get-answer-from-java-side-empty-and-undefined-symbol-cblas-dgemv/2375):
>
> I’m getting this error when I try to run a simple GWAS /apps/well/java/jdk1.8.0\_latest/bin/java: symbol lookup error: /tmp/jniloader1259648657693918558netlib-native\_system-linux-x86\_64.so: undefined symbol: cblas\_dgemv ERROR:root:Exception while sending command. Traceback (most recent call last): File "/well/lindgren/UKBIOBANK/nbaya/conda/envs/hail/lib/python3.6/site-packages/py4j/java\_gateway.py", line 1159, in send\_command raise Py4JNetworkError("Answer from Java side is empty") py4j.pr…

```python
import hail as hl
hl.init(log='hail.log')
mt = hl.balding_nichols_model(1,100,2)
mt = mt.annotate_cols(y = hl.rand_bool(0.5))
result_ht = hl.logistic_regression_rows(
	test='wald',
	y=mt.y, 
	x=mt.GT.n_alt_alleles(), 
	covariates=[1]
)

```

I don’t have root privileges on the server I’m using, and Hail is loaded through a modulefile (though I load Spark/Java dependencies separately). In general, I start the Spark server first before initializing Hail with `spark-submit`, so `hl.init(spark_conf=...)` wouldn’t work like you mentioned. Is there any other fix that could work for this issue?

---

_[View the full topic](https://discuss.hail.is/t/blas-lapack-linking-issues/3534)._
