GWAS command error: py4j.protocol.Py4JNetworkError: Answer from Java side is empty

Do anyone know how to solve the error?
Thanks so much!!!

gwas = hl.linear_regression_rows(y=common_mt.CaffeineConsumption, x=common_mt.GT.n_alt_alleles(), covariates=[1.0])
gwas.row.describe()

2018-10-26 14:23:36 Hail: INFO: linear_regression_rows: running on 250 samples for 1 response variable y,
with input variable x, and 1 additional covariate…
ERROR:root:Exception while sending command.
Traceback (most recent call last):
File “/home/suxuexia/miniconda3/lib/python3.7/site-packages/py4j/java_gateway.py”, line 1159, in send_command
raise Py4JNetworkError(“Answer from Java side is empty”)
py4j.protocol.Py4JNetworkError: Answer from Java side is empty

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/home/suxuexia/miniconda3/lib/python3.7/site-packages/py4j/java_gateway.py”, line 985, in send_command
response = connection.send_command(command)
File “/home/suxuexia/miniconda3/lib/python3.7/site-packages/py4j/java_gateway.py”, line 1164, in send_command
“Error while receiving”, e, proto.ERROR_ON_RECEIVE)
py4j.protocol.Py4JNetworkError: Error while receiving


Py4JError Traceback (most recent call last)
in
----> 1 gwas = hl.linear_regression_rows(y=common_mt.CaffeineConsumption, x=common_mt.GT.n_alt_alleles(), covariates=[1.0])
2 gwas.row.describe()

in linear_regression_rows(y, x, covariates, block_size)

~/miniconda3/lib/python3.7/site-packages/hail/typecheck/check.py in wrapper(__original_func, *args, **kwargs)
558 def wrapper(original_func, *args, **kwargs):
559 args
, kwargs
= check_all(__original_func, args, kwargs, checkers, is_method=is_method)
–> 560 return original_func(*args, **kwargs)
561
562 return wrapper

~/miniconda3/lib/python3.7/site-packages/hail/methods/statgen.py in linear_regression_rows(y, x, covariates, block_size)
352 x_field_name,
353 jarray(Env.jvm().java.lang.String, cov_field_names),
–> 354 block_size)
355
356 ht_result = Table(jt)

~/miniconda3/lib/python3.7/site-packages/py4j/java_gateway.py in call(self, *args)
1255 answer = self.gateway_client.send_command(command)
1256 return_value = get_return_value(
-> 1257 answer, self.gateway_client, self.target_id, self.name)
1258
1259 for temp_arg in temp_args:

~/miniconda3/lib/python3.7/site-packages/hail/utils/java.py in deco(*args, **kwargs)
196 import pyspark
197 try:
–> 198 return f(*args, **kwargs)
199 except py4j.protocol.Py4JJavaError as e:
200 s = e.java_exception.toString()

~/miniconda3/lib/python3.7/site-packages/py4j/protocol.py in get_return_value(answer, gateway_client, target_id, name)
334 raise Py4JError(
335 “An error occurred while calling {0}{1}{2}”.
–> 336 format(target_id, “.”, name))
337 else:
338 type = answer[1]

Py4JError: An error occurred while calling z:is.hail.methods.LinearRegression.apply

==============what I do next step=========================================

[suxuexia@localhost py4j]$ pip install py4j

Requirement already satisfied: py4j in /home/suxuexia/miniconda3/lib/python3.7/site-packages (0.10.7)

hail 0.2.2 has requirement ipykernel<5, but you’ll have ipykernel 5.1.0 which is incompatible.

[suxuexia@localhost py4j]$ pip show ipykernel

[suxuexia@localhost py4j]$ pip uninstall ipykernel

[suxuexia@localhost py4j]$ pip install ipykernel

[suxuexia@localhost py4j]$ pip show ipykernel

Name: ipykernel

Version: 4.10.0

Summary: IPython Kernel for Jupyter

Home-page: http://ipython.org

Author: IPython Development Team

Author-email: ipython-dev@scipy.org

License: BSD

Location: /home/suxuexia/miniconda3/lib/python3.7/site-packages

Requires: traitlets, ipython, tornado, jupyter-client

Required-by: notebook, hail

=========================generate a new error=======================================

gwas = hl.linear_regression_rows(y=common_mt.CaffeineConsumption, x=common_mt.GT.n_alt_alleles(), covariates=[1.0])
gwas.row.describe()

ERROR:py4j.java_gateway:An error occurred while trying to connect to the Java server (127.0.0.1:47944)
Traceback (most recent call last):
File “/home/suxuexia/miniconda3/lib/python3.7/site-packages/py4j/java_gateway.py”, line 929, in _get_connection
connection = self.deque.pop()
IndexError: pop from an empty deque

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/home/suxuexia/miniconda3/lib/python3.7/site-packages/py4j/java_gateway.py”, line 1067, in start
self.socket.connect((self.address, self.port))
ConnectionRefusedError: [Errno 111] Connection refused


IndexError Traceback (most recent call last)
~/miniconda3/lib/python3.7/site-packages/py4j/java_gateway.py in _get_connection(self)
928 try:
–> 929 connection = self.deque.pop()
930 except IndexError:

IndexError: pop from an empty deque

During handling of the above exception, another exception occurred:

ConnectionRefusedError Traceback (most recent call last)
~/miniconda3/lib/python3.7/site-packages/py4j/java_gateway.py in start(self)
1066 try:
-> 1067 self.socket.connect((self.address, self.port))
1068 self.stream = self.socket.makefile(“rb”)

ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Py4JNetworkError Traceback (most recent call last)
in
----> 1 gwas = hl.linear_regression_rows(y=common_mt.CaffeineConsumption, x=common_mt.GT.n_alt_alleles(), covariates=[1.0])
2 gwas.row.describe()

in linear_regression_rows(y, x, covariates, block_size)

~/miniconda3/lib/python3.7/site-packages/hail/typecheck/check.py in wrapper(__original_func, *args, **kwargs)
558 def wrapper(original_func, *args, **kwargs):
559 args
, kwargs
= check_all(__original_func, args, kwargs, checkers, is_method=is_method)
–> 560 return original_func(*args, **kwargs)
561
562 return wrapper

~/miniconda3/lib/python3.7/site-packages/hail/methods/statgen.py in linear_regression_rows(y, x, covariates, block_size)
345 row_exprs=dict(mt.row_key),
346 col_key=[],
–> 347 entry_exprs={x_field_name: x})
348
349 jt = Env.hail().methods.LinearRegression.apply(

in _select_all(self, row_exprs, row_key, col_exprs, col_key, entry_exprs, global_exprs)

~/miniconda3/lib/python3.7/site-packages/hail/typecheck/check.py in wrapper(__original_func, *args, **kwargs)
558 def wrapper(original_func, *args, **kwargs):
559 args
, kwargs
= check_all(__original_func, args, kwargs, checkers, is_method=is_method)
–> 560 return original_func(*args, **kwargs)
561
562 return wrapper

~/miniconda3/lib/python3.7/site-packages/hail/matrixtable.py in _select_all(self, row_exprs, row_key, col_exprs, col_key, entry_exprs, global_exprs)
2569 row_struct = hl.struct(**row_exprs)
2570 analyze(“MatrixTable.select_rows”, row_struct, self._row_indices)
-> 2571 jmt = jmt.selectRows(str(row_struct._ir))
2572 if row_key is not None:
2573 jmt = jmt.keyRowsBy(row_key)

~/miniconda3/lib/python3.7/site-packages/hail/ir/base_ir.py in str(self)
8 def str(self):
9 r = Renderer(stop_at_jir = False)
—> 10 return r(self)
11
12 class IR(BaseIR):

~/miniconda3/lib/python3.7/site-packages/hail/ir/renderer.py in call(self, x)
24 return f’(JavaIR {jir_id})’
25 else:
—> 26 return x.render(self)

~/miniconda3/lib/python3.7/site-packages/hail/ir/ir.py in render(self, r)
944
945 def render(self, r):
–> 946 return ‘(MakeStruct {})’.format(’ ‘.join([’({} {})’.format(escape_id(f), r(x)) for (f, x) in self.fields]))
947
948 def eq(self, other):

~/miniconda3/lib/python3.7/site-packages/hail/ir/ir.py in (.0)
944
945 def render(self, r):
–> 946 return ‘(MakeStruct {})’.format(’ ‘.join([’({} {})’.format(escape_id(f), r(x)) for (f, x) in self.fields]))
947
948 def eq(self, other):

~/miniconda3/lib/python3.7/site-packages/hail/utils/java.py in escape_id(s)
165
166 def escape_id(s):
–> 167 return Env.jutils().escapeIdentifier(s)
168
169 def jarray_to_list(a):

~/miniconda3/lib/python3.7/site-packages/py4j/java_gateway.py in call(self, *args)
1253 proto.END_COMMAND_PART
1254
-> 1255 answer = self.gateway_client.send_command(command)
1256 return_value = get_return_value(
1257 answer, self.gateway_client, self.target_id, self.name)

~/miniconda3/lib/python3.7/site-packages/py4j/java_gateway.py in send_command(self, command, retry, binary)
981 if binary is True.
982 “”"
–> 983 connection = self._get_connection()
984 try:
985 response = connection.send_command(command)

~/miniconda3/lib/python3.7/site-packages/py4j/java_gateway.py in _get_connection(self)
929 connection = self.deque.pop()
930 except IndexError:
–> 931 connection = self._create_connection()
932 return connection
933

~/miniconda3/lib/python3.7/site-packages/py4j/java_gateway.py in _create_connection(self)
935 connection = GatewayConnection(
936 self.gateway_parameters, self.gateway_property)
–> 937 connection.start()
938 return connection
939

~/miniconda3/lib/python3.7/site-packages/py4j/java_gateway.py in start(self)
1077 “server ({0}:{1})”.format(self.address, self.port)
1078 logger.exception(msg)
-> 1079 raise Py4JNetworkError(msg, e)
1080
1081 def _authenticate_connection(self):

Py4JNetworkError: An error occurred while trying to connect to the Java server (127.0.0.1:47944)